solve the branch issue

This commit is contained in:
Yi 2024-08-30 17:58:29 +08:00
parent e3ae529a55
commit 2b5b856126

View File

@ -112,6 +112,7 @@ function buildLogTree(nodes: NodeTracing[]): TracingNodeProps[] {
}
}
const branchTitle = parallel_start_node_id === node.node_id ? getBranchTitle(parent_parallel_id, parallelStacks[parallel_id].children.length + 1) : ''
if (branchTitle) {
parallelStacks[parallel_id].children.push({
id: node.id,
isParallel: false,
@ -120,6 +121,19 @@ function buildLogTree(nodes: NodeTracing[]): TracingNodeProps[] {
branchTitle,
})
}
else {
const sameBranchIndex = parallelStacks[parallel_id].children.findLastIndex(c =>
c.data?.execution_metadata.parallel_start_node_id === node.execution_metadata.parallel_start_node_id,
)
parallelStacks[parallel_id].children.splice(sameBranchIndex + 1, 0, {
id: node.id,
isParallel: false,
data: node,
children: [],
branchTitle,
})
}
}
}
return rootNodes