fix: Fixed the issue of error reporting when uploading files in the chat box #2897 (#2898)

### 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:
balibabu
2024-10-18 17:21:12 +08:00
committed by GitHub
parent c760f058df
commit 526fcbbfde
6 changed files with 37 additions and 70 deletions

View File

@ -1,7 +1,6 @@
import api from '@/utils/api';
import registerServer from '@/utils/register-server';
import request from '@/utils/request';
import pureRequest from 'umi-request';
const {
create_kb,
@ -25,7 +24,6 @@ const {
retrieval_test,
document_rename,
document_run,
get_document_file,
document_upload,
web_crawl,
knowledge_graph,
@ -145,39 +143,4 @@ const methods = {
const kbService = registerServer<keyof typeof methods>(methods, request);
export const getDocumentFile = (documentId: string) => {
return pureRequest(get_document_file + '/' + documentId, {
responseType: 'blob',
method: 'get',
parseResponse: false,
// getResponse: true,
})
.then((res) => {
const x = res.headers.get('content-disposition');
console.info(res);
console.info(x);
return res.blob();
})
.then((res) => {
// const objectURL = URL.createObjectURL(res);
// let btn = document.createElement('a');
// btn.download = '文件名.pdf';
// btn.href = objectURL;
// btn.click();
// URL.revokeObjectURL(objectURL);
// btn = null;
return res;
})
.catch((err) => {
console.info(err);
});
};
export default kbService;