From 82da25d763f271f89ef516c6357fb57326920b20 Mon Sep 17 00:00:00 2001 From: Henry Heng Date: Sun, 13 Oct 2024 14:21:18 +0100 Subject: [PATCH] Bugfix/Parse vars from overrideconfig to JSON (#3347) parse vars from overrideconfig to JSON --- packages/server/src/utils/buildChatflow.ts | 3 +++ packages/server/src/utils/upsertVector.ts | 3 +++ 2 files changed, 6 insertions(+) diff --git a/packages/server/src/utils/buildChatflow.ts b/packages/server/src/utils/buildChatflow.ts index 90297076f..3257f0a8a 100644 --- a/packages/server/src/utils/buildChatflow.ts +++ b/packages/server/src/utils/buildChatflow.ts @@ -184,6 +184,9 @@ export const utilBuildChatflow = async (req: Request, isInternal: boolean = fals fs.unlinkSync(file.path) } + if (overrideConfig.vars && typeof overrideConfig.vars === 'string') { + overrideConfig.vars = JSON.parse(overrideConfig.vars) + } incomingInput = { question: req.body.question ?? 'hello', overrideConfig diff --git a/packages/server/src/utils/upsertVector.ts b/packages/server/src/utils/upsertVector.ts index 044716e74..c0e5e4d98 100644 --- a/packages/server/src/utils/upsertVector.ts +++ b/packages/server/src/utils/upsertVector.ts @@ -89,6 +89,9 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) => fs.unlinkSync(file.path) } + if (overrideConfig.vars && typeof overrideConfig.vars === 'string') { + overrideConfig.vars = JSON.parse(overrideConfig.vars) + } incomingInput = { question: req.body.question ?? 'hello', overrideConfig,