mirror of
				https://github.com/langgenius/dify.git
				synced 2025-11-03 20:33:00 +00:00 
			
		
		
		
	fix: parallel id caused append to wrong branch (#17794)
This commit is contained in:
		
							parent
							
								
									605ab9e46c
								
							
						
					
					
						commit
						f8145480fc
					
				@ -74,7 +74,6 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
 | 
			
		||||
    console.log(list)
 | 
			
		||||
 | 
			
		||||
  const result: NodeTracing[] = [...list]
 | 
			
		||||
  const parallelFirstNodeMap: Record<string, string> = {}
 | 
			
		||||
  // list to tree by parent_parallel_start_node_id and branch by parallel_start_node_id. Each parallel may has more than one branch.
 | 
			
		||||
  result.forEach((node) => {
 | 
			
		||||
    const parallel_id = node.parallel_id ?? node.execution_metadata?.parallel_id ?? null
 | 
			
		||||
@ -93,7 +92,6 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
 | 
			
		||||
        isParallelStartNode: true,
 | 
			
		||||
        children: [selfNode],
 | 
			
		||||
      }
 | 
			
		||||
      parallelFirstNodeMap[parallel_id] = node.node_id
 | 
			
		||||
      const isRootLevel = !parent_parallel_id
 | 
			
		||||
      if (isRootLevel)
 | 
			
		||||
        return
 | 
			
		||||
@ -121,7 +119,7 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // append to parallel start node and after the same branch
 | 
			
		||||
    const parallelStartNode = result.find(item => item.node_id === parallelFirstNodeMap[parallel_id])
 | 
			
		||||
    const parallelStartNode = result.find(item => parallel_start_node_id === item.node_id)
 | 
			
		||||
 | 
			
		||||
    if (parallelStartNode && parallelStartNode.parallelDetail && parallelStartNode!.parallelDetail!.children) {
 | 
			
		||||
      const sameBranchNodesLastIndex = parallelStartNode.parallelDetail.children.findLastIndex((node) => {
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user