| 17 | } |
| 18 | |
| 19 | export const getUniqueNodeLabel = (nodeData, nodes) => { |
| 20 | if (nodeData.type === 'StickyNote') return nodeData.label |
| 21 | if (nodeData.name === 'startAgentflow') return nodeData.label |
| 22 | |
| 23 | let suffix = 0 |
| 24 | |
| 25 | // Construct base ID |
| 26 | let baseId = `${nodeData.name}_${suffix}` |
| 27 | |
| 28 | // Increment suffix until a unique ID is found |
| 29 | while (nodes.some((node) => node.id === baseId)) { |
| 30 | suffix += 1 |
| 31 | baseId = `${nodeData.name}_${suffix}` |
| 32 | } |
| 33 | |
| 34 | return `${nodeData.label} ${suffix}` |
| 35 | } |
| 36 | |
| 37 | const createAgentFlowOutputs = (nodeData, newNodeId) => { |
| 38 | if (nodeData.hideOutput) return [] |