refactor(api): 优化知识库文档ID及性别展示逻辑
Some checks failed
Lint Code / Lint Code (push) Failing after 2m37s

- 将 KbDocumentVO 中 id 类型改为字符串,docId 设为可选字段
- 调整知识库视图中删除、重新索引和查看文档块接口调用,全部使用 id 代替 docId
- 修正用户列表中性别标签显示,增加“未知”类型,完善性别类型与标签对应关系
This commit is contained in:
2026-03-30 18:48:59 +08:00
parent dfd20e779d
commit 50a301db0e
3 changed files with 9 additions and 7 deletions

View File

@@ -49,8 +49,8 @@ export interface ChatMessageVO {
/** 知识库文档 */ /** 知识库文档 */
export interface KbDocumentVO { export interface KbDocumentVO {
id: number; id: string; // UUID格式
docId: string; // UUID格式 docId?: string; // 可能为空
title: string; title: string;
docType: string; // report/document/text/data/other docType: string; // report/document/text/data/other
fileType: string; // pdf/doc/txt/md等 fileType: string; // pdf/doc/txt/md等

View File

@@ -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) { if (res.code === 200) {
ElMessage.success("删除成功"); ElMessage.success("删除成功");
loadDocuments(); loadDocuments();
@@ -197,7 +197,7 @@ async function handleDelete(doc: KbDocumentVO) {
// 重新索引文档 // 重新索引文档
async function handleReindex(doc: KbDocumentVO) { async function handleReindex(doc: KbDocumentVO) {
try { try {
const res = await reindexDocument(doc.docId); const res = await reindexDocument(doc.id);
if (res.code === 200) { if (res.code === 200) {
ElMessage.success("重新索引已启动"); ElMessage.success("重新索引已启动");
loadDocuments(); loadDocuments();
@@ -216,7 +216,7 @@ async function handleViewChunks(doc: KbDocumentVO) {
selectedChunk.value = null; selectedChunk.value = null;
try { try {
const res = await getDocumentChunks(doc.docId); const res = await getDocumentChunks(doc.id);
if (res.code === 200) { if (res.code === 200) {
currentDocChunks.value = res.data || []; currentDocChunks.value = res.data || [];
} }

View File

@@ -96,10 +96,12 @@ export function useUser(tableRef: Ref) {
cellRenderer: ({ row, props }) => ( cellRenderer: ({ row, props }) => (
<el-tag <el-tag
size={props.size} size={props.size}
type={row.gender === 2 ? "danger" : null} type={
row.gender === 0 ? "info" : row.gender === 1 ? "success" : "danger"
}
effect="plain" effect="plain"
> >
{row.gender === 1 ? "男" : "女"} {row.gender === 0 ? "未知" : row.gender === 1 ? "男" : "女"}
</el-tag> </el-tag>
) )
}, },