Skip to content

Commit f7d7220

Browse files
authored
Merge pull request #1645 from FlowiseAI/bugfix/Template-Split
Bugfix/OverrideConfig JSON value
2 parents 436b3aa + 2b67346 commit f7d7220

File tree

1 file changed

+13
-6
lines changed

1 file changed

+13
-6
lines changed

packages/server/src/utils/index.ts

+13-6
Original file line numberDiff line numberDiff line change
@@ -611,28 +611,35 @@ export const resolveVariables = (
611611
export const replaceInputsWithConfig = (flowNodeData: INodeData, overrideConfig: ICommonObject) => {
612612
const types = 'inputs'
613613

614-
const getParamValues = (paramsObj: ICommonObject) => {
614+
const getParamValues = (inputsObj: ICommonObject) => {
615615
for (const config in overrideConfig) {
616616
// If overrideConfig[key] is object
617617
if (overrideConfig[config] && typeof overrideConfig[config] === 'object') {
618618
const nodeIds = Object.keys(overrideConfig[config])
619619
if (nodeIds.includes(flowNodeData.id)) {
620-
paramsObj[config] = overrideConfig[config][flowNodeData.id]
620+
inputsObj[config] = overrideConfig[config][flowNodeData.id]
621+
continue
622+
} else if (nodeIds.some((nodeId) => nodeId.includes(flowNodeData.name))) {
623+
/*
624+
* "systemMessagePrompt": {
625+
* "chatPromptTemplate_0": "You are an assistant" <---- continue for loop if current node is chatPromptTemplate_1
626+
* }
627+
*/
621628
continue
622629
}
623630
}
624631

625-
let paramValue = overrideConfig[config] ?? paramsObj[config]
632+
let paramValue = overrideConfig[config] ?? inputsObj[config]
626633
// Check if boolean
627634
if (paramValue === 'true') paramValue = true
628635
else if (paramValue === 'false') paramValue = false
629-
paramsObj[config] = paramValue
636+
inputsObj[config] = paramValue
630637
}
631638
}
632639

633-
const paramsObj = flowNodeData[types] ?? {}
640+
const inputsObj = flowNodeData[types] ?? {}
634641

635-
getParamValues(paramsObj)
642+
getParamValues(inputsObj)
636643

637644
return flowNodeData
638645
}

0 commit comments

Comments
 (0)