mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-25 19:44:59 +00:00
refactor: RAG Refactor (#985)
Co-authored-by: Aralhi <xiaoping0501@gmail.com> Co-authored-by: csunny <cfqsunny@163.com>
This commit is contained in:
@@ -19,8 +19,11 @@ import {
|
||||
DocumentParams,
|
||||
IArguments,
|
||||
IChunkList,
|
||||
IChunkStrategyResponse,
|
||||
IDocumentResponse,
|
||||
ISpace,
|
||||
ISyncBatchParameter,
|
||||
ISyncBatchResponse,
|
||||
} from '@/types/knowledge';
|
||||
import { UpdatePromptParams, IPrompt, PromptParams } from '@/types/prompt';
|
||||
|
||||
@@ -126,8 +129,8 @@ export const saveArguments = (knowledgeName: string, data: ArgumentsParams) => {
|
||||
export const getSpaceList = () => {
|
||||
return POST<any, Array<ISpace>>('/knowledge/space/list', {});
|
||||
};
|
||||
export const getDocumentList = (knowLedgeName: string, data: Record<string, number>) => {
|
||||
return POST<Record<string, number>, IDocumentResponse>(`/knowledge/${knowLedgeName}/document/list`, data);
|
||||
export const getDocumentList = (spaceName: string, data: Record<string, number | Array<number>>) => {
|
||||
return POST<Record<string, number | Array<number>>, IDocumentResponse>(`/knowledge/${spaceName}/document/list`, data);
|
||||
};
|
||||
|
||||
export const addDocument = (knowledgeName: string, data: DocumentParams) => {
|
||||
@@ -138,10 +141,18 @@ export const addSpace = (data: AddKnowledgeParams) => {
|
||||
return POST<AddKnowledgeParams, Array<any>>(`/knowledge/space/add`, data);
|
||||
};
|
||||
|
||||
export const getChunkStrategies = () => {
|
||||
return GET<null, Array<IChunkStrategyResponse>>('/knowledge/document/chunkstrategies');
|
||||
};
|
||||
|
||||
export const syncDocument = (spaceName: string, data: Record<string, Array<number>>) => {
|
||||
return POST<Record<string, Array<number>>, string | null>(`/knowledge/${spaceName}/document/sync`, data);
|
||||
};
|
||||
|
||||
export const syncBatchDocument = (spaceName: string, data: Array<ISyncBatchParameter>) => {
|
||||
return POST<Array<ISyncBatchParameter>, ISyncBatchResponse>(`/knowledge/${spaceName}/document/sync_batch`, data);
|
||||
};
|
||||
|
||||
export const uploadDocument = (knowLedgeName: string, data: FormData) => {
|
||||
return POST<FormData, number>(`/knowledge/${knowLedgeName}/document/upload`, data);
|
||||
};
|
||||
|
Reference in New Issue
Block a user