From cede695923a857dff4c0d2aa1a387bc7729a71ce Mon Sep 17 00:00:00 2001 From: zhujiruo Date: Tue, 10 Jun 2025 14:45:36 +0800 Subject: [PATCH] fix(web): optimize prompt change logic for LLM nodes (#20841) - Replace inputRef.current with inputs in the `handlePromptChange` function to ensure using the latest state - Ensure using the latest inputs without overwriting `_isSingleRun` to `true` --- web/app/components/workflow/nodes/llm/use-config.ts | 4 ++-- 1 file changed, 2 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 13db9e4031..cd2c552257 100644 --- a/web/app/components/workflow/nodes/llm/use-config.ts +++ b/web/app/components/workflow/nodes/llm/use-config.ts @@ -247,11 +247,11 @@ const useConfig = (id: string, payload: LLMNodeType) => { }, [inputs, setInputs]) const handlePromptChange = useCallback((newPrompt: PromptItem[] | PromptItem) => { - const newInputs = produce(inputRef.current, (draft) => { + const newInputs = produce(inputs, (draft) => { draft.prompt_template = newPrompt }) setInputs(newInputs) - }, [setInputs]) + }, [inputs, setInputs]) const handleMemoryChange = useCallback((newMemory?: Memory) => { const newInputs = produce(inputs, (draft) => {