feat: Enhance file upload functionality with progress tracking
- Updated the `uploadKnowledgeFile` function to accept an optional progress callback, enabling real-time upload progress tracking. - Refactored the document upload handling in the menu component to support multiple file uploads with individual progress events. - Removed deprecated document processing state management from the KnowledgeBase view, streamlining the upload process. - Improved user feedback during file uploads by dispatching events for upload start, progress, and completion.
This commit is contained in:
@@ -167,12 +167,13 @@ export async function getDown(url: string) {
|
||||
return res
|
||||
}
|
||||
|
||||
export function postUpload(url: string, data = {}) {
|
||||
export function postUpload(url: string, data = {}, onUploadProgress?: (progressEvent: any) => void) {
|
||||
return instance.post(url, data, {
|
||||
headers: {
|
||||
"Content-Type": "multipart/form-data",
|
||||
"X-Request-ID": `${generateRandomString(12)}`,
|
||||
},
|
||||
onUploadProgress,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user