mirror of
https://github.com/infiniflow/ragflow.git
synced 2025-12-08 20:42:30 +08:00
### What problem does this PR solve? fix: Fixed the issue of error reporting when uploading files in the chat box #2897 ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [ ] New Feature (non-breaking change which adds functionality) - [ ] Documentation Update - [ ] Refactoring - [ ] Performance Improvement - [ ] Other (please describe):
This commit is contained in:
@ -422,17 +422,21 @@ export const useUploadAndParseDocument = (uploadMethod: string) => {
|
||||
conversationId: string;
|
||||
fileList: UploadFile[];
|
||||
}) => {
|
||||
const formData = new FormData();
|
||||
formData.append('conversation_id', conversationId);
|
||||
fileList.forEach((file: UploadFile) => {
|
||||
formData.append('file', file as any);
|
||||
});
|
||||
if (uploadMethod === 'upload_and_parse') {
|
||||
const data = await kbService.upload_and_parse(formData);
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append('conversation_id', conversationId);
|
||||
fileList.forEach((file: UploadFile) => {
|
||||
formData.append('file', file as any);
|
||||
});
|
||||
if (uploadMethod === 'upload_and_parse') {
|
||||
const data = await kbService.upload_and_parse(formData);
|
||||
return data?.data;
|
||||
}
|
||||
const data = await chatService.uploadAndParseExternal(formData);
|
||||
return data?.data;
|
||||
} catch (error) {
|
||||
console.log('🚀 ~ useUploadAndParseDocument ~ error:', error);
|
||||
}
|
||||
const data = await chatService.uploadAndParseExternal(formData);
|
||||
return data?.data;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user