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

pull/4517/head
sino 2 years ago committed by GitHub
parent 46bd53a929
commit 5440108431
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -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))

Loading…
Cancel
Save