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:
Henry Heng
2025-08-18 18:35:50 +08:00
committed by GitHub
parent 9cac8d7a00
commit ad0679801a
5 changed files with 79 additions and 8 deletions
@@ -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)}` : ''
}