mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-13 01:06:03 +00:00
feat: external knowledge bases (#1783)
* Initial plan * Add backend support for external knowledge bases Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * Add frontend support for external knowledge bases with tabs UI Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * Add i18n translations for all languages (Traditional Chinese and Japanese) Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * Update knowledge base tab list styling to match plugins page Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> * perf: margin-top for kb page * refactor: switch RetrievalResultEntry to langbot_plugin pkg ones * feat: knowledge retriever listing and creating * stash * refactor: unify sync mechanism for polymorphic components * feat: use unified retireval result struct in retrieval test page * chore: remove unused methods * feat: retriever icon displaying * feat: localagent retrieval with external kbs * chore: bump version of langbot-plugin to 0.2.0b1 * fix: i18n --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: RockChinQ <45992437+RockChinQ@users.noreply.github.com> Co-authored-by: Junyan Qin <rockchinq@gmail.com>
This commit is contained in:
@@ -36,6 +36,9 @@ import {
|
||||
ApiRespMCPServers,
|
||||
ApiRespMCPServer,
|
||||
MCPServer,
|
||||
ExternalKnowledgeBase,
|
||||
ApiRespExternalKnowledgeBases,
|
||||
ApiRespExternalKnowledgeBase,
|
||||
} from '@/app/infra/entities/api';
|
||||
import { Plugin } from '@/app/infra/entities/plugin';
|
||||
import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest';
|
||||
@@ -445,6 +448,47 @@ export class BackendClient extends BaseHttpClient {
|
||||
return this.post(`/api/v1/knowledge/bases/${uuid}/retrieve`, { query });
|
||||
}
|
||||
|
||||
// ============ External Knowledge Base API ============
|
||||
public getExternalKnowledgeBases(): Promise<ApiRespExternalKnowledgeBases> {
|
||||
return this.get('/api/v1/knowledge/external-bases');
|
||||
}
|
||||
|
||||
public getExternalKnowledgeBase(
|
||||
uuid: string,
|
||||
): Promise<ApiRespExternalKnowledgeBase> {
|
||||
return this.get(`/api/v1/knowledge/external-bases/${uuid}`);
|
||||
}
|
||||
|
||||
public createExternalKnowledgeBase(
|
||||
base: ExternalKnowledgeBase,
|
||||
): Promise<{ uuid: string }> {
|
||||
return this.post('/api/v1/knowledge/external-bases', base);
|
||||
}
|
||||
|
||||
public updateExternalKnowledgeBase(
|
||||
uuid: string,
|
||||
base: ExternalKnowledgeBase,
|
||||
): Promise<{ uuid: string }> {
|
||||
return this.put(`/api/v1/knowledge/external-bases/${uuid}`, base);
|
||||
}
|
||||
|
||||
public deleteExternalKnowledgeBase(uuid: string): Promise<object> {
|
||||
return this.delete(`/api/v1/knowledge/external-bases/${uuid}`);
|
||||
}
|
||||
|
||||
public retrieveExternalKnowledgeBase(
|
||||
uuid: string,
|
||||
query: string,
|
||||
): Promise<ApiRespKnowledgeBaseRetrieve> {
|
||||
return this.post(`/api/v1/knowledge/external-bases/${uuid}/retrieve`, {
|
||||
query,
|
||||
});
|
||||
}
|
||||
|
||||
public listKnowledgeRetrievers(): Promise<{ retrievers: unknown[] }> {
|
||||
return this.get('/api/v1/knowledge/external-bases/retrievers');
|
||||
}
|
||||
|
||||
// ============ Plugins API ============
|
||||
public getPlugins(): Promise<ApiRespPlugins> {
|
||||
return this.get('/api/v1/plugins');
|
||||
|
||||
Reference in New Issue
Block a user