Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: the new node name is generated based on the original node when duplicating (#4675)
非法操作b7f81f0999b7
diff --git a/web/app/components/workflow/hooks/use-nodes-interactions.ts b/web/app/components/workflow/hooks/use-nodes-interactions.tsindex edcfd468498..486a3267a6f 100644--- a/web/app/components/workflow/hooks/use-nodes-interactions.ts+++ b/web/app/components/workflow/hooks/use-nodes-interactions.ts@@ -33,6 +33,7 @@ import {Y_OFFSET,} from '../constants'import {+ genNewNodeTitleFromOld,generateNewNode,getNodesConnectedSourceOrTargetHandleIdsMap,getTopLeftNodePosition,@@ -1067,7 +1068,6 @@ export const useNodesInteractions = () => {const offsetY = currentPosition.y - yclipboardElements.forEach((nodeToPaste, index) => {const nodeType = nodeToPaste.data.type- const nodesWithSameType = nodes.filter(node => node.data.type === nodeType)const newNode = generateNewNode({data: {@@ -1077,7 +1077,7 @@ export const useNodesInteractions = () => {_isBundled: false,_connectedSourceHandleIds: [],_connectedTargetHandleIds: [],- title: nodesWithSameType.length > 0 ? `${t(`workflow.blocks.${nodeType}`)} ${nodesWithSameType.length + 1}` : t(`workflow.blocks.${nodeType}`),+ title: genNewNodeTitleFromOld(nodeToPaste.data.title),},position: {x: nodeToPaste.position.x + offsetX,diff --git a/web/app/components/workflow/utils.ts b/web/app/components/workflow/utils.tsindex 48d578c451d..723594ef350 100644--- a/web/app/components/workflow/utils.ts+++ b/web/app/components/workflow/utils.ts@@ -289,6 +289,20 @@ export const generateNewNode = ({ data, position, id, zIndex, ...rest }: Omit<No} as Node}+export const genNewNodeTitleFromOld = (oldTitle: string) => {+ const regex = /^(.+?)\s*\((\d+)\)\s*$/+ const match = oldTitle.match(regex)++ if (match) {+ const title = match[1]+ const num = parseInt(match[2], 10)+ return `${title} (${num + 1})`+ }+ else {+ return `${oldTitle} (1)`+ }+}+export const getValidTreeNodes = (nodes: Node[], edges: Edge[]) => {const startNode = nodes.find(node => node.data.type === BlockEnum.Start)