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:
chanx
2025-12-31 10:43:57 +08:00
committed by GitHub
parent 7dac269429
commit ae4692a845
7 changed files with 61 additions and 14 deletions

View File

@ -183,6 +183,7 @@ Example: A 1 KB message with 1024-dim embedding uses ~9 KB. The 5 MB default lim
},
knowledgeDetails: {
metadata: {
toMetadataSetting: 'Generation settings',
descriptionTip:
'Provide descriptions or examples to guide LLM extract values for this field. If left empty, it will rely on the field name.',
restrictTDefinedValuesTip:

View File

@ -128,7 +128,7 @@ export default {
delMessageWarn: `遗忘后,代理将无法检索此消息。`,
forgetMessage: '遗忘消息',
sessionId: '会话ID',
agent: '代理',
agent: '智能体',
type: '类型',
validDate: '有效日期',
forgetAt: '遗忘于',
@ -173,6 +173,7 @@ export default {
},
knowledgeDetails: {
metadata: {
toMetadataSetting: '生成设置',
descriptionTip:
'提供描述或示例来指导大语言模型为此字段提取值。如果留空,将依赖字段名称。',
restrictTDefinedValuesTip:

View File

@ -15,6 +15,7 @@ import {
TableRow,
} from '@/components/ui/table';
import { useSetModalState } from '@/hooks/common-hooks';
import { Routes } from '@/routes';
import {
ColumnDef,
flexRender,
@ -27,6 +28,7 @@ import {
import { Plus, Settings, Trash2 } from 'lucide-react';
import { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { useHandleMenuClick } from '../../sidebar/hooks';
import {
MetadataDeleteMap,
MetadataType,
@ -78,7 +80,7 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
addUpdateValue,
addDeleteValue,
} = useManageMetaDataModal(originalTableData, metadataType, otherData);
const { handleMenuClick } = useHandleMenuClick();
const {
visible: manageValuesVisible,
showModal: showManageValuesModal,
@ -338,10 +340,23 @@ export const ManageMetadataModal = (props: IManageModalProps) => {
<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 />

View File

@ -25,12 +25,13 @@ import { useComposeLlmOptionsByModelTypes } from '@/hooks/use-llm-request';
import { cn } from '@/lib/utils';
import { t } from 'i18next';
import { Settings } from 'lucide-react';
import { useMemo, useState } from 'react';
import { useEffect, useMemo, useState } from 'react';
import {
ControllerRenderProps,
FieldValues,
useFormContext,
} from 'react-hook-form';
import { useLocation } from 'umi';
import {
MetadataType,
useManageMetadata,
@ -368,6 +369,7 @@ export function AutoMetadata({
otherData?: Record<string, any>;
}) {
// get metadata field
const location = useLocation();
const form = useFormContext();
const {
manageMetadataVisible,
@ -377,6 +379,16 @@ export function AutoMetadata({
config: metadataConfig,
} = useManageMetadata();
useEffect(() => {
const locationState = location.state as
| { openMetadata?: boolean }
| undefined;
if (locationState?.openMetadata) {
showManageMetadataModal();
locationState.openMetadata = false;
}
}, [location, showManageMetadataModal]);
const autoMetadataField: FormFieldConfig = {
name: 'parser_config.enable_metadata',
label: t('knowledgeConfiguration.autoMetadata'),

View File

@ -7,8 +7,8 @@ export const useHandleMenuClick = () => {
const { id } = useParams();
const handleMenuClick = useCallback(
(key: Routes) => () => {
navigate(`${Routes.DatasetBase}${key}/${id}`);
(key: Routes, data?: any) => () => {
navigate(`${Routes.DatasetBase}${key}/${id}`, { state: data });
},
[id, navigate],
);

View File

@ -18,6 +18,7 @@ import {
} from '@/components/ui/table';
import { Pagination } from '@/interfaces/common';
import { replaceText } from '@/pages/dataset/process-log-modal';
import { MemoryOptions } from '@/pages/memories/constants';
import {
ColumnDef,
ColumnFiltersState,
@ -99,7 +100,12 @@ export function MemoryTable({
header: () => <span>{t('memory.messages.type')}</span>,
cell: ({ row }) => (
<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>
),
},
@ -117,13 +123,13 @@ export function MemoryTable({
<div className="text-sm ">{row.getValue('forget_at')}</div>
),
},
{
accessorKey: 'source_id',
header: () => <span>{t('memory.messages.source')}</span>,
cell: ({ row }) => (
<div className="text-sm ">{row.getValue('source_id')}</div>
),
},
// {
// accessorKey: 'source_id',
// header: () => <span>{t('memory.messages.source')}</span>,
// cell: ({ row }) => (
// <div className="text-sm ">{row.getValue('source_id')}</div>
// ),
// },
{
accessorKey: 'status',
header: () => <span>{t('memory.messages.enable')}</span>,

View File

@ -127,9 +127,21 @@ const SourceDetailPage = () => {
}, []);
useEffect(() => {
const baseFields = DataSourceFormBaseFields.map((field) => {
if (field.name === 'name') {
return {
...field,
disabled: true,
};
} else {
return {
...field,
};
}
});
if (detail) {
const fields = [
...DataSourceFormBaseFields,
...baseFields,
...DataSourceFormFields[
detail.source as keyof typeof DataSourceFormFields
],