mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-22 07:01:07 +03:00
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:
@@ -1081,7 +1081,7 @@ class Agent_Agentflow implements INode {
|
||||
if (newState && Object.keys(newState).length > 0) {
|
||||
for (const key in newState) {
|
||||
if (newState[key].toString().includes('{{ output }}')) {
|
||||
newState[key] = finalResponse
|
||||
newState[key] = newState[key].replaceAll('{{ output }}', finalResponse)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ class CustomFunction_Agentflow implements INode {
|
||||
if (newState && Object.keys(newState).length > 0) {
|
||||
for (const key in newState) {
|
||||
if (newState[key].toString().includes('{{ output }}')) {
|
||||
newState[key] = finalOutput
|
||||
newState[key] = newState[key].replaceAll('{{ output }}', finalOutput)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -225,7 +225,7 @@ class ExecuteFlow_Agentflow implements INode {
|
||||
if (newState && Object.keys(newState).length > 0) {
|
||||
for (const key in newState) {
|
||||
if (newState[key].toString().includes('{{ output }}')) {
|
||||
newState[key] = resultText
|
||||
newState[key] = newState[key].replaceAll('{{ output }}', resultText)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ class Retriever_Agentflow implements INode {
|
||||
if (newState && Object.keys(newState).length > 0) {
|
||||
for (const key in newState) {
|
||||
if (newState[key].toString().includes('{{ output }}')) {
|
||||
newState[key] = finalOutput
|
||||
newState[key] = newState[key].replaceAll('{{ output }}', finalOutput)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user