From 54401084319aa4dc3e4885f6b6ca9430756e23c3 Mon Sep 17 00:00:00 2001 From: sino Date: Mon, 20 May 2024 08:13:37 +0800 Subject: [PATCH] fix: read llm node's first prompt role by optional chaining (#4510) --- .../components/workflow/nodes/llm/components/config-prompt.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx index 308fd95bab..5bea2005b2 100644 --- a/web/app/components/workflow/nodes/llm/components/config-prompt.tsx +++ b/web/app/components/workflow/nodes/llm/components/config-prompt.tsx @@ -146,7 +146,7 @@ const ConfigPrompt: FC = ({ { - if ((payload as PromptItem[])?.[0].role === PromptRole.system && list[0].p?.role !== PromptRole.system) + if ((payload as PromptItem[])?.[0]?.role === PromptRole.system && list[0].p?.role !== PromptRole.system) return onChange(list.map(item => item.p))