Fix 'label' undefined errors for sequential agents (#3585)

Fix 'label' undefined errors

Commit adds some optional chaining around 2 reads of 'label'
property.
This commit is contained in:
Aaron McIntyre
2024-11-27 15:27:49 -08:00
committed by GitHub
parent c50c7bdcce
commit 126808b62a
2 changed files with 2 additions and 2 deletions
+1 -1
View File
@@ -325,7 +325,7 @@ export const buildAgentGraph = async (
// Send loading next agent indicator
if (reasoning.next && reasoning.next !== 'FINISH' && reasoning.next !== 'END') {
if (sseStreamer) {
sseStreamer.streamNextAgentEvent(chatId, mapNameToLabel[reasoning.next].label || reasoning.next)
sseStreamer.streamNextAgentEvent(chatId, mapNameToLabel[reasoning.next]?.label || reasoning.next)
}
}
}
+1 -1
View File
@@ -218,7 +218,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
/*** Get session ID ***/
const memoryNode = findMemoryNode(nodes, edges)
const memoryType = memoryNode?.data.label
const memoryType = memoryNode?.data?.label
let sessionId = getMemorySessionId(memoryNode, incomingInput, chatId, isInternal)
/*** Get Ending Node with Directed Graph ***/