Overview
SaveProcessingLoader encompasses two API client functions that implement the two-phase document processing pattern: saveProcessingLoader persists the loader configuration, and processLoader triggers asynchronous background processing of the configured document source.
Code Reference
Source Location
- File:
packages/ui/src/api/documentstore.js, Lines 18-19
- Repository: FlowiseAI/Flowise
Signature
const saveProcessingLoader = (body) => client.post(`/document-store/loader/save`, body)
const processLoader = (body, loaderId) => client.post(`/document-store/loader/process/${loaderId}`, body)
saveProcessingLoader sends a POST request to /api/v1/document-store/loader/save.
processLoader sends a POST request to /api/v1/document-store/loader/process/{loaderId}, where the loader ID is interpolated into the URL path.
Import
import documentStoreApi from '@/api/documentstore'
The functions are accessed as documentStoreApi.saveProcessingLoader(body) and documentStoreApi.processLoader(body, loaderId) after importing the default export from the documentstore API module.
I/O Contract
Inputs for saveProcessingLoader
| Parameter |
Type |
Required |
Description
|
| body |
object |
Yes |
The complete loader and splitter configuration (same structure as preview)
|
| body.storeId |
string |
Yes |
The document store identifier
|
| body.loaderId |
string |
Yes |
Existing loader ID to update, or empty string for new loaders
|
| body.loaderName |
string |
Yes |
The loader component name (e.g., pdfLoader)
|
| body.loaderConfig |
object |
Yes |
Loader-specific configuration
|
| body.splitterId |
string |
No |
The text splitter component name
|
| body.splitterConfig |
object |
No |
Splitter-specific configuration
|
| body.credential |
string |
No |
Credential identifier for authenticated loaders
|
Outputs for saveProcessingLoader
| Field |
Type |
Description
|
| data |
object |
The saved loader reference
|
| data.id |
string |
The unique identifier of the saved loader configuration
|
The function returns a Promise<{data: {id: string}}> from the axios response.
Inputs for processLoader
| Parameter |
Type |
Required |
Description
|
| body |
object |
Yes |
Processing parameters
|
| body.storeId |
string |
Yes |
The document store identifier
|
| loaderId |
string |
Yes |
The loader identifier (from saveProcessingLoader response)
|
Outputs for processLoader
| Field |
Type |
Description
|
| (void) |
-- |
The function returns Promise<void>; processing runs asynchronously in the background
|
Usage Examples
Complete Two-Phase Processing Workflow
import documentStoreApi from '@/api/documentstore'
const processDocument = async (storeId, loaderConfig) => {
// Phase 1: Save the configuration
const saveBody = {
storeId,
loaderId: '',
loaderName: 'pdfLoader',
loaderConfig,
splitterId: 'recursiveCharacterTextSplitter',
splitterConfig: {
chunkSize: 1000,
chunkOverlap: 200
}
}
const saveResponse = await documentStoreApi.saveProcessingLoader(saveBody)
const loaderId = saveResponse.data.id
console.log('Configuration saved with loader ID:', loaderId)
// Phase 2: Trigger asynchronous processing
await documentStoreApi.processLoader({ storeId }, loaderId)
console.log('Processing triggered for loader:', loaderId)
return loaderId
}
Re-processing an Existing Loader
import documentStoreApi from '@/api/documentstore'
const reprocessLoader = async (storeId, existingLoaderId) => {
// Re-trigger processing for an already-saved loader
await documentStoreApi.processLoader({ storeId }, existingLoaderId)
console.log('Re-processing triggered for loader:', existingLoaderId)
}
Processing with Credentials
import documentStoreApi from '@/api/documentstore'
const processConfluenceSource = async (storeId, credentialId) => {
const saveBody = {
storeId,
loaderId: '',
loaderName: 'confluenceLoader',
loaderConfig: {
baseUrl: 'https://company.atlassian.net/wiki',
spaceKey: 'DOCS'
},
credential: credentialId,
splitterId: 'recursiveCharacterTextSplitter',
splitterConfig: { chunkSize: 1500, chunkOverlap: 300 }
}
const saveResponse = await documentStoreApi.saveProcessingLoader(saveBody)
await documentStoreApi.processLoader({ storeId }, saveResponse.data.id)
return saveResponse.data.id
}
Related Pages