feat: implement isConditionBranchEdge function and update deleteConditionBranch logic; add tests for condition branch line matching

This commit is contained in:
mlogclub
2026-06-30 12:36:17 +08:00
parent 79f0c06790
commit d7782ba6c8
3 changed files with 37 additions and 1 deletions
@@ -297,10 +297,18 @@ export function deleteConditionBranch(
})
return {
...nextDefinition,
edges: nextDefinition.edges.filter((edge) => !(edge.sourceNodeID === nodeId && edge.sourcePortID === branchId)),
edges: nextDefinition.edges.filter((edge) => !isConditionBranchEdge(edge, nodeId, branchId)),
}
}
export function isConditionBranchEdge(
edge: { sourceNodeID?: unknown; sourcePortID?: unknown },
nodeId: string,
branchId: string
): boolean {
return String(edge.sourceNodeID ?? "") === nodeId && String(edge.sourcePortID ?? "") === branchId
}
export function normalizeConditionPortsForFlowgram(
definition: AIWorkflowDefinition
): AIWorkflowDefinition {