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
@@ -81,6 +81,7 @@ export interface IDocumentStoreUpsertData {
replaceExisting?: boolean
createNewDocStore?: boolean
docStore?: IDocumentStore
loaderName?: string
loader?: {
name: string
config: ICommonObject
@@ -573,7 +573,8 @@ const _splitIntoChunks = async (appDataSource: DataSource, componentNodes: IComp
chatflowid: uuidv4(),
appDataSource,
databaseEntities,
logger
logger,
processRaw: true
}
const docNodeInstance = new nodeModule.nodeClass()
let docs: IDocument[] = await docNodeInstance.init(nodeData, '', options)
@@ -1727,6 +1728,11 @@ const upsertDocStore = async (
...newLoader?.config
}
// Override loaderName if it's provided directly in data
if (data.loaderName) {
loaderName = data.loaderName
}
splitterName = newSplitter?.name ? getComponentLabelFromName(newSplitter?.name) : splitterName
splitterId = newSplitter?.name || splitterId
splitterConfig = {