mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-07-12 22:55:45 +08:00
Fix: Uploading TSV format documents to the knowledge base did not generate any error messages. (#15284)
### What problem does this PR solve? Fix: Uploading TSV format documents to the knowledge base did not generate any error messages. ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import { Authorization } from '@/constants/authorization';
|
||||
import { IRenameTag } from '@/interfaces/database/dataset';
|
||||
import {
|
||||
IFetchDocumentListRequestBody,
|
||||
@@ -6,21 +5,15 @@ import {
|
||||
} from '@/interfaces/request/knowledge';
|
||||
import { ProcessingType } from '@/pages/dataset/dataset-overview/dataset-common';
|
||||
import api from '@/utils/api';
|
||||
import { getAuthorization } from '@/utils/authorization-util';
|
||||
import registerServer from '@/utils/register-server';
|
||||
import request from '@/utils/request';
|
||||
import axios from 'axios';
|
||||
|
||||
const {
|
||||
createKb,
|
||||
rmKb,
|
||||
kbList,
|
||||
documentChangeStatus,
|
||||
documentChangeParser,
|
||||
documentThumbnails,
|
||||
documentIngest,
|
||||
documentUpload,
|
||||
webCrawl,
|
||||
listTagByKnowledgeIds,
|
||||
setMeta,
|
||||
getMeta,
|
||||
@@ -41,31 +34,14 @@ const methods = {
|
||||
url: kbList,
|
||||
method: 'get',
|
||||
},
|
||||
// document manager
|
||||
documentChangeStatus: {
|
||||
url: documentChangeStatus,
|
||||
method: 'post',
|
||||
},
|
||||
documentIngest: {
|
||||
url: documentIngest,
|
||||
method: 'post',
|
||||
},
|
||||
documentChangeParser: {
|
||||
url: documentChangeParser,
|
||||
method: 'post',
|
||||
},
|
||||
documentThumbnails: {
|
||||
url: documentThumbnails,
|
||||
method: 'get',
|
||||
},
|
||||
documentUpload: {
|
||||
url: documentUpload,
|
||||
method: 'post',
|
||||
},
|
||||
webCrawl: {
|
||||
url: webCrawl,
|
||||
method: 'post',
|
||||
},
|
||||
setMeta: {
|
||||
url: setMeta,
|
||||
method: 'post',
|
||||
@@ -74,10 +50,6 @@ const methods = {
|
||||
url: listTagByKnowledgeIds,
|
||||
method: 'get',
|
||||
},
|
||||
documentFilter: {
|
||||
url: api.getDatasetFilter,
|
||||
method: 'get',
|
||||
},
|
||||
getMeta: {
|
||||
url: getMeta,
|
||||
method: 'get',
|
||||
@@ -317,14 +289,9 @@ export const listDocument = (
|
||||
export const documentFilter = (kb_id: string) =>
|
||||
request.get(api.getDatasetFilter(kb_id), { params: {} });
|
||||
|
||||
// Custom upload function that handles dynamic URL using axios directly
|
||||
export const uploadDocument = async (datasetId: string, formData: FormData) => {
|
||||
const url = api.documentUpload(datasetId);
|
||||
const response = await axios.post(url, formData, {
|
||||
headers: {
|
||||
[Authorization]: getAuthorization(),
|
||||
},
|
||||
});
|
||||
const response = await request.post(url, { data: formData });
|
||||
return response.data;
|
||||
};
|
||||
|
||||
@@ -335,18 +302,6 @@ export const createDocument = async (datasetId: string, name: string) => {
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const webCrawlDocument = async (
|
||||
datasetId: string,
|
||||
formData: FormData,
|
||||
) => {
|
||||
const response = await axios.post(api.webCrawl(datasetId), formData, {
|
||||
headers: {
|
||||
[Authorization]: getAuthorization(),
|
||||
},
|
||||
});
|
||||
return response.data;
|
||||
};
|
||||
|
||||
export const renameDocument = (
|
||||
datasetId: string,
|
||||
documentId: string,
|
||||
|
||||
Reference in New Issue
Block a user