mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-11 22:09:44 +00:00
chore: update api (#1851)
This commit is contained in:
@@ -34,8 +34,18 @@ import {
|
||||
SpaceConfig,
|
||||
} from '@/types/knowledge';
|
||||
import { UpdatePromptParams, IPrompt, PromptParams } from '@/types/prompt';
|
||||
import { IFlow, IFlowNode, IFlowResponse, IFlowUpdateParam, IFlowRefreshParams } from '@/types/flow';
|
||||
import { IAgent, IApp, IAppData, ITeamModal } from '@/types/app';
|
||||
import {
|
||||
IFlow,
|
||||
IFlowNode,
|
||||
IFlowResponse,
|
||||
IFlowUpdateParam,
|
||||
IFlowRefreshParams,
|
||||
IFlowExportParams,
|
||||
IFlowImportParams,
|
||||
IUploadFileRequestParams,
|
||||
IUploadFileResponse,
|
||||
} from '@/types/flow';
|
||||
import { IAgent, IApp, IAppData } from '@/types/app';
|
||||
|
||||
/** App */
|
||||
export const postScenes = () => {
|
||||
@@ -289,6 +299,35 @@ export const refreshFlowNodeById = (data: IFlowRefreshParams) => {
|
||||
return POST<IFlowRefreshParams, IFlowNode>('/api/v2/serve/awel/nodes/refresh', data);
|
||||
};
|
||||
|
||||
// TODO: wait for interface update
|
||||
export const debugFlow = (data: any) => {
|
||||
return POST<any, IFlowNode>('/api/v2/serve/awel/flow/debug', data);
|
||||
};
|
||||
|
||||
export const exportFlow = (data: IFlowExportParams) => {
|
||||
return GET<IFlowExportParams, any>('/api/v2/serve/awel/flow/export', data);
|
||||
};
|
||||
|
||||
export const importFlow = (data: IFlowImportParams) => {
|
||||
return POST<IFlowImportParams, any>('/api/v2/serve/awel/flow/import', data);
|
||||
};
|
||||
|
||||
export const getFlowTemplateList = () => {
|
||||
return GET<null, Array<any>>('/api/v2/serve/awel/flow/templates');
|
||||
};
|
||||
|
||||
export const getFlowTemplateById = (id: string) => {
|
||||
return GET<null, any>(`/api/v2/serve/awel/flow/templates/${id}`);
|
||||
};
|
||||
|
||||
export const uploadFile = (data: IUploadFileRequestParams) => {
|
||||
return POST<IUploadFileRequestParams, Array<IUploadFileResponse>>('/api/v2/serve/file/files/dbgpt', data);
|
||||
};
|
||||
|
||||
export const downloadFile = (fileId: string) => {
|
||||
return GET<null, any>(`/api/v2/serve/file/files/dbgpt/${fileId}`);
|
||||
};
|
||||
|
||||
/** app */
|
||||
export const addApp = (data: IApp) => {
|
||||
return POST<IApp, []>('/api/v1/app/create', data);
|
||||
|
@@ -1,3 +1,4 @@
|
||||
import { File } from 'buffer';
|
||||
import { Node } from 'reactflow';
|
||||
|
||||
export type FlowState = 'deployed' | 'developing' | 'initializing' | 'testing' | 'disabled' | 'running' | 'load_failed';
|
||||
@@ -165,3 +166,29 @@ export type IFlowData = {
|
||||
edges: Array<IFlowDataEdge>;
|
||||
viewport: IFlowDataViewport;
|
||||
};
|
||||
|
||||
export type IFlowExportParams = {
|
||||
export_type?: 'json' | 'dbgpts';
|
||||
format?: 'json' | 'file';
|
||||
file_name?: string;
|
||||
user_name?: string;
|
||||
sys_code?: string;
|
||||
};
|
||||
|
||||
export type IFlowImportParams = {
|
||||
file: File;
|
||||
save_flow?: boolean;
|
||||
};
|
||||
|
||||
export type IUploadFileRequestParams = {
|
||||
files: Array<File>;
|
||||
user_name?: string;
|
||||
sys_code?: string;
|
||||
};
|
||||
|
||||
export type IUploadFileResponse = {
|
||||
file_name: string;
|
||||
file_id: string;
|
||||
bucket: string;
|
||||
uri?: string;
|
||||
};
|
||||
|
Reference in New Issue
Block a user