@lobehub/chat
Version:
Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.
35 lines (26 loc) • 1.13 kB
text/typescript
import { lambdaClient } from '@/libs/trpc/client';
import { SemanticSearchSchemaType } from '@/types/rag';
class RAGService {
parseFileContent = async (id: string, skipExist?: boolean) => {
return lambdaClient.document.parseFileContent.mutate({ id, skipExist });
};
createParseFileTask = async (id: string, skipExist?: boolean) => {
return lambdaClient.chunk.createParseFileTask.mutate({ id, skipExist });
};
retryParseFile = async (id: string) => {
return lambdaClient.chunk.retryParseFileTask.mutate({ id });
};
createEmbeddingChunksTask = async (id: string) => {
return lambdaClient.chunk.createEmbeddingChunksTask.mutate({ id });
};
semanticSearch = async (query: string, fileIds?: string[]) => {
return lambdaClient.chunk.semanticSearch.mutate({ fileIds, query });
};
semanticSearchForChat = async (params: SemanticSearchSchemaType) => {
return lambdaClient.chunk.semanticSearchForChat.mutate(params);
};
deleteMessageRagQuery = async (id: string) => {
return lambdaClient.message.removeMessageQuery.mutate({ id });
};
}
export const ragService = new RAGService();