This commit is contained in:
zxhlyh 2025-09-22 18:00:05 +08:00
parent b0dd7d303d
commit 77b7bf9d47
4 changed files with 55 additions and 18 deletions

View File

@ -57,10 +57,16 @@ const MemorySystem = ({
triggerClassName='w-4 h-4' triggerClassName='w-4 h-4'
/> />
{collapseIcon} {collapseIcon}
<Divider type='vertical' className='!ml-1.5 !mr-1 h-3 !w-px bg-divider-regular' /> {
<div onClick={e => e.stopPropagation()}> memoryType === 'block' && (
<MemoryCreateButton /> <>
</div> <Divider type='vertical' className='!ml-1.5 !mr-1 h-3 !w-px bg-divider-regular' />
<div onClick={e => e.stopPropagation()}>
<MemoryCreateButton />
</div>
</>
)
}
</div> </div>
<MemorySelector <MemorySelector
value={memoryType} value={memoryType}

View File

@ -1,15 +1,18 @@
import { useTranslation } from 'react-i18next'
import { FormTypeEnum } from '@/app/components/base/form/types' import { FormTypeEnum } from '@/app/components/base/form/types'
import type { FormSchema } from '@/app/components/base/form/types' import type { FormSchema } from '@/app/components/base/form/types'
import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type' import { ChatVarType } from '@/app/components/workflow/panel/chat-variable-panel/type'
export const useMemorySchema = () => { export const useMemorySchema = () => {
const { t } = useTranslation()
return [ return [
{ {
name: 'template', name: 'template',
label: 'Memory Template', label: t('workflow.chatVariable.modal.memoryTemplate'),
type: FormTypeEnum.promptInput, type: FormTypeEnum.promptInput,
tooltip: 'template', tooltip: 'template',
placeholder: 'Enter template for AI memory (e.g., user profile, preferences, context)...', placeholder: t('workflow.chatVariable.modal.memoryTemplatePlaceholder'),
show_on: [ show_on: [
{ {
variable: 'value_type', variable: 'value_type',
@ -22,7 +25,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'instruction', name: 'instruction',
label: 'Update Instructions', label: t('workflow.chatVariable.modal.updateInstructions'),
type: FormTypeEnum.promptInput, type: FormTypeEnum.promptInput,
show_on: [ show_on: [
{ {
@ -32,23 +35,23 @@ export const useMemorySchema = () => {
], ],
selfFormProps: { selfFormProps: {
enablePromptGenerator: true, enablePromptGenerator: true,
placeholder: 'How should the AI update this memory...', placeholder: t('workflow.chatVariable.modal.updateInstructionsPlaceholder'),
}, },
}, },
{ {
name: 'strategy', name: 'strategy',
label: 'Update trigger', label: t('workflow.chatVariable.modal.updateTrigger'),
type: FormTypeEnum.radio, type: FormTypeEnum.radio,
default: 'on_turns', default: 'on_turns',
fieldClassName: 'flex justify-between', fieldClassName: 'flex justify-between',
inputClassName: 'w-[102px]', inputClassName: 'w-[102px]',
options: [ options: [
{ {
label: 'Every N turns', label: t('workflow.chatVariable.modal.everyNTurns'),
value: 'on_turns', value: 'on_turns',
}, },
{ {
label: 'Auto', label: t('workflow.chatVariable.modal.auto'),
value: 'on_auto', value: 'on_auto',
}, },
], ],
@ -64,7 +67,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'update_turns', name: 'update_turns',
label: 'Update every', label: t('workflow.chatVariable.modal.updateEvery'),
type: FormTypeEnum.textNumber, type: FormTypeEnum.textNumber,
fieldClassName: 'flex justify-between', fieldClassName: 'flex justify-between',
show_on: [ show_on: [
@ -88,7 +91,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'scope', name: 'scope',
label: 'Scope', label: t('workflow.chatVariable.modal.scope'),
type: FormTypeEnum.radio, type: FormTypeEnum.radio,
default: 'app', default: 'app',
fieldClassName: 'flex justify-between', fieldClassName: 'flex justify-between',
@ -132,7 +135,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'term', name: 'term',
label: 'Term', label: t('workflow.chatVariable.modal.term'),
type: FormTypeEnum.radio, type: FormTypeEnum.radio,
default: 'session', default: 'session',
fieldClassName: 'flex justify-between', fieldClassName: 'flex justify-between',
@ -159,7 +162,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'more', name: 'more',
label: 'MoreSettings', label: t('workflow.chatVariable.modal.moreSettings'),
type: FormTypeEnum.collapse, type: FormTypeEnum.collapse,
show_on: [ show_on: [
{ {
@ -170,7 +173,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'model', name: 'model',
label: 'Memory model', label: t('workflow.chatVariable.modal.memoryModel'),
type: FormTypeEnum.modelSelector, type: FormTypeEnum.modelSelector,
show_on: [ show_on: [
{ {
@ -185,7 +188,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'schedule_mode', name: 'schedule_mode',
label: 'Update method', label: t('workflow.chatVariable.modal.updateMethod'),
type: FormTypeEnum.radio, type: FormTypeEnum.radio,
options: [ options: [
{ {
@ -210,7 +213,7 @@ export const useMemorySchema = () => {
}, },
{ {
name: 'end_user_editable', name: 'end_user_editable',
label: 'Editable in web app', label: t('workflow.chatVariable.modal.editableInWebApp'),
type: FormTypeEnum.switch, type: FormTypeEnum.switch,
fieldClassName: 'flex justify-between', fieldClassName: 'flex justify-between',
show_on: [ show_on: [

View File

@ -167,6 +167,20 @@ const translation = {
objectKey: 'Key', objectKey: 'Key',
objectType: 'Type', objectType: 'Type',
objectValue: 'Default Value', 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', storedContent: 'Stored content',
updatedAt: 'Updated at ', updatedAt: 'Updated at ',

View File

@ -167,6 +167,20 @@ const translation = {
objectKey: '属性', objectKey: '属性',
objectType: '类型', objectType: '类型',
objectValue: '默认值', objectValue: '默认值',
memoryTemplate: '记忆模板',
memoryTemplatePlaceholder: '输入记忆模板(例如:用户偏好、对话历史等)',
updateInstructions: '更新指令',
updateInstructionsPlaceholder: 'AI 应该如何更新此记忆...',
updateTrigger: '更新触发',
everyNTurns: '每 N 轮',
auto: '自动',
updateEvery: '更新频次',
scope: '范围',
term: '期限',
moreSettings: '更多设置',
memoryModel: '记忆模型',
updateMethod: '更新方法',
editableInWebApp: '在 Web 应用中可编辑',
}, },
storedContent: '存储内容', storedContent: '存储内容',
updatedAt: '更新时间 ', updatedAt: '更新时间 ',