feat:修复执行过程编排中初始分支删除单个节点bug

This commit is contained in:
liailing1026
2026-03-16 14:37:14 +08:00
parent f411dc0e20
commit a4b94f43c1
3 changed files with 354 additions and 22 deletions

View File

@@ -300,9 +300,18 @@ export const useSelectionStore = defineStore('selection', () => {
const nodeIndex = branch.nodes.findIndex((n: any) => n.id === nodeId)
if (nodeIndex === -1) return false
// 精准删除:只删除对应索引的节点和任务
// 获取被删除节点的信息
const deletedNode = branch.nodes[nodeIndex]
const originalIndex = deletedNode?.data?.originalIndex
// 精准删除:删除 nodes 中的节点
branch.nodes.splice(nodeIndex, 1)
branch.tasks.splice(nodeIndex, 1)
// 精准删除 tasks使用 originalIndex 直接定位
// nodes 包含 root 节点,所以 agent 节点的 originalIndex 对应 tasks 的索引
if (originalIndex !== undefined && originalIndex < branch.tasks.length) {
branch.tasks.splice(originalIndex, 1)
}
// 更新 edges移除相关边添加新边
if (incomingEdges.length > 0 || outgoingEdges.length > 0) {