mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-10 07:19:01 +08: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)
|
console.log(list)
|
||||||
|
|
||||||
const result: NodeTracing[] = [...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.
|
// 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) => {
|
result.forEach((node) => {
|
||||||
const parallel_id = node.parallel_id ?? node.execution_metadata?.parallel_id ?? null
|
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,
|
isParallelStartNode: true,
|
||||||
children: [selfNode],
|
children: [selfNode],
|
||||||
}
|
}
|
||||||
parallelFirstNodeMap[parallel_id] = node.node_id
|
|
||||||
const isRootLevel = !parent_parallel_id
|
const isRootLevel = !parent_parallel_id
|
||||||
if (isRootLevel)
|
if (isRootLevel)
|
||||||
return
|
return
|
||||||
@ -121,7 +119,7 @@ const format = (list: NodeTracing[], t: any, isPrint?: boolean): NodeTracing[] =
|
|||||||
}
|
}
|
||||||
|
|
||||||
// append to parallel start node and after the same branch
|
// 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) {
|
if (parallelStartNode && parallelStartNode.parallelDetail && parallelStartNode!.parallelDetail!.children) {
|
||||||
const sameBranchNodesLastIndex = parallelStartNode.parallelDetail.children.findLastIndex((node) => {
|
const sameBranchNodesLastIndex = parallelStartNode.parallelDetail.children.findLastIndex((node) => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user