mirror of
https://github.com/langbot-app/LangBot.git
synced 2026-06-18 11:44:18 +00:00
Merge branch 'master' into feat/topk_splitter
This commit is contained in:
@@ -55,6 +55,15 @@ export interface LLMModel {
|
||||
// updated_at: string;
|
||||
}
|
||||
|
||||
export interface KnowledgeBase {
|
||||
uuid?: string;
|
||||
name: string;
|
||||
description: string;
|
||||
embedding_model_uuid: string;
|
||||
created_at?: string;
|
||||
top_k?: number;
|
||||
}
|
||||
|
||||
export interface ApiRespProviderEmbeddingModels {
|
||||
models: EmbeddingModel[];
|
||||
}
|
||||
@@ -156,7 +165,7 @@ export interface ApiRespKnowledgeBaseFiles {
|
||||
}
|
||||
|
||||
export interface KnowledgeBaseFile {
|
||||
id: string;
|
||||
uuid: string;
|
||||
file_name: string;
|
||||
status: string;
|
||||
}
|
||||
@@ -288,3 +297,18 @@ export interface ApiRespWebChatMessage {
|
||||
export interface ApiRespWebChatMessages {
|
||||
messages: Message[];
|
||||
}
|
||||
|
||||
export interface RetrieveResult {
|
||||
id: string;
|
||||
metadata: {
|
||||
file_id: string;
|
||||
text: string;
|
||||
uuid: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
distance: number;
|
||||
}
|
||||
|
||||
export interface ApiRespKnowledgeBaseRetrieve {
|
||||
results: RetrieveResult[];
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ export enum DynamicFormItemType {
|
||||
LLM_MODEL_SELECTOR = 'llm-model-selector',
|
||||
PROMPT_EDITOR = 'prompt-editor',
|
||||
UNKNOWN = 'unknown',
|
||||
KNOWLEDGE_BASE_SELECTOR = 'knowledge-base-selector',
|
||||
}
|
||||
|
||||
export interface IDynamicFormItemOption {
|
||||
|
||||
@@ -38,6 +38,7 @@ import {
|
||||
ApiRespKnowledgeBase,
|
||||
KnowledgeBase,
|
||||
ApiRespKnowledgeBaseFiles,
|
||||
ApiRespKnowledgeBaseRetrieve,
|
||||
} from '@/app/infra/entities/api';
|
||||
import { GetBotLogsRequest } from '@/app/infra/http/requestParam/bots/GetBotLogsRequest';
|
||||
import { GetBotLogsResponse } from '@/app/infra/http/requestParam/bots/GetBotLogsResponse';
|
||||
@@ -323,8 +324,15 @@ class HttpClient {
|
||||
return this.get('/api/v1/pipelines/_/metadata');
|
||||
}
|
||||
|
||||
public getPipelines(): Promise<ApiRespPipelines> {
|
||||
return this.get('/api/v1/pipelines');
|
||||
public getPipelines(
|
||||
sortBy?: string,
|
||||
sortOrder?: string,
|
||||
): Promise<ApiRespPipelines> {
|
||||
const params = new URLSearchParams();
|
||||
if (sortBy) params.append('sort_by', sortBy);
|
||||
if (sortOrder) params.append('sort_order', sortOrder);
|
||||
const queryString = params.toString();
|
||||
return this.get(`/api/v1/pipelines${queryString ? `?${queryString}` : ''}`);
|
||||
}
|
||||
|
||||
public getPipeline(uuid: string): Promise<GetPipelineResponseData> {
|
||||
@@ -459,6 +467,13 @@ class HttpClient {
|
||||
return this.post('/api/v1/knowledge/bases', base);
|
||||
}
|
||||
|
||||
public updateKnowledgeBase(
|
||||
uuid: string,
|
||||
base: KnowledgeBase,
|
||||
): Promise<{ uuid: string }> {
|
||||
return this.put(`/api/v1/knowledge/bases/${uuid}`, base);
|
||||
}
|
||||
|
||||
public uploadKnowledgeBaseFile(
|
||||
uuid: string,
|
||||
file_id: string,
|
||||
@@ -485,6 +500,13 @@ class HttpClient {
|
||||
return this.delete(`/api/v1/knowledge/bases/${uuid}`);
|
||||
}
|
||||
|
||||
public retrieveKnowledgeBase(
|
||||
uuid: string,
|
||||
query: string,
|
||||
): Promise<ApiRespKnowledgeBaseRetrieve> {
|
||||
return this.post(`/api/v1/knowledge/bases/${uuid}/retrieve`, { query });
|
||||
}
|
||||
|
||||
// ============ Plugins API ============
|
||||
public getPlugins(): Promise<ApiRespPlugins> {
|
||||
return this.get('/api/v1/plugins');
|
||||
|
||||
Reference in New Issue
Block a user