mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-02-05 01:55:05 +08:00
Fix: Bug fixed (#12345)
### What problem does this PR solve? Fix: Bug fixed - Memory type multilingual display - Name modification is prohibited in Data source - Jump directly to Metadata settings ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@ -183,6 +183,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',
|
||||||
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:
|
||||||
|
|||||||
@ -128,7 +128,7 @@ export default {
|
|||||||
delMessageWarn: `遗忘后,代理将无法检索此消息。`,
|
delMessageWarn: `遗忘后,代理将无法检索此消息。`,
|
||||||
forgetMessage: '遗忘消息',
|
forgetMessage: '遗忘消息',
|
||||||
sessionId: '会话ID',
|
sessionId: '会话ID',
|
||||||
agent: '代理',
|
agent: '智能体',
|
||||||
type: '类型',
|
type: '类型',
|
||||||
validDate: '有效日期',
|
validDate: '有效日期',
|
||||||
forgetAt: '遗忘于',
|
forgetAt: '遗忘于',
|
||||||
@ -173,6 +173,7 @@ export default {
|
|||||||
},
|
},
|
||||||
knowledgeDetails: {
|
knowledgeDetails: {
|
||||||
metadata: {
|
metadata: {
|
||||||
|
toMetadataSetting: '生成设置',
|
||||||
descriptionTip:
|
descriptionTip:
|
||||||
'提供描述或示例来指导大语言模型为此字段提取值。如果留空,将依赖字段名称。',
|
'提供描述或示例来指导大语言模型为此字段提取值。如果留空,将依赖字段名称。',
|
||||||
restrictTDefinedValuesTip:
|
restrictTDefinedValuesTip:
|
||||||
|
|||||||
@ -15,6 +15,7 @@ import {
|
|||||||
TableRow,
|
TableRow,
|
||||||
} from '@/components/ui/table';
|
} from '@/components/ui/table';
|
||||||
import { useSetModalState } from '@/hooks/common-hooks';
|
import { useSetModalState } from '@/hooks/common-hooks';
|
||||||
|
import { Routes } from '@/routes';
|
||||||
import {
|
import {
|
||||||
ColumnDef,
|
ColumnDef,
|
||||||
flexRender,
|
flexRender,
|
||||||
@ -27,6 +28,7 @@ import {
|
|||||||
import { Plus, Settings, Trash2 } from 'lucide-react';
|
import { Plus, Settings, Trash2 } from 'lucide-react';
|
||||||
import { useCallback, useEffect, useMemo, useState } from 'react';
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
||||||
import { useTranslation } from 'react-i18next';
|
import { useTranslation } from 'react-i18next';
|
||||||
|
import { useHandleMenuClick } from '../../sidebar/hooks';
|
||||||
import {
|
import {
|
||||||
MetadataDeleteMap,
|
MetadataDeleteMap,
|
||||||
MetadataType,
|
MetadataType,
|
||||||
@ -78,7 +80,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
|||||||
addUpdateValue,
|
addUpdateValue,
|
||||||
addDeleteValue,
|
addDeleteValue,
|
||||||
} = useManageMetaDataModal(originalTableData, metadataType, otherData);
|
} = useManageMetaDataModal(originalTableData, metadataType, otherData);
|
||||||
|
const { handleMenuClick } = useHandleMenuClick();
|
||||||
const {
|
const {
|
||||||
visible: manageValuesVisible,
|
visible: manageValuesVisible,
|
||||||
showModal: showManageValuesModal,
|
showModal: showManageValuesModal,
|
||||||
@ -338,10 +340,23 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
|
|||||||
<div className="flex flex-col gap-2">
|
<div className="flex flex-col gap-2">
|
||||||
<div className="flex items-center justify-between">
|
<div className="flex items-center justify-between">
|
||||||
<div>{t('knowledgeDetails.metadata.metadata')}</div>
|
<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 && (
|
{isCanAdd && (
|
||||||
<Button
|
<Button
|
||||||
variant={'ghost'}
|
variant={'ghost'}
|
||||||
className="border border-border-button"
|
className="border border-border-button"
|
||||||
|
type="button"
|
||||||
onClick={handAddValueRow}
|
onClick={handAddValueRow}
|
||||||
>
|
>
|
||||||
<Plus />
|
<Plus />
|
||||||
|
|||||||
@ -25,12 +25,13 @@ 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 { useMemo, useState } from 'react';
|
import { useEffect, useMemo, useState } from 'react';
|
||||||
import {
|
import {
|
||||||
ControllerRenderProps,
|
ControllerRenderProps,
|
||||||
FieldValues,
|
FieldValues,
|
||||||
useFormContext,
|
useFormContext,
|
||||||
} from 'react-hook-form';
|
} from 'react-hook-form';
|
||||||
|
import { useLocation } from 'umi';
|
||||||
import {
|
import {
|
||||||
MetadataType,
|
MetadataType,
|
||||||
useManageMetadata,
|
useManageMetadata,
|
||||||
@ -368,6 +369,7 @@ export function AutoMetadata({
|
|||||||
otherData?: Record<string, any>;
|
otherData?: Record<string, any>;
|
||||||
}) {
|
}) {
|
||||||
// get metadata field
|
// get metadata field
|
||||||
|
const location = useLocation();
|
||||||
const form = useFormContext();
|
const form = useFormContext();
|
||||||
const {
|
const {
|
||||||
manageMetadataVisible,
|
manageMetadataVisible,
|
||||||
@ -377,6 +379,16 @@ export function AutoMetadata({
|
|||||||
config: metadataConfig,
|
config: metadataConfig,
|
||||||
} = useManageMetadata();
|
} = useManageMetadata();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const locationState = location.state as
|
||||||
|
| { openMetadata?: boolean }
|
||||||
|
| undefined;
|
||||||
|
if (locationState?.openMetadata) {
|
||||||
|
showManageMetadataModal();
|
||||||
|
locationState.openMetadata = false;
|
||||||
|
}
|
||||||
|
}, [location, showManageMetadataModal]);
|
||||||
|
|
||||||
const autoMetadataField: FormFieldConfig = {
|
const autoMetadataField: FormFieldConfig = {
|
||||||
name: 'parser_config.enable_metadata',
|
name: 'parser_config.enable_metadata',
|
||||||
label: t('knowledgeConfiguration.autoMetadata'),
|
label: t('knowledgeConfiguration.autoMetadata'),
|
||||||
|
|||||||
@ -7,8 +7,8 @@ export const useHandleMenuClick = () => {
|
|||||||
const { id } = useParams();
|
const { id } = useParams();
|
||||||
|
|
||||||
const handleMenuClick = useCallback(
|
const handleMenuClick = useCallback(
|
||||||
(key: Routes) => () => {
|
(key: Routes, data?: any) => () => {
|
||||||
navigate(`${Routes.DatasetBase}${key}/${id}`);
|
navigate(`${Routes.DatasetBase}${key}/${id}`, { state: data });
|
||||||
},
|
},
|
||||||
[id, navigate],
|
[id, navigate],
|
||||||
);
|
);
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import {
|
|||||||
} from '@/components/ui/table';
|
} from '@/components/ui/table';
|
||||||
import { Pagination } from '@/interfaces/common';
|
import { Pagination } from '@/interfaces/common';
|
||||||
import { replaceText } from '@/pages/dataset/process-log-modal';
|
import { replaceText } from '@/pages/dataset/process-log-modal';
|
||||||
|
import { MemoryOptions } from '@/pages/memories/constants';
|
||||||
import {
|
import {
|
||||||
ColumnDef,
|
ColumnDef,
|
||||||
ColumnFiltersState,
|
ColumnFiltersState,
|
||||||
@ -99,7 +100,12 @@ export function MemoryTable({
|
|||||||
header: () => <span>{t('memory.messages.type')}</span>,
|
header: () => <span>{t('memory.messages.type')}</span>,
|
||||||
cell: ({ row }) => (
|
cell: ({ row }) => (
|
||||||
<div className="text-sm font-medium capitalize">
|
<div className="text-sm font-medium capitalize">
|
||||||
{row.getValue('message_type')}
|
{row.getValue('message_type')
|
||||||
|
? MemoryOptions(t).find(
|
||||||
|
(item) =>
|
||||||
|
item.value === (row.getValue('message_type') as string),
|
||||||
|
)?.label
|
||||||
|
: row.getValue('message_type')}
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -117,13 +123,13 @@ export function MemoryTable({
|
|||||||
<div className="text-sm ">{row.getValue('forget_at')}</div>
|
<div className="text-sm ">{row.getValue('forget_at')}</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
// {
|
||||||
accessorKey: 'source_id',
|
// accessorKey: 'source_id',
|
||||||
header: () => <span>{t('memory.messages.source')}</span>,
|
// header: () => <span>{t('memory.messages.source')}</span>,
|
||||||
cell: ({ row }) => (
|
// cell: ({ row }) => (
|
||||||
<div className="text-sm ">{row.getValue('source_id')}</div>
|
// <div className="text-sm ">{row.getValue('source_id')}</div>
|
||||||
),
|
// ),
|
||||||
},
|
// },
|
||||||
{
|
{
|
||||||
accessorKey: 'status',
|
accessorKey: 'status',
|
||||||
header: () => <span>{t('memory.messages.enable')}</span>,
|
header: () => <span>{t('memory.messages.enable')}</span>,
|
||||||
|
|||||||
@ -127,9 +127,21 @@ const SourceDetailPage = () => {
|
|||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
const baseFields = DataSourceFormBaseFields.map((field) => {
|
||||||
|
if (field.name === 'name') {
|
||||||
|
return {
|
||||||
|
...field,
|
||||||
|
disabled: true,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
...field,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
if (detail) {
|
if (detail) {
|
||||||
const fields = [
|
const fields = [
|
||||||
...DataSourceFormBaseFields,
|
...baseFields,
|
||||||
...DataSourceFormFields[
|
...DataSourceFormFields[
|
||||||
detail.source as keyof typeof DataSourceFormFields
|
detail.source as keyof typeof DataSourceFormFields
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user