From 50a301db0eb243c5d3d71cd38e3c149134291ba5 Mon Sep 17 00:00:00 2001 From: JiaoTianBo Date: Mon, 30 Mar 2026 18:48:59 +0800 Subject: [PATCH] =?UTF-8?q?refactor(api):=20=E4=BC=98=E5=8C=96=E7=9F=A5?= =?UTF-8?q?=E8=AF=86=E5=BA=93=E6=96=87=E6=A1=A3ID=E5=8F=8A=E6=80=A7?= =?UTF-8?q?=E5=88=AB=E5=B1=95=E7=A4=BA=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 KbDocumentVO 中 id 类型改为字符串,docId 设为可选字段 - 调整知识库视图中删除、重新索引和查看文档块接口调用,全部使用 id 代替 docId - 修正用户列表中性别标签显示,增加“未知”类型,完善性别类型与标签对应关系 --- src/api/ai-chat.ts | 4 ++-- src/views/knowledge-base/index.vue | 6 +++--- src/views/system/user/utils/hook.tsx | 6 ++++-- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/api/ai-chat.ts b/src/api/ai-chat.ts index c6ebd55..03ae1bf 100644 --- a/src/api/ai-chat.ts +++ b/src/api/ai-chat.ts @@ -49,8 +49,8 @@ export interface ChatMessageVO { /** 知识库文档 */ export interface KbDocumentVO { - id: number; - docId: string; // UUID格式 + id: string; // UUID格式 + docId?: string; // 可能为空 title: string; docType: string; // report/document/text/data/other fileType: string; // pdf/doc/txt/md等 diff --git a/src/views/knowledge-base/index.vue b/src/views/knowledge-base/index.vue index dd2047b..db92290 100644 --- a/src/views/knowledge-base/index.vue +++ b/src/views/knowledge-base/index.vue @@ -182,7 +182,7 @@ async function handleDelete(doc: KbDocumentVO) { } ); - const res = await deleteDocument(doc.docId); + const res = await deleteDocument(doc.id); if (res.code === 200) { ElMessage.success("删除成功"); loadDocuments(); @@ -197,7 +197,7 @@ async function handleDelete(doc: KbDocumentVO) { // 重新索引文档 async function handleReindex(doc: KbDocumentVO) { try { - const res = await reindexDocument(doc.docId); + const res = await reindexDocument(doc.id); if (res.code === 200) { ElMessage.success("重新索引已启动"); loadDocuments(); @@ -216,7 +216,7 @@ async function handleViewChunks(doc: KbDocumentVO) { selectedChunk.value = null; try { - const res = await getDocumentChunks(doc.docId); + const res = await getDocumentChunks(doc.id); if (res.code === 200) { currentDocChunks.value = res.data || []; } diff --git a/src/views/system/user/utils/hook.tsx b/src/views/system/user/utils/hook.tsx index d86605a..fabdb6e 100644 --- a/src/views/system/user/utils/hook.tsx +++ b/src/views/system/user/utils/hook.tsx @@ -96,10 +96,12 @@ export function useUser(tableRef: Ref) { cellRenderer: ({ row, props }) => ( - {row.gender === 1 ? "男" : "女"} + {row.gender === 0 ? "未知" : row.gender === 1 ? "男" : "女"} ) },