fix: 修复知识库失败批次继续与重分块

- 统一继续和重试逻辑,恢复全部失败明细

- 向量化失败时废弃旧快照并重新分块

- 增加 BGE-M3 分块硬上限与索引写入结果校验
This commit is contained in:
2026-08-07 12:39:27 +08:00
parent 7082041e6e
commit 7a64cfcaa4
9 changed files with 539 additions and 238 deletions

View File

@@ -79,4 +79,78 @@ describe('documentImportBatchStatus', () => {
);
wrapper.unmount();
});
it('部分失败批次按 failedCount 继续并发送统一批次参数', async () => {
const failedBatch = {
batchId: 'batch-1',
completedCount: 1,
failedCount: 1,
importMode: 'AUTO',
pendingCount: 0,
processingCount: 0,
progressPercent: 100,
retryableFailedCount: 0,
skippedCount: 0,
status: 'PARTIAL_SUCCEEDED',
totalCount: 2,
};
apiMocks.get.mockResolvedValue({
data: failedBatch,
errorCode: 0,
});
apiMocks.post.mockResolvedValue({
data: {
...failedBatch,
failedCount: 0,
pendingCount: 1,
progressPercent: 50,
status: 'RUNNING',
},
errorCode: 0,
});
const wrapper = mount(DocumentImportBatchStatus, {
props: {
knowledgeId: 'knowledge-1',
manageable: true,
},
});
await flushPromises();
const continueButton = wrapper.find('.batch-status__continue');
expect(continueButton.exists()).toBe(true);
await continueButton.trigger('click');
await flushPromises();
expect(apiMocks.post).toHaveBeenCalledWith(
'/api/v1/document/import/batch/continue',
{
batchId: 'batch-1',
knowledgeId: 'knowledge-1',
},
);
wrapper.unmount();
});
it('没有失败项时不使用旧兼容计数显示继续按钮', async () => {
apiMocks.get.mockResolvedValue({
data: {
...createBatch('COMPLETED', 2),
retryableFailedCount: 1,
status: 'PARTIAL_SUCCEEDED',
},
errorCode: 0,
});
const wrapper = mount(DocumentImportBatchStatus, {
props: {
knowledgeId: 'knowledge-1',
manageable: true,
},
});
await flushPromises();
expect(wrapper.find('.batch-status__continue').exists()).toBe(false);
wrapper.unmount();
});
});

View File

@@ -15,7 +15,6 @@ interface BatchStatus {
pendingCount: number;
processingCount: number;
progressPercent: number;
retryableFailedCount?: number;
skippedCount: number;
status:
| 'CANCELLED'
@@ -53,8 +52,7 @@ const canContinue = computed(
props.manageable &&
(batch.value?.status === 'INTERRUPTED' ||
batch.value?.status === 'PARTIAL_SUCCEEDED') &&
(Number(batch.value?.retryableFailedCount || 0) > 0 ||
Number(batch.value?.failedCount || 0) > 0),
Number(batch.value?.failedCount || 0) > 0,
);
const processedCount = computed(