mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
add json parse fix
This commit is contained in:
@@ -43,11 +43,15 @@ class PromptTemplate_Prompts implements INode {
|
||||
|
||||
async init(nodeData: INodeData): Promise<any> {
|
||||
const template = nodeData.inputs?.template as string
|
||||
const promptValuesStr = nodeData.inputs?.promptValues as string
|
||||
const promptValuesStr = nodeData.inputs?.promptValues
|
||||
|
||||
let promptValues: ICommonObject = {}
|
||||
if (promptValuesStr) {
|
||||
promptValues = JSON.parse(promptValuesStr)
|
||||
try {
|
||||
promptValues = typeof promptValuesStr === 'object' ? promptValuesStr : JSON.parse(promptValuesStr)
|
||||
} catch (exception) {
|
||||
throw new Error("Invalid JSON in the PromptTemplate's promptValues: " + exception)
|
||||
}
|
||||
}
|
||||
|
||||
const inputVariables = getInputVariables(template)
|
||||
|
||||
Reference in New Issue
Block a user