feat: 完善知识库批量导入与公共 API

- 新增批量异步导入、状态查询、失败重试与中断恢复链路

- 拆分知识库读取、导入、维护权限并完善 Public API 契约

- 补充数据库迁移、管理端交互、接口说明与相关测试
This commit is contained in:
2026-08-03 11:13:48 +08:00
parent 6df3dd9981
commit 51dbfd41b6
99 changed files with 16274 additions and 480 deletions

View File

@@ -13,6 +13,7 @@ import { api } from '#/api/request';
import bookIcon from '#/assets/ai/knowledge/book.svg';
import HeaderSearch from '#/components/headerSearch/HeaderSearch.vue';
import { createLazyComponentController } from '#/utils/lazy-component';
import DocumentImportBatchStatus from '#/views/ai/documentCollection/DocumentImportBatchStatus.vue';
const ChunkDocumentTable = defineAsyncComponent(
() => import('#/views/ai/documentCollection/ChunkDocumentTable.vue'),
@@ -188,6 +189,7 @@ const headerButtons = [
];
const panelMode = ref<'chunk' | 'list' | 'process'>('list');
const documentTableRef = ref();
const batchStatusRefreshKey = ref(0);
const documentTitle = ref('');
const handleSearch = (searchParams: string) => {
documentTableRef.value?.search?.(searchParams);
@@ -227,6 +229,7 @@ const backDoc = async () => {
documentTitle.value = '';
await nextTick();
documentTableRef.value?.reload?.();
batchStatusRefreshKey.value += 1;
};
</script>
@@ -273,7 +276,16 @@ const backDoc = async () => {
:buttons="canManageCurrentKnowledge ? headerButtons : []"
@search="handleSearch"
@button-click="handleButtonClick"
/>
>
<template #middle>
<DocumentImportBatchStatus
:knowledge-id="knowledgeId"
:manageable="canManageCurrentKnowledge"
:refresh-key="batchStatusRefreshKey"
@continued="backDoc"
/>
</template>
</HeaderSearch>
</div>
<div v-if="panelMode === 'chunk'" class="doc-sub-back">
<ElButton @click="backDoc">
@@ -343,6 +355,7 @@ const backDoc = async () => {
:is="ImportKnowledgeDocFileComponent"
v-if="ImportKnowledgeDocFileComponent"
ref="importDocModalRef"
enable-bulk-auto
:knowledge-id-prop="String(knowledgeId)"
@imported="backDoc"
/>
@@ -386,6 +399,10 @@ const backDoc = async () => {
margin: 0 auto;
}
.doc-header :deep(.search-middle) {
flex: 1 1 360px;
}
.doc-content {
display: flex;
flex-direction: column;