Skip to content

Commit 126808b

Browse files
authored
Fix 'label' undefined errors for sequential agents (#3585)
Fix 'label' undefined errors Commit adds some optional chaining around 2 reads of 'label' property.
1 parent c50c7bd commit 126808b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

packages/server/src/utils/buildAgentGraph.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ export const buildAgentGraph = async (
325325
// Send loading next agent indicator
326326
if (reasoning.next && reasoning.next !== 'FINISH' && reasoning.next !== 'END') {
327327
if (sseStreamer) {
328-
sseStreamer.streamNextAgentEvent(chatId, mapNameToLabel[reasoning.next].label || reasoning.next)
328+
sseStreamer.streamNextAgentEvent(chatId, mapNameToLabel[reasoning.next]?.label || reasoning.next)
329329
}
330330
}
331331
}

packages/server/src/utils/buildChatflow.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals
218218

219219
/*** Get session ID ***/
220220
const memoryNode = findMemoryNode(nodes, edges)
221-
const memoryType = memoryNode?.data.label
221+
const memoryType = memoryNode?.data?.label
222222
let sessionId = getMemorySessionId(memoryNode, incomingInput, chatId, isInternal)
223223

224224
/*** Get Ending Node with Directed Graph ***/

0 commit comments

Comments
 (0)