Skip to content

Commit

Permalink
Bugfix/Allow analytics override config (#3520)
Browse files Browse the repository at this point in the history
allow analytics override config
  • Loading branch information
HenryHengZJ authored Nov 15, 2024
1 parent d057129 commit eaec34f
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions packages/server/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1014,28 +1014,31 @@ export const replaceInputsWithConfig = (flowNodeData: INodeData, overrideConfig:

const getParamValues = (inputsObj: ICommonObject) => {
for (const config in overrideConfig) {
// If overrideConfig[key] is object
if (overrideConfig[config] && typeof overrideConfig[config] === 'object') {
const nodeIds = Object.keys(overrideConfig[config])
if (nodeIds.includes(flowNodeData.id)) {
// Check if this parameter is enabled for this node type
if (isParameterEnabled(flowNodeData.label, config)) {
inputsObj[config] = overrideConfig[config][flowNodeData.id]
// Always allow analytics config: https://docs.flowiseai.com/using-flowise/analytic#api
if (config !== 'analytics') {
// If overrideConfig[key] is object
if (overrideConfig[config] && typeof overrideConfig[config] === 'object') {
const nodeIds = Object.keys(overrideConfig[config])
if (nodeIds.includes(flowNodeData.id)) {
// Check if this parameter is enabled for this node type
if (isParameterEnabled(flowNodeData.label, config)) {
inputsObj[config] = overrideConfig[config][flowNodeData.id]
}
continue
} else if (nodeIds.some((nodeId) => nodeId.includes(flowNodeData.name))) {
/*
* "systemMessagePrompt": {
* "chatPromptTemplate_0": "You are an assistant" <---- continue for loop if current node is chatPromptTemplate_1
* }
*/
continue
}
continue
} else if (nodeIds.some((nodeId) => nodeId.includes(flowNodeData.name))) {
/*
* "systemMessagePrompt": {
* "chatPromptTemplate_0": "You are an assistant" <---- continue for loop if current node is chatPromptTemplate_1
* }
*/
continue
}
}

// Only proceed if the parameter is enabled for this node type
if (!isParameterEnabled(flowNodeData.label, config)) {
continue
// Only proceed if the parameter is enabled for this node type
if (!isParameterEnabled(flowNodeData.label, config)) {
continue
}
}

let paramValue = inputsObj[config]
Expand Down

0 comments on commit eaec34f

Please sign in to comment.