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: {
|
knowledgeDetails: {
|
||||||
metadata: {
|
metadata: {
|
||||||
toMetadataSetting: 'Generation settings',
|
toMetadataSetting: 'Generation settings',
|
||||||
|
toMetadataSettingTip: 'Set auto-metadata in Configuration.',
|
||||||
descriptionTip:
|
descriptionTip:
|
||||||
'Provide descriptions or examples to guide LLM extract values for this field. If left empty, it will rely on the field name.',
|
'Provide descriptions or examples to guide LLM extract values for this field. If left empty, it will rely on the field name.',
|
||||||
restrictTDefinedValuesTip:
|
restrictTDefinedValuesTip:
|
||||||
|
|||||||
@ -173,6 +173,7 @@ export default {
|
|||||||
},
|
},
|
||||||
knowledgeDetails: {
|
knowledgeDetails: {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
toMetadataSettingTip: '在配置中设置自动元数据',
|
||||||
toMetadataSetting: '生成设置',
|
toMetadataSetting: '生成设置',
|
||||||
descriptionTip:
|
descriptionTip:
|
||||||
'提供描述或示例来指导大语言模型为此字段提取值。如果留空,将依赖字段名称。',
|
'提供描述或示例来指导大语言模型为此字段提取值。如果留空,将依赖字段名称。',
|
||||||
|
|||||||
@ -337,80 +337,87 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
|||||||
success?.(res);
|
success?.(res);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<div className="flex flex-col gap-2">
|
<>
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex flex-col gap-2">
|
||||||
<div>{t('knowledgeDetails.metadata.metadata')}</div>
|
<div className="flex items-center justify-between">
|
||||||
{metadataType === MetadataType.Manage && (
|
<div>{t('knowledgeDetails.metadata.metadata')}</div>
|
||||||
<Button
|
{metadataType === MetadataType.Manage && false && (
|
||||||
variant={'ghost'}
|
<Button
|
||||||
className="border border-border-button"
|
variant={'ghost'}
|
||||||
type="button"
|
className="border border-border-button"
|
||||||
onClick={handleMenuClick(Routes.DataSetSetting, {
|
type="button"
|
||||||
openMetadata: true,
|
onClick={handleMenuClick(Routes.DataSetSetting, {
|
||||||
})}
|
openMetadata: true,
|
||||||
>
|
})}
|
||||||
{t('knowledgeDetails.metadata.toMetadataSetting')}
|
>
|
||||||
</Button>
|
{t('knowledgeDetails.metadata.toMetadataSetting')}
|
||||||
)}
|
</Button>
|
||||||
{isCanAdd && (
|
)}
|
||||||
<Button
|
{isCanAdd && (
|
||||||
variant={'ghost'}
|
<Button
|
||||||
className="border border-border-button"
|
variant={'ghost'}
|
||||||
type="button"
|
className="border border-border-button"
|
||||||
onClick={handAddValueRow}
|
type="button"
|
||||||
>
|
onClick={handAddValueRow}
|
||||||
<Plus />
|
>
|
||||||
</Button>
|
<Plus />
|
||||||
)}
|
</Button>
|
||||||
</div>
|
)}
|
||||||
<Table rootClassName="max-h-[800px]">
|
</div>
|
||||||
<TableHeader>
|
<Table rootClassName="max-h-[800px]">
|
||||||
{table.getHeaderGroups().map((headerGroup) => (
|
<TableHeader>
|
||||||
<TableRow key={headerGroup.id}>
|
{table.getHeaderGroups().map((headerGroup) => (
|
||||||
{headerGroup.headers.map((header) => (
|
<TableRow key={headerGroup.id}>
|
||||||
<TableHead key={header.id}>
|
{headerGroup.headers.map((header) => (
|
||||||
{header.isPlaceholder
|
<TableHead key={header.id}>
|
||||||
? null
|
{header.isPlaceholder
|
||||||
: flexRender(
|
? null
|
||||||
header.column.columnDef.header,
|
: flexRender(
|
||||||
header.getContext(),
|
header.column.columnDef.header,
|
||||||
)}
|
header.getContext(),
|
||||||
</TableHead>
|
)}
|
||||||
))}
|
</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>
|
|
||||||
))}
|
))}
|
||||||
</TableRow>
|
</TableRow>
|
||||||
))
|
))}
|
||||||
) : (
|
</TableHeader>
|
||||||
<TableRow>
|
<TableBody className="relative">
|
||||||
<TableCell
|
{table.getRowModel().rows?.length ? (
|
||||||
colSpan={columns.length}
|
table.getRowModel().rows.map((row) => (
|
||||||
className="h-24 text-center"
|
<TableRow
|
||||||
>
|
key={row.id}
|
||||||
<Empty type={EmptyType.Data} />
|
data-state={row.getIsSelected() && 'selected'}
|
||||||
</TableCell>
|
className="group"
|
||||||
</TableRow>
|
>
|
||||||
)}
|
{row.getVisibleCells().map((cell) => (
|
||||||
</TableBody>
|
<TableCell key={cell.id}>
|
||||||
</Table>
|
{flexRender(
|
||||||
</div>
|
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>
|
</Modal>
|
||||||
{manageValuesVisible && (
|
{manageValuesVisible && (
|
||||||
<ManageValuesModal
|
<ManageValuesModal
|
||||||
|
|||||||
@ -25,7 +25,7 @@ import { useComposeLlmOptionsByModelTypes } from '@/hooks/use-llm-request';
|
|||||||
import { cn } from '@/lib/utils';
|
import { cn } from '@/lib/utils';
|
||||||
import { t } from 'i18next';
|
import { t } from 'i18next';
|
||||||
import { Settings } from 'lucide-react';
|
import { Settings } from 'lucide-react';
|
||||||
import { useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
ControllerRenderProps,
|
ControllerRenderProps,
|
||||||
FieldValues,
|
FieldValues,
|
||||||
@ -379,15 +379,28 @@ export function AutoMetadata({
|
|||||||
config: metadataConfig,
|
config: metadataConfig,
|
||||||
} = useManageMetadata();
|
} = 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(() => {
|
useEffect(() => {
|
||||||
const locationState = location.state as
|
const locationState = location.state as
|
||||||
| { openMetadata?: boolean }
|
| { openMetadata?: boolean }
|
||||||
| undefined;
|
| undefined;
|
||||||
if (locationState?.openMetadata) {
|
if (locationState?.openMetadata) {
|
||||||
showManageMetadataModal();
|
setTimeout(() => {
|
||||||
|
handleClickOpenMetadata();
|
||||||
|
}, 100);
|
||||||
locationState.openMetadata = false;
|
locationState.openMetadata = false;
|
||||||
}
|
}
|
||||||
}, [location, showManageMetadataModal]);
|
}, [location, handleClickOpenMetadata]);
|
||||||
|
|
||||||
const autoMetadataField: FormFieldConfig = {
|
const autoMetadataField: FormFieldConfig = {
|
||||||
name: 'parser_config.enable_metadata',
|
name: 'parser_config.enable_metadata',
|
||||||
@ -398,21 +411,7 @@ export function AutoMetadata({
|
|||||||
tooltip: t('knowledgeConfiguration.autoMetadataTip'),
|
tooltip: t('knowledgeConfiguration.autoMetadataTip'),
|
||||||
render: (fieldProps: ControllerRenderProps) => (
|
render: (fieldProps: ControllerRenderProps) => (
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<Button
|
<Button type="button" variant="ghost" onClick={handleClickOpenMetadata}>
|
||||||
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,
|
|
||||||
});
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<Settings />
|
<Settings />
|
||||||
{t('knowledgeConfiguration.settings')}
|
{t('knowledgeConfiguration.settings')}
|
||||||
|
|||||||
@ -217,7 +217,7 @@ export default function Dataset() {
|
|||||||
{reparseDialogVisible && (
|
{reparseDialogVisible && (
|
||||||
<ReparseDialog
|
<ReparseDialog
|
||||||
// hidden={isZeroChunk || isRunning}
|
// hidden={isZeroChunk || isRunning}
|
||||||
hidden={true}
|
hidden={false}
|
||||||
handleOperationIconClick={handleOperationIconClick}
|
handleOperationIconClick={handleOperationIconClick}
|
||||||
chunk_num={chunkNum}
|
chunk_num={chunkNum}
|
||||||
visible={reparseDialogVisible}
|
visible={reparseDialogVisible}
|
||||||
|
|||||||
@ -14,6 +14,7 @@ import { ChevronsDown, ChevronsUp, Trash2 } from 'lucide-react';
|
|||||||
import { FC } from 'react';
|
import { FC } from 'react';
|
||||||
import { isLocalLlmFactory } from '../../utils';
|
import { isLocalLlmFactory } from '../../utils';
|
||||||
import { useHandleDeleteFactory, useHandleEnableLlm } from '../hooks';
|
import { useHandleDeleteFactory, useHandleEnableLlm } from '../hooks';
|
||||||
|
import { mapModelKey } from './un-add-model';
|
||||||
|
|
||||||
interface IModelCardProps {
|
interface IModelCardProps {
|
||||||
item: LlmItem;
|
item: LlmItem;
|
||||||
@ -145,7 +146,8 @@ export const ModelProviderCard: FC<IModelCardProps> = ({
|
|||||||
key={index}
|
key={index}
|
||||||
className="px-2 py-1 text-xs bg-bg-card text-text-secondary rounded-md"
|
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>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -7,7 +7,21 @@ import { useTranslate } from '@/hooks/common-hooks';
|
|||||||
import { useSelectLlmList } from '@/hooks/use-llm-request';
|
import { useSelectLlmList } from '@/hooks/use-llm-request';
|
||||||
import { ArrowUpRight, Plus } from 'lucide-react';
|
import { ArrowUpRight, Plus } from 'lucide-react';
|
||||||
import { FC, useMemo, useState } from '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 =
|
type TagType =
|
||||||
| 'LLM'
|
| 'LLM'
|
||||||
| 'TEXT EMBEDDING'
|
| 'TEXT EMBEDDING'
|
||||||
@ -18,16 +32,6 @@ type TagType =
|
|||||||
| 'MODERATION';
|
| 'MODERATION';
|
||||||
|
|
||||||
const sortTags = (tags: string) => {
|
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
|
return tags
|
||||||
.split(',')
|
.split(',')
|
||||||
.map((tag) => tag.trim())
|
.map((tag) => tag.trim())
|
||||||
@ -64,7 +68,10 @@ export const AvailableModels: FC<{
|
|||||||
factoryList.forEach((model) => {
|
factoryList.forEach((model) => {
|
||||||
model.tags.split(',').forEach((tag) => tagsSet.add(tag.trim()));
|
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]);
|
}, [factoryList]);
|
||||||
|
|
||||||
const handleTagClick = (tag: string) => {
|
const handleTagClick = (tag: string) => {
|
||||||
@ -114,7 +121,7 @@ export const AvailableModels: FC<{
|
|||||||
: 'text-text-secondary border-none bg-bg-card'
|
: 'text-text-secondary border-none bg-bg-card'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
{tag}
|
{mapModelKey[tag.trim() as keyof typeof mapModelKey] || tag.trim()}
|
||||||
</Button>
|
</Button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
@ -162,7 +169,9 @@ export const AvailableModels: FC<{
|
|||||||
key={index}
|
key={index}
|
||||||
className="px-1 flex items-center h-5 text-xs bg-bg-card text-text-secondary rounded-md"
|
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>
|
</span>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user