diff --git a/web/src/locales/en.ts b/web/src/locales/en.ts index dcede1913c..cd4ac840a7 100644 --- a/web/src/locales/en.ts +++ b/web/src/locales/en.ts @@ -1114,6 +1114,7 @@ This auto-tagging feature enhances retrieval by adding another layer of domain-s variableTip: `Used together with RAGFlow's chat assistant management APIs, variables can help develop more flexible system prompt strategies. The defined variables will be used by 'System prompt' as part of the prompts for the LLM. {knowledge} is a reserved special variable representing chunks retrieved from specified dataset(s), and all variables should be enclosed in curly braces {} in the 'System prompt'. See https://ragflow.io/docs/dev/set_chat_variables for details.`, add: 'Add', key: 'Key', + variableKeyMessage: 'Please input the variable key', optional: 'Optional', operation: 'Operation', model: 'Model', diff --git a/web/src/locales/zh.ts b/web/src/locales/zh.ts index 65f8380292..44816e32a0 100644 --- a/web/src/locales/zh.ts +++ b/web/src/locales/zh.ts @@ -1008,6 +1008,7 @@ NER:使用 spaCy NER 和基于规则的关键词提取来抽取实体和关系 “系统提示词”中的所有变量都必须用大括号{}括起来。详见 https://ragflow.io/docs/dev/set_chat_variables。`, add: '新增', key: '关键字', + variableKeyMessage: '请输入变量 key', optional: '可选的', operation: '操作', model: '模型', diff --git a/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx b/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx index 6ba276a88f..aab890e31d 100644 --- a/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx +++ b/web/src/pages/next-chats/chat/app-settings/dynamic-variable.tsx @@ -33,7 +33,7 @@ export function DynamicVariableForm({ const add = useCallback(() => { append({ - key: undefined, + key: '', optional: false, }); }, [append]); diff --git a/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx b/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx index 75181ec7da..5ceb3e4805 100644 --- a/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx +++ b/web/src/pages/next-chats/chat/app-settings/use-chat-setting-schema.tsx @@ -26,7 +26,7 @@ export function useChatSettingSchema() { parameters: z .array( z.object({ - key: z.string(), + key: z.string().min(1, { message: t('variableKeyMessage') }), optional: z.boolean(), }), )