fix(web): update add node
This commit is contained in:
@@ -235,7 +235,7 @@ export const useWorkflowGraph = ({
|
||||
if (parentNode) {
|
||||
const addedChild = graphRef.current?.addNode(childNode)
|
||||
if (addedChild) {
|
||||
parentNode.addChild(addedChild)
|
||||
parentNode.insertChild(addedChild)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -275,6 +275,11 @@ export const useWorkflowGraph = ({
|
||||
}, 100)
|
||||
}
|
||||
if (edges.length) {
|
||||
// 计算loop和iteration类型节点的数量
|
||||
const loopIterationCount = nodes.filter(node =>
|
||||
node.type === 'loop' || node.type === 'iteration'
|
||||
).length;
|
||||
|
||||
// 去重处理:对于if-else和question-classifier节点,不同连接桩允许连接到相同节点
|
||||
const uniqueEdges = edges.filter((edge, index, arr) => {
|
||||
return arr.findIndex(e => {
|
||||
@@ -349,7 +354,7 @@ export const useWorkflowGraph = ({
|
||||
},
|
||||
},
|
||||
},
|
||||
zIndex: targetCell.getData()?.cycle ? 3 : 0
|
||||
zIndex: loopIterationCount
|
||||
}
|
||||
|
||||
return edgeConfig
|
||||
@@ -725,7 +730,6 @@ export const useWorkflowGraph = ({
|
||||
},
|
||||
},
|
||||
},
|
||||
zIndex: 0,
|
||||
});
|
||||
},
|
||||
validateConnection({ sourceCell, targetCell, targetMagnet }) {
|
||||
@@ -762,9 +766,8 @@ export const useWorkflowGraph = ({
|
||||
},
|
||||
embedding: {
|
||||
enabled: true,
|
||||
validate (this, { parent }) {
|
||||
const parentData = parent.getData()
|
||||
return parentData.type === 'iteration' || parentData.type === 'loop'
|
||||
validate (this) {
|
||||
return false
|
||||
}
|
||||
},
|
||||
translating: {
|
||||
|
||||
Reference in New Issue
Block a user