From 55a6ade90e8de5758b29ff359f5a37fc3e562f81 Mon Sep 17 00:00:00 2001 From: Joel Date: Mon, 28 Apr 2025 17:44:18 +0800 Subject: [PATCH] feat: llm output changes remove var --- web/app/components/workflow/nodes/llm/use-config.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/web/app/components/workflow/nodes/llm/use-config.ts b/web/app/components/workflow/nodes/llm/use-config.ts index 89c43f1601..f6288b18d7 100644 --- a/web/app/components/workflow/nodes/llm/use-config.ts +++ b/web/app/components/workflow/nodes/llm/use-config.ts @@ -18,6 +18,7 @@ import { import useNodeCrud from '@/app/components/workflow/nodes/_base/hooks/use-node-crud' import { checkHasContextBlock, checkHasHistoryBlock, checkHasQueryBlock } from '@/app/components/base/prompt-editor/constants' import type { PanelProps } from '@/types/workflow' +import useInspectVarsCrud from '@/app/components/workflow/hooks/use-inspect-vars-crud' const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) => { const getVarInputs = panelProps?.getInputVars @@ -34,6 +35,8 @@ const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) => const { inputs, setInputs: doSetInputs } = useNodeCrud(id, payload) const inputRef = useRef(inputs) + const { deleteNodeInspectorVars } = useInspectVarsCrud() + const setInputs = useCallback((newInputs: LLMNodeType) => { if (newInputs.memory && !newInputs.memory.role_prefix) { const newPayload = produce(newInputs, (draft) => { @@ -298,14 +301,16 @@ const useConfig = (id: string, payload: LLMNodeType, panelProps?: PanelProps) => setInputs(newInputs) if (enabled) setStructuredOutputCollapsed(false) - }, [inputs, setInputs]) + deleteNodeInspectorVars(id) + }, [inputs, setInputs, deleteNodeInspectorVars, id]) const handleStructureOutputChange = useCallback((newOutput: StructuredOutput) => { const newInputs = produce(inputs, (draft) => { draft.structured_output = newOutput }) setInputs(newInputs) - }, [inputs, setInputs]) + deleteNodeInspectorVars(id) + }, [inputs, setInputs, deleteNodeInspectorVars, id]) const filterInputVar = useCallback((varPayload: Var) => { return [VarType.number, VarType.string, VarType.secret, VarType.arrayString, VarType.arrayNumber, VarType.file, VarType.arrayFile].includes(varPayload.type)