mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 13:00:56 +03:00
Bugfix/Allow files uploads without enabling overrideconfig (#3915)
allow files uploads without enabling overrideconfig
This commit is contained in:
@@ -1110,8 +1110,11 @@ export const replaceInputsWithConfig = (
|
||||
continue
|
||||
}
|
||||
} else {
|
||||
// Only proceed if the parameter is enabled
|
||||
if (!isParameterEnabled(flowNodeData.label, config)) {
|
||||
// Skip if it is an override "files" input, such as pdfFile, txtFile, etc
|
||||
if (typeof overrideConfig[config] === 'string' && overrideConfig[config].includes('FILE-STORAGE::')) {
|
||||
// pass
|
||||
} else if (!isParameterEnabled(flowNodeData.label, config)) {
|
||||
// Only proceed if the parameter is enabled
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
@@ -168,32 +168,6 @@ export const upsertVector = async (req: Request, isInternal: boolean = false) =>
|
||||
const availableVariables = await appServer.AppDataSource.getRepository(Variable).find()
|
||||
const { nodeOverrides, variableOverrides, apiOverrideStatus } = getAPIOverrideConfig(chatflow)
|
||||
|
||||
// For "files" input, add a new node override with the actual input name such as pdfFile, txtFile, etc, to allow overriding the input
|
||||
for (const nodeLabel in nodeOverrides) {
|
||||
const params = nodeOverrides[nodeLabel]
|
||||
const enabledFileParam = params.find((param) => param.enabled && param.name === 'files')
|
||||
if (enabledFileParam) {
|
||||
if (enabledFileParam.type.includes(',')) {
|
||||
const fileInputFieldsFromExt = enabledFileParam.type.split(',').map((fileType) => mapExtToInputField(fileType.trim()))
|
||||
for (const fileInputFieldFromExt of fileInputFieldsFromExt) {
|
||||
if (nodeOverrides[nodeLabel].some((param) => param.name === fileInputFieldFromExt)) {
|
||||
continue
|
||||
}
|
||||
nodeOverrides[nodeLabel].push({
|
||||
...enabledFileParam,
|
||||
name: fileInputFieldFromExt
|
||||
})
|
||||
}
|
||||
} else {
|
||||
const fileInputFieldFromExt = mapExtToInputField(enabledFileParam.type)
|
||||
nodeOverrides[nodeLabel].push({
|
||||
...enabledFileParam,
|
||||
name: fileInputFieldFromExt
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const upsertedResult = await buildFlow({
|
||||
startingNodeIds,
|
||||
reactFlowNodes: nodes,
|
||||
|
||||
@@ -121,10 +121,16 @@ const OverrideConfig = ({ dialogProps }) => {
|
||||
}
|
||||
|
||||
if (overrideConfigStatus) {
|
||||
// loop through each key in nodeOverrides and filter out the enabled ones
|
||||
const filteredNodeOverrides = {}
|
||||
for (const key in nodeOverrides) {
|
||||
filteredNodeOverrides[key] = nodeOverrides[key].filter((node) => node.enabled)
|
||||
}
|
||||
|
||||
obj.overrideConfig = {
|
||||
...obj.overrideConfig,
|
||||
nodes: nodeOverrides,
|
||||
variables: variableOverrides
|
||||
nodes: filteredNodeOverrides,
|
||||
variables: variableOverrides.filter((node) => node.enabled)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user