MCPcopy Create free account
hub / github.com/FlowiseAI/Flowise / collectParentNodes

Function collectParentNodes

packages/ui/src/utils/genericHelper.js:647–666  ·  view source on GitHub ↗
(targetNodeId, nodes, edges)

Source from the content-addressed store, hash-verified

645 const isSeqAgent = nodes.find((nd) => nd.id === target)?.data?.category === 'Sequential Agents'
646
647 function collectParentNodes(targetNodeId, nodes, edges) {
648 const inputEdges = edges.filter(
649 (edg) => edg.target === targetNodeId && edg.targetHandle.includes(`${targetNodeId}-input-sequentialNode`)
650 )
651
652 // Traverse each edge found
653 inputEdges.forEach((edge) => {
654 const parentNode = nodes.find((nd) => nd.id === edge.source)
655 if (!parentNode) return
656
657 // Recursive call to explore further up the tree
658 collectParentNodes(parentNode.id, nodes, edges)
659
660 // Check and add the parent node to the list if it does not include specific names
661 const excludeNodeNames = ['seqAgent', 'seqLLMNode', 'seqToolNode', 'seqCustomFunction', 'seqExecuteFlow']
662 if (excludeNodeNames.includes(parentNode.data.name)) {
663 parentNodes.push(parentNode)
664 }
665 })
666 }
667 function collectAgentFlowV2ParentNodes(targetNodeId, nodes, edges) {
668 const inputEdges = edges.filter((edg) => edg.target === targetNodeId && edg.targetHandle === targetNodeId)
669

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected