소스 검색

fix: read llm node's first prompt role by optional chaining (#4510)

sino 11 달 전
부모
커밋
5440108431
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      web/app/components/workflow/nodes/llm/components/config-prompt.tsx

+ 1 - 1
web/app/components/workflow/nodes/llm/components/config-prompt.tsx

@@ -146,7 +146,7 @@ const ConfigPrompt: FC<Props> = ({
               <ReactSortable className="space-y-1"
                 list={payloadWithIds}
                 setList={(list) => {
-                  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))