mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Merge pull request #431 from FlowiseAI/bugfix/UnexpectedTokenInJSONError
remove returnJSONStr function
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface'
|
import { ICommonObject, INode, INodeData, INodeParams, PromptTemplate } from '../../../src/Interface'
|
||||||
import { getBaseClasses, getInputVariables, returnJSONStr } from '../../../src/utils'
|
import { getBaseClasses, getInputVariables } from '../../../src/utils'
|
||||||
import { PromptTemplateInput } from 'langchain/prompts'
|
import { PromptTemplateInput } from 'langchain/prompts'
|
||||||
|
|
||||||
class PromptTemplate_Prompts implements INode {
|
class PromptTemplate_Prompts implements INode {
|
||||||
@@ -46,12 +46,11 @@ class PromptTemplate_Prompts implements INode {
|
|||||||
|
|
||||||
async init(nodeData: INodeData): Promise<any> {
|
async init(nodeData: INodeData): Promise<any> {
|
||||||
const template = nodeData.inputs?.template as string
|
const template = nodeData.inputs?.template as string
|
||||||
let promptValuesStr = nodeData.inputs?.promptValues as string
|
const promptValuesStr = nodeData.inputs?.promptValues as string
|
||||||
|
|
||||||
let promptValues: ICommonObject = {}
|
let promptValues: ICommonObject = {}
|
||||||
if (promptValuesStr) {
|
if (promptValuesStr) {
|
||||||
promptValuesStr = promptValuesStr.replace(/\s/g, '')
|
promptValues = JSON.parse(promptValuesStr.replace(/\s/g, ''))
|
||||||
promptValues = JSON.parse(returnJSONStr(promptValuesStr))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const inputVariables = getInputVariables(template)
|
const inputVariables = getInputVariables(template)
|
||||||
|
|||||||
Reference in New Issue
Block a user