Skip to content

Commit

Permalink
Fix 'label' undefined errors for sequential agents (#3585)
Browse files Browse the repository at this point in the history
Fix 'label' undefined errors

Commit adds some optional chaining around 2 reads of 'label'
property.
  • Loading branch information
px-amaac authored Nov 27, 2024
1 parent c50c7bd commit 126808b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/server/src/utils/buildAgentGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/server/src/utils/buildChatflow.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 ***/
Expand Down

0 comments on commit 126808b

Please sign in to comment.