diff --git a/web/app/(commonLayout)/workflow/nodes/page.tsx b/web/app/(commonLayout)/workflow/nodes/page.tsx index 96c25f3fdf..c035a0040b 100644 --- a/web/app/(commonLayout)/workflow/nodes/page.tsx +++ b/web/app/(commonLayout)/workflow/nodes/page.tsx @@ -6,8 +6,8 @@ import Workflow from '@/app/components/workflow' import { BlockEnum } from '@/app/components/workflow/types' const nodes = [ - BlockEnum.QuestionClassifier/* 5 */, BlockEnum.Tool/* 10 */, BlockEnum.VariableAssigner/* 11 */, BlockEnum.Start/* 1 */, BlockEnum.DirectAnswer/* 2 */, BlockEnum.LLM/* 3 */, BlockEnum.KnowledgeRetrieval/* 4 */, - BlockEnum.IfElse/* 6 */, BlockEnum.Code/* 7 */, BlockEnum.TemplateTransform/* 8 */, BlockEnum.HttpRequest/* 9 */, + BlockEnum.LLM/* 3 */, BlockEnum.VariableAssigner/* 11 */, BlockEnum.Start/* 1 */, BlockEnum.DirectAnswer/* 2 */, BlockEnum.KnowledgeRetrieval/* 4 */, BlockEnum.QuestionClassifier/* 5 */, + BlockEnum.IfElse/* 6 */, BlockEnum.Code/* 7 */, BlockEnum.TemplateTransform/* 8 */, BlockEnum.HttpRequest/* 9 */, BlockEnum.Tool/* 10 */, BlockEnum.End/* 12 */, ].map((item, i) => ({ id: `${i + 1}`, diff --git a/web/app/components/workflow/nodes/llm/panel.tsx b/web/app/components/workflow/nodes/llm/panel.tsx index 1d0250f343..fa70e61bd2 100644 --- a/web/app/components/workflow/nodes/llm/panel.tsx +++ b/web/app/components/workflow/nodes/llm/panel.tsx @@ -1,5 +1,6 @@ import type { FC } from 'react' import { useTranslation } from 'react-i18next' +import MemoryConfig from '../_base/components/memory-config' import useConfig from './use-config' import { mockData } from './mock' import VarList from '@/app/components/workflow/nodes/_base/components/variable/var-list' @@ -23,10 +24,11 @@ const Panel: FC = () => { handleVarListChange, handleAddVariable, toggleContextEnabled, + handleMemoryChange, } = useConfig(mockData) const model = inputs.model - // const modelMode = inputs.model?.mode - // const isChatMode = modelMode === 'chat' + const modelMode = inputs.model?.mode + const isChatMode = modelMode === 'chat' return (
@@ -77,12 +79,28 @@ const Panel: FC = () => { ) : null} + + {/* Prompt */} Prompt - + + {/* Memory */} + {isChatMode && ( + <> + + + + )} + + {/* Vision: GPT4-vision and so on */} { @@ -37,6 +38,13 @@ const useConfig = (initInputs: LLMNodeType) => { setInputs(newInputs) }, [inputs, setInputs]) + const handleMemoryChange = useCallback((newMemory: Memory) => { + const newInputs = produce(inputs, (draft) => { + draft.memory = newMemory + }) + setInputs(newInputs) + }, [inputs, setInputs]) + return { inputs, handleModelChanged, @@ -44,6 +52,7 @@ const useConfig = (initInputs: LLMNodeType) => { handleVarListChange, handleAddVariable, toggleContextEnabled, + handleMemoryChange, } }