Merge pull request #1483 from FlowiseAI/bugfix/Pass-JSON-Variable-Value
Bugfix/Pass Json Variable Value
This commit is contained in:
commit
33c74261ec
|
|
@ -65,7 +65,7 @@ class CustomFunction_Utilities implements INode {
|
||||||
inputVars =
|
inputVars =
|
||||||
typeof functionInputVariablesRaw === 'object' ? functionInputVariablesRaw : JSON.parse(functionInputVariablesRaw)
|
typeof functionInputVariablesRaw === 'object' ? functionInputVariablesRaw : JSON.parse(functionInputVariablesRaw)
|
||||||
} catch (exception) {
|
} catch (exception) {
|
||||||
throw new Error("Invalid JSON in the PromptTemplate's promptValues: " + exception)
|
throw new Error('Invalid JSON in the Custom Function Input Variables: ' + exception)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -561,7 +561,11 @@ export const getVariableValue = (
|
||||||
variablePaths.forEach((path) => {
|
variablePaths.forEach((path) => {
|
||||||
const variableValue = variableDict[path]
|
const variableValue = variableDict[path]
|
||||||
// Replace all occurrence
|
// Replace all occurrence
|
||||||
|
if (typeof variableValue === 'object') {
|
||||||
|
returnVal = returnVal.split(path).join(JSON.stringify(variableValue).replace(/"/g, '\\"'))
|
||||||
|
} else {
|
||||||
returnVal = returnVal.split(path).join(variableValue)
|
returnVal = returnVal.split(path).join(variableValue)
|
||||||
|
}
|
||||||
})
|
})
|
||||||
return returnVal
|
return returnVal
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,12 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (executeCustomFunctionNodeApi.data) {
|
if (executeCustomFunctionNodeApi.data) {
|
||||||
|
if (typeof executeCustomFunctionNodeApi.data === 'object') {
|
||||||
|
setCodeExecutedResult(JSON.stringify(executeCustomFunctionNodeApi.data, null, 2))
|
||||||
|
} else {
|
||||||
setCodeExecutedResult(executeCustomFunctionNodeApi.data)
|
setCodeExecutedResult(executeCustomFunctionNodeApi.data)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}, [executeCustomFunctionNodeApi.data])
|
}, [executeCustomFunctionNodeApi.data])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue