Bugfix/Human Input As First Node (#5202)
Updated logic to ensure that the last message is retrieved safely, preventing potential errors when the messages array is empty.for Human Input Node
This commit is contained in:
parent
4af067a444
commit
6e2f2df269
|
|
@ -208,7 +208,7 @@ class HumanInput_Agentflow implements INode {
|
|||
humanInputDescription = (nodeData.inputs?.humanInputDescription as string) || 'Do you want to proceed?'
|
||||
const messages = [...pastChatHistory, ...runtimeChatHistory]
|
||||
// Find the last message in the messages array
|
||||
const lastMessage = (messages[messages.length - 1] as any).content || ''
|
||||
const lastMessage = messages.length > 0 ? (messages[messages.length - 1] as any).content || '' : ''
|
||||
humanInputDescription = `${lastMessage}\n\n${humanInputDescription}`
|
||||
if (isStreamable) {
|
||||
const sseStreamer: IServerSideEventStreamer = options.sseStreamer as IServerSideEventStreamer
|
||||
|
|
|
|||
Loading…
Reference in New Issue