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:
wizardchen
2025-11-24 00:21:42 +08:00
parent 057cfd9eb0
commit 4a2be2b878
12 changed files with 790 additions and 532 deletions
+2 -1
View File
@@ -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,
});
}