feat:修复执行过程编排中初始分支删除单个节点bug
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user