feat(core): Improve nodeNameToToolName special characters normalization (#15126)

This commit is contained in:
oleg
2025-05-06 09:31:43 +02:00
committed by GitHub
parent 5b1aa062a7
commit 07e6c7e13f
3 changed files with 66 additions and 4 deletions

View File

@@ -251,6 +251,10 @@ export function unwrapNestedOutput(output: Record<string, unknown>): Record<stri
return output;
}
/**
* Converts a node name to a valid tool name by replacing special characters with underscores
* and collapsing consecutive underscores into a single one.
*/
export function nodeNameToToolName(node: INode): string {
return node.name.replace(/ /g, '_');
return node.name.replace(/[\s.?!=+#@&*()[\]{}:;,<>\/\\'"^%$]/g, '_').replace(/_+/g, '_');
}