From eaec34f0bcb10207530d3b80e1fdfc41daeb7113 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Fri, 15 Nov 2024 16:05:57 +0000 Subject: [PATCH] Bugfix/Allow analytics override config (#3520) allow analytics override config --- packages/server/src/utils/index.ts | 41 ++++++++++++++++-------------- 1 file changed, 22 insertions(+), 19 deletions(-) diff --git a/packages/server/src/utils/index.ts b/packages/server/src/utils/index.ts index 4fe1ec71304..3392f21b276 100644 --- a/packages/server/src/utils/index.ts +++ b/packages/server/src/utils/index.ts @@ -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]