feat: memory example

This commit is contained in:
Joel
2024-03-25 16:36:33 +08:00
parent 28206cac72
commit b3db119146
3 changed files with 32 additions and 5 deletions

View File

@@ -18,6 +18,8 @@ import { InputVarType, type NodePanelProps } from '@/app/components/workflow/typ
import BeforeRunForm from '@/app/components/workflow/nodes/_base/components/before-run-form'
import type { Props as FormProps } from '@/app/components/workflow/nodes/_base/components/before-run-form/form'
import ResultPanel from '@/app/components/workflow/run/result-panel'
import TooltipPlus from '@/app/components/base/tooltip-plus'
import { HelpCircle } from '@/app/components/base/icons/src/vender/line/general'
const i18nPrefix = 'workflow.nodes.llm'
@@ -178,13 +180,28 @@ const Panel: FC<NodePanelProps<LLMNodeType>> = ({
/>
)}
{/* Memory put place examples. Wait for design */}
{/* {isChatModel && (
<div className='text-xs text-gray-300'>Memory examples(Designing)</div>
)} */}
{/* Memory put place examples. */}
{isChatMode && isChatModel && !!inputs.memory && (
<div className='mt-4'>
<div className='flex justify-between items-center h-8 pl-3 pr-2 rounded-lg bg-gray-100'>
<div className='flex items-center space-x-1'>
<div className='text-xs font-semibold text-gray-700 uppercase'>{t('workflow.nodes.common.memories.title')}</div>
<TooltipPlus
popupContent={t('workflow.nodes.common.memories.tip')}
>
<HelpCircle className='w-3.5 h-3.5 text-gray-400' />
</TooltipPlus>
</div>
<div className='h-[18px] leading-[18px] px-1 rounded-[5px] border border-black/8 text-xs font-semibold text-gray-500 uppercase'>{t('workflow.nodes.common.memories.builtIn')}</div>
</div>
{/* TODO: user query editor */}
</div>
)}
{/* Memory */}
{isChatMode && (
{isChatMode && isChatModel && (
<>
<Split />
<MemoryConfig
readonly={readOnly}
config={{ data: inputs.memory }}

View File

@@ -124,6 +124,11 @@ const translation = {
user: 'User prefix',
assistant: 'Assistant prefix',
},
memories: {
title: 'Memories',
tip: 'Chat memory',
builtIn: 'Built-in',
},
},
start: {
required: 'required',

View File

@@ -124,6 +124,11 @@ const translation = {
user: '用户前缀',
assistant: '助手前缀',
},
memories: {
title: '记忆',
tip: '聊天记忆',
builtIn: '内置',
},
},
start: {
required: '必填',