fix: 修复知识库失败批次继续与重分块
- 统一继续和重试逻辑,恢复全部失败明细 - 向量化失败时废弃旧快照并重新分块 - 增加 BGE-M3 分块硬上限与索引写入结果校验
This commit is contained in:
@@ -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();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user