feat(audit): 补齐摄取管道入口并沉淀完成度审计
This commit is contained in:
@@ -1,14 +1,33 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
const getMock = vi.fn();
|
||||
const postMock = vi.fn();
|
||||
|
||||
vi.mock('../request', () => ({
|
||||
get: getMock,
|
||||
post: postMock,
|
||||
}));
|
||||
|
||||
describe('ingestion api', () => {
|
||||
afterEach(() => {
|
||||
getMock.mockReset();
|
||||
postMock.mockReset();
|
||||
});
|
||||
|
||||
it('creates ingestion run aggregate with store and document payload', async () => {
|
||||
postMock.mockResolvedValue({
|
||||
resultcode: '0',
|
||||
message: null,
|
||||
data: { runId: 'ingestion-1001-11' },
|
||||
});
|
||||
|
||||
const { createIngestionRun } = await import('../ingestion');
|
||||
await createIngestionRun('1001', '11');
|
||||
|
||||
expect(postMock).toHaveBeenCalledWith('/knowledge/ingestion-runs', {
|
||||
storeId: '1001',
|
||||
documentId: '11',
|
||||
});
|
||||
});
|
||||
|
||||
it('requests ingestion run aggregate with store and document params', async () => {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { get } from './request';
|
||||
import { get, post } from './request';
|
||||
|
||||
export interface IngestionRunFile {
|
||||
documentId: string;
|
||||
@@ -39,6 +39,13 @@ export interface IngestionRun {
|
||||
logs: IngestionRunLog[];
|
||||
}
|
||||
|
||||
export function createIngestionRun(storeId: string, documentId: string) {
|
||||
return post<IngestionRun>('/knowledge/ingestion-runs', {
|
||||
storeId,
|
||||
documentId,
|
||||
});
|
||||
}
|
||||
|
||||
export function getIngestionRun(runId: string, storeId: string, documentId: string) {
|
||||
return get<IngestionRun>(`/knowledge/ingestion-runs/${runId}`, {
|
||||
params: {
|
||||
|
||||
Reference in New Issue
Block a user