feat(knowledge): add knowledge base detail page components and hooks

refactor(knowledge): restructure knowledge detail page with new components
feat(components): add FileUploadDialog for file upload functionality
feat(hooks): implement document management hooks for CRUD operations
This commit is contained in:
2025-10-14 15:42:40 +08:00
parent 34181cf025
commit 7384ae36d0
12 changed files with 1456 additions and 356 deletions

View File

@@ -13,6 +13,7 @@ import type {
IRenameTag,
ParserConfig,
} from '@/interfaces/database/knowledge';
import type { GridRowSelectionModel } from '@mui/x-data-grid';
// 知识库相关API服务
const knowledgeService = {
@@ -63,7 +64,7 @@ const knowledgeService = {
params?: IFetchKnowledgeListRequestParams,
body?: IFetchDocumentListRequestBody
) => {
return request.post(api.get_document_list, { data: body || {}, params });
return request.post(api.get_document_list, { data: body || {} }, { params });
},
// 创建文档
@@ -73,12 +74,20 @@ const knowledgeService = {
// 上传文档
uploadDocument: (data: FormData) => {
return post(api.document_upload, data);
// 设置请求头为 multipart/form-data
const headers = {
'Content-Type': 'multipart/form-data',
};
return post(api.document_upload, data, { headers });
},
// 上传并解析文档
uploadAndParseDocument: (data: FormData) => {
return post(api.upload_and_parse, data);
// 设置请求头为 multipart/form-data
const headers = {
'Content-Type': 'multipart/form-data',
};
return post(api.upload_and_parse, data, { headers });
},
// 解析文档
@@ -92,7 +101,7 @@ const knowledgeService = {
},
// 删除文档
removeDocument: (data: { doc_ids: string[] }) => {
removeDocument: (data: { doc_id: string | Array<string | number> }) => {
return post(api.document_rm, data);
},
@@ -102,12 +111,12 @@ const knowledgeService = {
},
// 更改文档状态
changeDocumentStatus: (data: { doc_ids: string[]; status: string }) => {
changeDocumentStatus: (data: { doc_id: string | Array<string | number>; status: string }) => {
return post(api.document_change_status, data);
},
// 运行文档处理
runDocument: (data: { doc_ids: string[] }) => {
runDocument: (data: { doc_id: string | Array<string | number>}) => {
return post(api.document_run, data);
},
@@ -127,7 +136,7 @@ const knowledgeService = {
},
// 获取文档信息
getDocumentInfos: (data: { doc_ids: string[] }) => {
getDocumentInfos: (data: { doc_id: string | Array<string | number> }) => {
return post(api.document_infos, data);
},