mirror of https://github.com/langgenius/dify.git
memory
This commit is contained in:
parent
b0dd7d303d
commit
77b7bf9d47
|
|
@ -57,10 +57,16 @@ const MemorySystem = ({
|
|||
triggerClassName='w-4 h-4'
|
||||
/>
|
||||
{collapseIcon}
|
||||
<Divider type='vertical' className='!ml-1.5 !mr-1 h-3 !w-px bg-divider-regular' />
|
||||
<div onClick={e => e.stopPropagation()}>
|
||||
<MemoryCreateButton />
|
||||
</div>
|
||||
{
|
||||
memoryType === 'block' && (
|
||||
<>
|
||||
<Divider type='vertical' className='!ml-1.5 !mr-1 h-3 !w-px bg-divider-regular' />
|
||||
<div onClick={e => e.stopPropagation()}>
|
||||
<MemoryCreateButton />
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
</div>
|
||||
<MemorySelector
|
||||
value={memoryType}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,18 @@
|
|||
import { useTranslation } from 'react-i18next'
|
||||
import { FormTypeEnum } 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'
|
||||
|
||||
export const useMemorySchema = () => {
|
||||
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: [
|
||||
|
|
|
|||
|
|
@ -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 ',
|
||||
|
|
|
|||
|
|
@ -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: '更新时间 ',
|
||||
|
|
|
|||
Loading…
Reference in New Issue