mirror of
https://github.com/farcasclaudiu/Flowise.git
synced 2026-06-28 17:01:00 +03:00
Bugfix/Upsert API for file loader (#5096)
* fix upser api for file loader * - Introduced loaderName property in IDocumentStoreUpsertData interface. - Updated upsertDocStore function to utilize loaderName if provided. - Enhanced DocStoreAPIDialog to allow loaderName customization in API requests. - Modified DocumentStoreDetail to display file names when available, improving source formatting logic.
This commit is contained in:
@@ -136,9 +136,10 @@ class File_DocumentLoaders implements INode {
|
||||
|
||||
let files: string[] = []
|
||||
const fileBlobs: { blob: Blob; ext: string }[] = []
|
||||
const processRaw = options.processRaw
|
||||
|
||||
//FILE-STORAGE::["CONTRIBUTING.md","LICENSE.md","README.md"]
|
||||
const totalFiles = getOverrideFileInputs(nodeData) || fileBase64
|
||||
const totalFiles = getOverrideFileInputs(nodeData, processRaw) || fileBase64
|
||||
if (totalFiles.startsWith('FILE-STORAGE::')) {
|
||||
const fileName = totalFiles.replace('FILE-STORAGE::', '')
|
||||
if (fileName.startsWith('[') && fileName.endsWith(']')) {
|
||||
@@ -298,7 +299,7 @@ class File_DocumentLoaders implements INode {
|
||||
}
|
||||
}
|
||||
|
||||
const getOverrideFileInputs = (nodeData: INodeData) => {
|
||||
const getOverrideFileInputs = (nodeData: INodeData, processRaw: boolean) => {
|
||||
const txtFileBase64 = nodeData.inputs?.txtFile as string
|
||||
const pdfFileBase64 = nodeData.inputs?.pdfFile as string
|
||||
const jsonFileBase64 = nodeData.inputs?.jsonFile as string
|
||||
@@ -347,6 +348,10 @@ const getOverrideFileInputs = (nodeData: INodeData) => {
|
||||
files.push(...removePrefix(powerpointFileBase64))
|
||||
}
|
||||
|
||||
if (processRaw) {
|
||||
return files.length ? JSON.stringify(files) : ''
|
||||
}
|
||||
|
||||
return files.length ? `FILE-STORAGE::${JSON.stringify(files)}` : ''
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user