Fixes state interpolation when using {{ output }} (#5039)

* Fixes the lossy-replace when a new state assignment contains the {{ output }} variable

* Replaces replace with replaceAll

---------

Co-authored-by: Corentin <corentin.hoareau@sogeti.com>
This commit is contained in:
corentin-hoareau
2025-08-08 16:08:59 +02:00
committed by GitHub
parent fa15b6873d
commit bbcfb5ab63
5 changed files with 5 additions and 5 deletions
@@ -334,7 +334,7 @@ class Tool_Agentflow implements INode {
if (newState && Object.keys(newState).length > 0) {
for (const key in newState) {
if (newState[key].toString().includes('{{ output }}')) {
newState[key] = toolOutput
newState[key] = newState[key].replaceAll('{{ output }}', toolOutput)
}
}
}