From 77b7bf9d4706db40bd5f0d0b2dc82e4e5ba8a935 Mon Sep 17 00:00:00 2001 From: zxhlyh Date: Mon, 22 Sep 2025 18:00:05 +0800 Subject: [PATCH] memory --- .../llm/components/memory-system/index.tsx | 14 ++++++--- .../hooks/use-form/use-memory-schema.ts | 31 ++++++++++--------- web/i18n/en-US/workflow.ts | 14 +++++++++ web/i18n/zh-Hans/workflow.ts | 14 +++++++++ 4 files changed, 55 insertions(+), 18 deletions(-) diff --git a/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx b/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx index 91ee802d08..fc163b393b 100644 --- a/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx +++ b/web/app/components/workflow/nodes/llm/components/memory-system/index.tsx @@ -57,10 +57,16 @@ const MemorySystem = ({ triggerClassName='w-4 h-4' /> {collapseIcon} - -
e.stopPropagation()}> - -
+ { + memoryType === 'block' && ( + <> + +
e.stopPropagation()}> + +
+ + ) + } { + const { t } = useTranslation() + return [ { name: 'template', - label: 'Memory Template', + label: t('workflow.chatVariable.modal.memoryTemplate'), type: FormTypeEnum.promptInput, tooltip: 'template', - placeholder: 'Enter template for AI memory (e.g., user profile, preferences, context)...', + placeholder: t('workflow.chatVariable.modal.memoryTemplatePlaceholder'), show_on: [ { variable: 'value_type', @@ -22,7 +25,7 @@ export const useMemorySchema = () => { }, { name: 'instruction', - label: 'Update Instructions', + label: t('workflow.chatVariable.modal.updateInstructions'), type: FormTypeEnum.promptInput, show_on: [ { @@ -32,23 +35,23 @@ export const useMemorySchema = () => { ], selfFormProps: { enablePromptGenerator: true, - placeholder: 'How should the AI update this memory...', + placeholder: t('workflow.chatVariable.modal.updateInstructionsPlaceholder'), }, }, { name: 'strategy', - label: 'Update trigger', + label: t('workflow.chatVariable.modal.updateTrigger'), type: FormTypeEnum.radio, default: 'on_turns', fieldClassName: 'flex justify-between', inputClassName: 'w-[102px]', options: [ { - label: 'Every N turns', + label: t('workflow.chatVariable.modal.everyNTurns'), value: 'on_turns', }, { - label: 'Auto', + label: t('workflow.chatVariable.modal.auto'), value: 'on_auto', }, ], @@ -64,7 +67,7 @@ export const useMemorySchema = () => { }, { name: 'update_turns', - label: 'Update every', + label: t('workflow.chatVariable.modal.updateEvery'), type: FormTypeEnum.textNumber, fieldClassName: 'flex justify-between', show_on: [ @@ -88,7 +91,7 @@ export const useMemorySchema = () => { }, { name: 'scope', - label: 'Scope', + label: t('workflow.chatVariable.modal.scope'), type: FormTypeEnum.radio, default: 'app', fieldClassName: 'flex justify-between', @@ -132,7 +135,7 @@ export const useMemorySchema = () => { }, { name: 'term', - label: 'Term', + label: t('workflow.chatVariable.modal.term'), type: FormTypeEnum.radio, default: 'session', fieldClassName: 'flex justify-between', @@ -159,7 +162,7 @@ export const useMemorySchema = () => { }, { name: 'more', - label: 'MoreSettings', + label: t('workflow.chatVariable.modal.moreSettings'), type: FormTypeEnum.collapse, show_on: [ { @@ -170,7 +173,7 @@ export const useMemorySchema = () => { }, { name: 'model', - label: 'Memory model', + label: t('workflow.chatVariable.modal.memoryModel'), type: FormTypeEnum.modelSelector, show_on: [ { @@ -185,7 +188,7 @@ export const useMemorySchema = () => { }, { name: 'schedule_mode', - label: 'Update method', + label: t('workflow.chatVariable.modal.updateMethod'), type: FormTypeEnum.radio, options: [ { @@ -210,7 +213,7 @@ export const useMemorySchema = () => { }, { name: 'end_user_editable', - label: 'Editable in web app', + label: t('workflow.chatVariable.modal.editableInWebApp'), type: FormTypeEnum.switch, fieldClassName: 'flex justify-between', show_on: [ diff --git a/web/i18n/en-US/workflow.ts b/web/i18n/en-US/workflow.ts index cd380ccd86..1b971b1777 100644 --- a/web/i18n/en-US/workflow.ts +++ b/web/i18n/en-US/workflow.ts @@ -167,6 +167,20 @@ const translation = { objectKey: 'Key', objectType: 'Type', objectValue: 'Default Value', + memoryTemplate: 'Memory Template', + memoryTemplatePlaceholder: 'Enter template for AI memory (e.g., user profile, preferences, context)...', + updateInstructions: 'Update Instructions', + updateInstructionsPlaceholder: 'How should the AI update this memory...', + updateTrigger: 'Update Trigger', + everyNTurns: 'Every N turns', + auto: 'Auto', + updateEvery: 'Update Every', + scope: 'Scope', + term: 'Term', + moreSettings: 'More Settings', + memoryModel: 'Memory Model', + updateMethod: 'Update Method', + editableInWebApp: 'Editable in Web App', }, storedContent: 'Stored content', updatedAt: 'Updated at ', diff --git a/web/i18n/zh-Hans/workflow.ts b/web/i18n/zh-Hans/workflow.ts index ab4feda65b..67280d74d5 100644 --- a/web/i18n/zh-Hans/workflow.ts +++ b/web/i18n/zh-Hans/workflow.ts @@ -167,6 +167,20 @@ const translation = { objectKey: '属性', objectType: '类型', objectValue: '默认值', + memoryTemplate: '记忆模板', + memoryTemplatePlaceholder: '输入记忆模板(例如:用户偏好、对话历史等)', + updateInstructions: '更新指令', + updateInstructionsPlaceholder: 'AI 应该如何更新此记忆...', + updateTrigger: '更新触发', + everyNTurns: '每 N 轮', + auto: '自动', + updateEvery: '更新频次', + scope: '范围', + term: '期限', + moreSettings: '更多设置', + memoryModel: '记忆模型', + updateMethod: '更新方法', + editableInWebApp: '在 Web 应用中可编辑', }, storedContent: '存储内容', updatedAt: '更新时间 ',