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

This commit is contained in:
sino 2024-05-20 08:13:37 +08:00 committed by GitHub
parent 46bd53a929
commit 5440108431
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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