feat(rag): 补齐知识工作台聚合与转换分层
This commit is contained in:
20
frontend/src/api/__tests__/knowledgeWorkspace.spec.ts
Normal file
20
frontend/src/api/__tests__/knowledgeWorkspace.spec.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
||||
|
||||
import { getKnowledgeWorkspace } from '../knowledgeWorkspace';
|
||||
import { get } from '../request';
|
||||
|
||||
vi.mock('../request', () => ({
|
||||
get: vi.fn(),
|
||||
}));
|
||||
|
||||
describe('knowledge workspace api', () => {
|
||||
beforeEach(() => {
|
||||
vi.clearAllMocks();
|
||||
});
|
||||
|
||||
it('loads workspace aggregate by store id', () => {
|
||||
getKnowledgeWorkspace('1001');
|
||||
|
||||
expect(get).toHaveBeenCalledWith('/knowledge/workspaces/1001');
|
||||
});
|
||||
});
|
||||
40
frontend/src/api/knowledgeWorkspace.ts
Normal file
40
frontend/src/api/knowledgeWorkspace.ts
Normal file
@@ -0,0 +1,40 @@
|
||||
import { get } from './request';
|
||||
|
||||
export interface KnowledgeWorkspaceDocument {
|
||||
documentId: string;
|
||||
documentTitle?: string | null;
|
||||
parseStatus?: string | null;
|
||||
indexStatus?: string | null;
|
||||
enabled?: boolean | null;
|
||||
updateTime?: string | null;
|
||||
}
|
||||
|
||||
export interface KnowledgeWorkspace {
|
||||
storeId: string;
|
||||
storeCode?: string | null;
|
||||
storeName?: string | null;
|
||||
description?: string | null;
|
||||
status?: string | null;
|
||||
remark?: string | null;
|
||||
documentCount: number;
|
||||
parsedDocumentCount: number;
|
||||
parseFailedDocumentCount: number;
|
||||
indexedDocumentCount: number;
|
||||
pendingIndexDocumentCount: number;
|
||||
healthScore: number;
|
||||
embeddingModelId?: string | null;
|
||||
embeddingDimension?: number | null;
|
||||
chunkStrategy?: number | null;
|
||||
chunkSize?: number | null;
|
||||
chunkOverlap?: number | null;
|
||||
indexVersion?: number | null;
|
||||
chunkCount?: number | null;
|
||||
embeddingCount?: number | null;
|
||||
pendingTaskCount?: number | null;
|
||||
publishImpact?: string | null;
|
||||
documents: KnowledgeWorkspaceDocument[];
|
||||
}
|
||||
|
||||
export function getKnowledgeWorkspace(storeId: string) {
|
||||
return get<KnowledgeWorkspace>(`/knowledge/workspaces/${storeId}`);
|
||||
}
|
||||
Reference in New Issue
Block a user