Bugfix/Upsert files override (#3569)

add fix for upsert files
This commit is contained in:
Henry Heng
2024-11-25 17:26:32 +00:00
committed by GitHub
parent a2c36b4447
commit 7d9e1514b1
3 changed files with 43 additions and 9 deletions
+13
View File
@@ -159,6 +159,19 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
/*** Get API Config ***/
const { nodeOverrides, variableOverrides, apiOverrideStatus } = getAPIOverrideConfig(chatflow)
// For "files" input, add a new node override with the actual input name such as pdfFile, txtFile, etc.
for (const nodeLabel in nodeOverrides) {
const params = nodeOverrides[nodeLabel]
const enabledFileParam = params.find((param) => param.enabled && param.name === 'files')
if (enabledFileParam) {
const fileInputFieldFromExt = mapExtToInputField(enabledFileParam.type)
nodeOverrides[nodeLabel].push({
...enabledFileParam,
name: fileInputFieldFromExt
})
}
}
const upsertedResult = await buildFlow({
startingNodeIds,
reactFlowNodes: nodes,