mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-01-01 01:25:32 +08:00
Fix: Batch parsing problem (#12358)
### What problem does this PR solve? Fix: Batch parsing problem ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -184,6 +184,7 @@ Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default lim
|
||||
knowledgeDetails: {
|
||||
metadata: {
|
||||
toMetadataSetting: 'Generation settings',
|
||||
toMetadataSettingTip: 'Set auto-metadata in Configuration.',
|
||||
descriptionTip:
|
||||
'Provide descriptions or examples to guide LLM extract values for this field. If left empty, it will rely on the field name.',
|
||||
restrictTDefinedValuesTip:
|
||||
|
||||
@ -173,6 +173,7 @@ export default {
|
||||
},
|
||||
knowledgeDetails: {
|
||||
metadata: {
|
||||
toMetadataSettingTip: '在配置中设置自动元数据',
|
||||
toMetadataSetting: '生成设置',
|
||||
descriptionTip:
|
||||
'提供描述或示例来指导大语言模型为此字段提取值。如果留空,将依赖字段名称。',
|
||||
|
||||
@ -337,80 +337,87 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
||||
success?.(res);
|
||||
}}
|
||||
>
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>{t('knowledgeDetails.metadata.metadata')}</div>
|
||||
{metadataType === MetadataType.Manage && (
|
||||
<Button
|
||||
variant={'ghost'}
|
||||
className="border border-border-button"
|
||||
type="button"
|
||||
onClick={handleMenuClick(Routes.DataSetSetting, {
|
||||
openMetadata: true,
|
||||
})}
|
||||
>
|
||||
{t('knowledgeDetails.metadata.toMetadataSetting')}
|
||||
</Button>
|
||||
)}
|
||||
{isCanAdd && (
|
||||
<Button
|
||||
variant={'ghost'}
|
||||
className="border border-border-button"
|
||||
type="button"
|
||||
onClick={handAddValueRow}
|
||||
>
|
||||
<Plus />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<Table rootClassName="max-h-[800px]">
|
||||
<TableHeader>
|
||||
{table.getHeaderGroups().map((headerGroup) => (
|
||||
<TableRow key={headerGroup.id}>
|
||||
{headerGroup.headers.map((header) => (
|
||||
<TableHead key={header.id}>
|
||||
{header.isPlaceholder
|
||||
? null
|
||||
: flexRender(
|
||||
header.column.columnDef.header,
|
||||
header.getContext(),
|
||||
)}
|
||||
</TableHead>
|
||||
))}
|
||||
</TableRow>
|
||||
))}
|
||||
</TableHeader>
|
||||
<TableBody className="relative">
|
||||
{table.getRowModel().rows?.length ? (
|
||||
table.getRowModel().rows.map((row) => (
|
||||
<TableRow
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() && 'selected'}
|
||||
className="group"
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<TableCell key={cell.id}>
|
||||
{flexRender(
|
||||
cell.column.columnDef.cell,
|
||||
cell.getContext(),
|
||||
)}
|
||||
</TableCell>
|
||||
<>
|
||||
<div className="flex flex-col gap-2">
|
||||
<div className="flex items-center justify-between">
|
||||
<div>{t('knowledgeDetails.metadata.metadata')}</div>
|
||||
{metadataType === MetadataType.Manage && false && (
|
||||
<Button
|
||||
variant={'ghost'}
|
||||
className="border border-border-button"
|
||||
type="button"
|
||||
onClick={handleMenuClick(Routes.DataSetSetting, {
|
||||
openMetadata: true,
|
||||
})}
|
||||
>
|
||||
{t('knowledgeDetails.metadata.toMetadataSetting')}
|
||||
</Button>
|
||||
)}
|
||||
{isCanAdd && (
|
||||
<Button
|
||||
variant={'ghost'}
|
||||
className="border border-border-button"
|
||||
type="button"
|
||||
onClick={handAddValueRow}
|
||||
>
|
||||
<Plus />
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<Table rootClassName="max-h-[800px]">
|
||||
<TableHeader>
|
||||
{table.getHeaderGroups().map((headerGroup) => (
|
||||
<TableRow key={headerGroup.id}>
|
||||
{headerGroup.headers.map((header) => (
|
||||
<TableHead key={header.id}>
|
||||
{header.isPlaceholder
|
||||
? null
|
||||
: flexRender(
|
||||
header.column.columnDef.header,
|
||||
header.getContext(),
|
||||
)}
|
||||
</TableHead>
|
||||
))}
|
||||
</TableRow>
|
||||
))
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={columns.length}
|
||||
className="h-24 text-center"
|
||||
>
|
||||
<Empty type={EmptyType.Data} />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
))}
|
||||
</TableHeader>
|
||||
<TableBody className="relative">
|
||||
{table.getRowModel().rows?.length ? (
|
||||
table.getRowModel().rows.map((row) => (
|
||||
<TableRow
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() && 'selected'}
|
||||
className="group"
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => (
|
||||
<TableCell key={cell.id}>
|
||||
{flexRender(
|
||||
cell.column.columnDef.cell,
|
||||
cell.getContext(),
|
||||
)}
|
||||
</TableCell>
|
||||
))}
|
||||
</TableRow>
|
||||
))
|
||||
) : (
|
||||
<TableRow>
|
||||
<TableCell
|
||||
colSpan={columns.length}
|
||||
className="h-24 text-center"
|
||||
>
|
||||
<Empty type={EmptyType.Data} />
|
||||
</TableCell>
|
||||
</TableRow>
|
||||
)}
|
||||
</TableBody>
|
||||
</Table>
|
||||
</div>
|
||||
{metadataType === MetadataType.Manage && (
|
||||
<div className=" absolute bottom-6 left-5 text-text-secondary text-sm">
|
||||
{t('knowledgeDetails.metadata.toMetadataSettingTip')}
|
||||
</div>
|
||||
)}
|
||||
</>
|
||||
</Modal>
|
||||
{manageValuesVisible && (
|
||||
<ManageValuesModal
|
||||
|
||||
@ -25,7 +25,7 @@ import { useComposeLlmOptionsByModelTypes } from '@/hooks/use-llm-request';
|
||||
import { cn } from '@/lib/utils';
|
||||
import { t } from 'i18next';
|
||||
import { Settings } from 'lucide-react';
|
||||
import { useEffect, useMemo, useState } from 'react';
|
||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||
import {
|
||||
ControllerRenderProps,
|
||||
FieldValues,
|
||||
@ -379,15 +379,28 @@ export function AutoMetadata({
|
||||
config: metadataConfig,
|
||||
} = useManageMetadata();
|
||||
|
||||
const handleClickOpenMetadata = useCallback(() => {
|
||||
const metadata = form.getValues('parser_config.metadata');
|
||||
const tableMetaData = util.metaDataSettingJSONToMetaDataTableData(metadata);
|
||||
showManageMetadataModal({
|
||||
metadata: tableMetaData,
|
||||
isCanAdd: true,
|
||||
type: type,
|
||||
record: otherData,
|
||||
});
|
||||
}, [form, otherData, showManageMetadataModal, type]);
|
||||
|
||||
useEffect(() => {
|
||||
const locationState = location.state as
|
||||
| { openMetadata?: boolean }
|
||||
| undefined;
|
||||
if (locationState?.openMetadata) {
|
||||
showManageMetadataModal();
|
||||
setTimeout(() => {
|
||||
handleClickOpenMetadata();
|
||||
}, 100);
|
||||
locationState.openMetadata = false;
|
||||
}
|
||||
}, [location, showManageMetadataModal]);
|
||||
}, [location, handleClickOpenMetadata]);
|
||||
|
||||
const autoMetadataField: FormFieldConfig = {
|
||||
name: 'parser_config.enable_metadata',
|
||||
@ -398,21 +411,7 @@ export function AutoMetadata({
|
||||
tooltip: t('knowledgeConfiguration.autoMetadataTip'),
|
||||
render: (fieldProps: ControllerRenderProps) => (
|
||||
<div className="flex items-center justify-between">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
onClick={() => {
|
||||
const metadata = form.getValues('parser_config.metadata');
|
||||
const tableMetaData =
|
||||
util.metaDataSettingJSONToMetaDataTableData(metadata);
|
||||
showManageMetadataModal({
|
||||
metadata: tableMetaData,
|
||||
isCanAdd: true,
|
||||
type: type,
|
||||
record: otherData,
|
||||
});
|
||||
}}
|
||||
>
|
||||
<Button type="button" variant="ghost" onClick={handleClickOpenMetadata}>
|
||||
<div className="flex items-center gap-2">
|
||||
<Settings />
|
||||
{t('knowledgeConfiguration.settings')}
|
||||
|
||||
@ -217,7 +217,7 @@ export default function Dataset() {
|
||||
{reparseDialogVisible && (
|
||||
<ReparseDialog
|
||||
// hidden={isZeroChunk || isRunning}
|
||||
hidden={true}
|
||||
hidden={false}
|
||||
handleOperationIconClick={handleOperationIconClick}
|
||||
chunk_num={chunkNum}
|
||||
visible={reparseDialogVisible}
|
||||
|
||||
@ -14,6 +14,7 @@ import { ChevronsDown, ChevronsUp, Trash2 } from 'lucide-react';
|
||||
import { FC } from 'react';
|
||||
import { isLocalLlmFactory } from '../../utils';
|
||||
import { useHandleDeleteFactory, useHandleEnableLlm } from '../hooks';
|
||||
import { mapModelKey } from './un-add-model';
|
||||
|
||||
interface IModelCardProps {
|
||||
item: LlmItem;
|
||||
@ -145,7 +146,8 @@ export const ModelProviderCard: FC<IModelCardProps> = ({
|
||||
key={index}
|
||||
className="px-2 py-1 text-xs bg-bg-card text-text-secondary rounded-md"
|
||||
>
|
||||
{tag}
|
||||
{mapModelKey[tag.trim() as keyof typeof mapModelKey] ||
|
||||
tag.trim()}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@ -7,7 +7,21 @@ import { useTranslate } from '@/hooks/common-hooks';
|
||||
import { useSelectLlmList } from '@/hooks/use-llm-request';
|
||||
import { ArrowUpRight, Plus } from 'lucide-react';
|
||||
import { FC, useMemo, useState } from 'react';
|
||||
|
||||
export const mapModelKey = {
|
||||
IMAGE2TEXT: 'VLM',
|
||||
'TEXT EMBEDDING': 'Embedding',
|
||||
SPEECH2TEXT: 'ASR',
|
||||
'TEXT RE-RANK': 'Rerank',
|
||||
};
|
||||
const orderMap: Record<TagType, number> = {
|
||||
LLM: 1,
|
||||
'TEXT EMBEDDING': 2,
|
||||
'TEXT RE-RANK': 3,
|
||||
TTS: 4,
|
||||
SPEECH2TEXT: 5,
|
||||
IMAGE2TEXT: 6,
|
||||
MODERATION: 7,
|
||||
};
|
||||
type TagType =
|
||||
| 'LLM'
|
||||
| 'TEXT EMBEDDING'
|
||||
@ -18,16 +32,6 @@ type TagType =
|
||||
| 'MODERATION';
|
||||
|
||||
const sortTags = (tags: string) => {
|
||||
const orderMap: Record<TagType, number> = {
|
||||
LLM: 1,
|
||||
'TEXT EMBEDDING': 2,
|
||||
'TEXT RE-RANK': 3,
|
||||
TTS: 4,
|
||||
SPEECH2TEXT: 5,
|
||||
IMAGE2TEXT: 6,
|
||||
MODERATION: 7,
|
||||
};
|
||||
|
||||
return tags
|
||||
.split(',')
|
||||
.map((tag) => tag.trim())
|
||||
@ -64,7 +68,10 @@ export const AvailableModels: FC<{
|
||||
factoryList.forEach((model) => {
|
||||
model.tags.split(',').forEach((tag) => tagsSet.add(tag.trim()));
|
||||
});
|
||||
return Array.from(tagsSet).sort();
|
||||
return Array.from(tagsSet).sort(
|
||||
(a, b) =>
|
||||
(orderMap[a as TagType] || 999) - (orderMap[b as TagType] || 999),
|
||||
);
|
||||
}, [factoryList]);
|
||||
|
||||
const handleTagClick = (tag: string) => {
|
||||
@ -114,7 +121,7 @@ export const AvailableModels: FC<{
|
||||
: 'text-text-secondary border-none bg-bg-card'
|
||||
}`}
|
||||
>
|
||||
{tag}
|
||||
{mapModelKey[tag.trim() as keyof typeof mapModelKey] || tag.trim()}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
@ -162,7 +169,9 @@ export const AvailableModels: FC<{
|
||||
key={index}
|
||||
className="px-1 flex items-center h-5 text-xs bg-bg-card text-text-secondary rounded-md"
|
||||
>
|
||||
{tag}
|
||||
{/* {tag} */}
|
||||
{mapModelKey[tag.trim() as keyof typeof mapModelKey] ||
|
||||
tag.trim()}
|
||||
</span>
|
||||
))}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user