mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-29 22:56:36 +08:00
Fix:Metadata saving, copywriting and other related issues (#12169)
### What problem does this PR solve? Fix:Bugs Fixed - Text overflow issues that caused rendering problems - Metadata saving, copywriting and other related issues ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -18,7 +18,9 @@ import { useFetchKnowledgeBaseConfiguration } from '@/hooks/use-knowledge-reques
|
||||
import { IModalProps } from '@/interfaces/common';
|
||||
import { IParserConfig } from '@/interfaces/database/document';
|
||||
import { IChangeParserConfigRequestBody } from '@/interfaces/request/document';
|
||||
import { MetadataType } from '@/pages/dataset/components/metedata/hooks/use-manage-modal';
|
||||
import {
|
||||
AutoMetadata,
|
||||
ChunkMethodItem,
|
||||
EnableTocToggle,
|
||||
ImageContextWindow,
|
||||
@ -86,6 +88,7 @@ export function ChunkMethodDialog({
|
||||
visible,
|
||||
parserConfig,
|
||||
loading,
|
||||
documentId,
|
||||
}: IProps) {
|
||||
const { t } = useTranslation();
|
||||
|
||||
@ -142,6 +145,18 @@ export function ChunkMethodDialog({
|
||||
pages: z
|
||||
.array(z.object({ from: z.coerce.number(), to: z.coerce.number() }))
|
||||
.optional(),
|
||||
metadata: z
|
||||
.array(
|
||||
z
|
||||
.object({
|
||||
key: z.string().optional(),
|
||||
description: z.string().optional(),
|
||||
enum: z.array(z.string().optional()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
)
|
||||
.optional(),
|
||||
enable_metadata: z.boolean().optional(),
|
||||
}),
|
||||
})
|
||||
.superRefine((data, ctx) => {
|
||||
@ -373,6 +388,10 @@ export function ChunkMethodDialog({
|
||||
)}
|
||||
{showAutoKeywords(selectedTag) && (
|
||||
<>
|
||||
<AutoMetadata
|
||||
type={MetadataType.SingleFileSetting}
|
||||
otherData={{ documentId }}
|
||||
/>
|
||||
<AutoKeywordsFormField></AutoKeywordsFormField>
|
||||
<AutoQuestionsFormField></AutoQuestionsFormField>
|
||||
</>
|
||||
|
||||
@ -36,9 +36,11 @@ export function useDefaultParserValues() {
|
||||
// },
|
||||
entity_types: [],
|
||||
pages: [],
|
||||
metadata: [],
|
||||
enable_metadata: false,
|
||||
};
|
||||
|
||||
return defaultParserValues;
|
||||
return defaultParserValues as IParserConfig;
|
||||
}, [t]);
|
||||
|
||||
return defaultParserValues;
|
||||
|
||||
@ -15,6 +15,7 @@ import { Progress } from '@/components/ui/progress';
|
||||
import { useControllableState } from '@/hooks/use-controllable-state';
|
||||
import { cn, formatBytes } from '@/lib/utils';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from './ui/tooltip';
|
||||
|
||||
function isFileWithPreview(file: File): file is File & { preview: string } {
|
||||
return 'preview' in file && typeof file.preview === 'string';
|
||||
@ -58,10 +59,17 @@ function FileCard({ file, progress, onRemove }: FileCardProps) {
|
||||
</div>
|
||||
<div className="flex flex-col flex-1 gap-2 overflow-hidden">
|
||||
<div className="flex flex-col gap-px">
|
||||
<p className="line-clamp-1 text-sm font-medium text-foreground/80 text-ellipsis">
|
||||
{file.name}
|
||||
</p>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<Tooltip>
|
||||
<TooltipTrigger asChild>
|
||||
<p className=" w-fit line-clamp-1 text-sm font-medium text-foreground/80 text-ellipsis truncate max-w-[370px]">
|
||||
{file.name}
|
||||
</p>
|
||||
</TooltipTrigger>
|
||||
<TooltipContent className="border border-border-button">
|
||||
{file.name}
|
||||
</TooltipContent>
|
||||
</Tooltip>
|
||||
<p className="text-xs text-text-secondary">
|
||||
{formatBytes(file.size)}
|
||||
</p>
|
||||
</div>
|
||||
@ -311,7 +319,7 @@ export function FileUploader(props: FileUploaderProps) {
|
||||
/>
|
||||
</div>
|
||||
<div className="flex flex-col gap-px">
|
||||
<p className="font-medium text-text-secondary">
|
||||
<p className="font-medium text-text-secondary ">
|
||||
{title || t('knowledgeDetails.uploadTitle')}
|
||||
</p>
|
||||
<p className="text-sm text-text-disabled">
|
||||
|
||||
Reference in New Issue
Block a user