feat: basic entities of kb

This commit is contained in:
Junyan Qin
2025-06-29 21:00:48 +08:00
parent 22ef1a399e
commit bbf583ddb5
6 changed files with 221 additions and 0 deletions

View File

@@ -133,6 +133,23 @@ export interface Bot {
updated_at?: string;
}
export interface ApiRespKnowledgeBases {
bases: KnowledgeBase[];
}
export interface ApiRespKnowledgeBase {
base: KnowledgeBase;
}
export interface KnowledgeBase {
uuid?: string;
name: string;
description: string;
embedding_model_uuid: string;
created_at?: string;
updated_at?: string;
}
// plugins
export interface ApiRespPlugins {
plugins: Plugin[];

View File

@@ -34,6 +34,9 @@ import {
AsyncTask,
ApiRespWebChatMessage,
ApiRespWebChatMessages,
ApiRespKnowledgeBases,
ApiRespKnowledgeBase,
KnowledgeBase,
} from '@/app/infra/entities/api';
import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest';
import { GetBotLogsResponse } from '@/app/infra/http/requestParam/bots/GetBotLogsResponse';
@@ -427,6 +430,19 @@ class HttpClient {
return this.post(`/api/v1/platform/bots/${botId}/logs`, request);
}
// ============ Knowledge Base API ============
public getKnowledgeBases(): Promise<ApiRespKnowledgeBases> {
return this.get('/api/v1/knowledge/bases');
}
public getKnowledgeBase(uuid: string): Promise<ApiRespKnowledgeBase> {
return this.get(`/api/v1/knowledge/bases/${uuid}`);
}
public createKnowledgeBase(base: KnowledgeBase): Promise<{ uuid: string }> {
return this.post('/api/v1/knowledge/bases', base);
}
// ============ Plugins API ============
public getPlugins(): Promise<ApiRespPlugins> {
return this.get('/api/v1/plugins');