From d36e3c97d1ade0a5a1f140d027253b4fff59b505 Mon Sep 17 00:00:00 2001 From: balibabu Date: Tue, 10 Mar 2026 22:18:27 +0800 Subject: [PATCH] Feat: Add a user_id field to the message and retrieval operators. (#13508) ### What problem does this PR solve? Feat: Add a user_id field to the message and retrieval operators. ### Type of change - [x] New Feature (non-breaking change which adds functionality) --- web/src/locales/en.ts | 1 + web/src/locales/zh.ts | 1 + .../agent/form/components/user-id-form-field.tsx | 13 +++++++++++++ web/src/pages/agent/form/message-form/index.tsx | 3 +++ web/src/pages/agent/form/retrieval-form/next.tsx | 7 ++++++- 5 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 web/src/pages/agent/form/components/user-id-form-field.tsx diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index f561c41bfe..debbcf593c 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -1839,6 +1839,7 @@ Example: Virtual Hosted Style`, dbType: 'Database type', database: 'Database', username: 'Username', + userId: 'User id', host: 'Host', port: 'Port', password: 'Password', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index b020ff02a1..7efa7f261e 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -1599,6 +1599,7 @@ General:实体和关系提取提示来自 GitHub - microsoft/graphrag:基于 dbType: '数据库类型', database: '数据库', username: '用户名', + userId: '用户 ID', host: '主机', port: '端口', password: '密码', diff --git a/web/src/pages/agent/form/components/user-id-form-field.tsx b/web/src/pages/agent/form/components/user-id-form-field.tsx new file mode 100644 index 0000000000..422545cd35 --- /dev/null +++ b/web/src/pages/agent/form/components/user-id-form-field.tsx @@ -0,0 +1,13 @@ +import { RAGFlowFormItem } from '@/components/ragflow-form'; +import { useTranslation } from 'react-i18next'; +import { PromptEditor } from './prompt-editor'; + +export function UserIdFormField() { + const { t } = useTranslation(); + + return ( + + + + ); +} diff --git a/web/src/pages/agent/form/message-form/index.tsx b/web/src/pages/agent/form/message-form/index.tsx index 87071e5780..ddc8a09ca7 100644 --- a/web/src/pages/agent/form/message-form/index.tsx +++ b/web/src/pages/agent/form/message-form/index.tsx @@ -21,6 +21,7 @@ import { ExportFileType } from '../../constant'; import { INextOperatorForm } from '../../interface'; import { FormWrapper } from '../components/form-wrapper'; import { PromptEditor } from '../components/prompt-editor'; +import { UserIdFormField } from '../components/user-id-form-field'; import { useShowWebhookResponseStatus } from './use-show-response-status'; import { useValues } from './use-values'; import { useWatchFormChange } from './use-watch-change'; @@ -42,6 +43,7 @@ function MessageForm({ node }: INextOperatorForm) { auto_play: z.boolean().optional(), status: z.number().optional(), memory_ids: z.array(z.string()).optional(), + user_id: z.string().optional(), }); const form = useForm({ @@ -163,6 +165,7 @@ function MessageForm({ node }: INextOperatorForm) { )} + ); diff --git a/web/src/pages/agent/form/retrieval-form/next.tsx b/web/src/pages/agent/form/retrieval-form/next.tsx index 4776e3af8f..0e155076ef 100644 --- a/web/src/pages/agent/form/retrieval-form/next.tsx +++ b/web/src/pages/agent/form/retrieval-form/next.tsx @@ -38,6 +38,7 @@ import { INextOperatorForm } from '../../interface'; import { FormWrapper } from '../components/form-wrapper'; import { Output } from '../components/output'; import { PromptEditor } from '../components/prompt-editor'; +import { UserIdFormField } from '../components/user-id-form-field'; import { useValues } from './use-values'; export const RetrievalPartialSchema = { @@ -54,6 +55,7 @@ export const RetrievalPartialSchema = { ...MetadataFilterSchema, memory_ids: z.array(z.string()).optional(), retrieval_from: z.string(), + user_id: z.string().optional(), }; export const FormSchema = z.object({ @@ -82,7 +84,10 @@ export function MemoryDatasetForm() { {retrievalFrom === RetrievalFrom.Memory ? ( - + <> + + + ) : ( )}