mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 15:00:57 +03:00
Merge branch 'FlowiseAI:main' into main
This commit is contained in:
@@ -65,7 +65,7 @@ class CustomFunction_Utilities implements INode {
|
||||
inputVars =
|
||||
typeof functionInputVariablesRaw === 'object' ? functionInputVariablesRaw : JSON.parse(functionInputVariablesRaw)
|
||||
} 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)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -362,7 +362,8 @@ export class App {
|
||||
const chatflow = await this.AppDataSource.getRepository(ChatFlow).findOneBy({
|
||||
id: req.params.id
|
||||
})
|
||||
if (chatflow && chatflow.chatbotConfig) {
|
||||
if (!chatflow) return res.status(404).send(`Chatflow ${req.params.id} not found`)
|
||||
if (chatflow.chatbotConfig) {
|
||||
try {
|
||||
const parsedConfig = JSON.parse(chatflow.chatbotConfig)
|
||||
return res.json(parsedConfig)
|
||||
@@ -370,7 +371,7 @@ export class App {
|
||||
return res.status(500).send(`Error parsing Chatbot Config for Chatflow ${req.params.id}`)
|
||||
}
|
||||
}
|
||||
return res.status(404).send(`Chatbot Config for Chatflow ${req.params.id} not found`)
|
||||
return res.status(200).send('OK')
|
||||
})
|
||||
|
||||
// Save chatflow
|
||||
|
||||
@@ -561,7 +561,11 @@ export const getVariableValue = (
|
||||
variablePaths.forEach((path) => {
|
||||
const variableValue = variableDict[path]
|
||||
// Replace all occurrence
|
||||
returnVal = returnVal.split(path).join(variableValue)
|
||||
if (typeof variableValue === 'object') {
|
||||
returnVal = returnVal.split(path).join(JSON.stringify(variableValue).replace(/"/g, '\\"'))
|
||||
} else {
|
||||
returnVal = returnVal.split(path).join(variableValue)
|
||||
}
|
||||
})
|
||||
return returnVal
|
||||
}
|
||||
|
||||
@@ -67,7 +67,11 @@ const ExpandTextDialog = ({ show, dialogProps, onCancel, onConfirm }) => {
|
||||
|
||||
useEffect(() => {
|
||||
if (executeCustomFunctionNodeApi.data) {
|
||||
setCodeExecutedResult(executeCustomFunctionNodeApi.data)
|
||||
if (typeof executeCustomFunctionNodeApi.data === 'object') {
|
||||
setCodeExecutedResult(JSON.stringify(executeCustomFunctionNodeApi.data, null, 2))
|
||||
} else {
|
||||
setCodeExecutedResult(executeCustomFunctionNodeApi.data)
|
||||
}
|
||||
}
|
||||
}, [executeCustomFunctionNodeApi.data])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user