mirror of
https://github.com/csunny/DB-GPT.git
synced 2025-09-11 22:09:44 +00:00
refactor: remove unused API functions and update flow utils
This commit is contained in:
@@ -299,7 +299,6 @@ 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);
|
||||
};
|
||||
@@ -312,14 +311,6 @@ 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);
|
||||
};
|
||||
@@ -328,6 +319,15 @@ export const downloadFile = (fileId: string) => {
|
||||
return GET<null, any>(`/api/v2/serve/file/files/dbgpt/${fileId}`);
|
||||
};
|
||||
|
||||
// TODO:wait for interface update
|
||||
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}`);
|
||||
};
|
||||
|
||||
/** app */
|
||||
export const addApp = (data: IApp) => {
|
||||
return POST<IApp, []>('/api/v1/app/create', data);
|
||||
|
@@ -101,8 +101,10 @@ const NodeHandler: React.FC<NodeHandlerProps> = ({ node, data, type, label, inde
|
||||
isValidConnection={(connection) => isValidConnection(connection)}
|
||||
/>
|
||||
<Typography
|
||||
className={classNames('bg-white dark:bg-[#232734] w-full px-2 py-1 rounded text-neutral-500',{
|
||||
className={classNames('bg-white dark:bg-[#232734] w-full py-1 rounded text-neutral-500', {
|
||||
'text-right': label === 'outputs',
|
||||
'pl-2': label === 'inputs',
|
||||
'pr-2': label === 'outputs',
|
||||
})}
|
||||
>
|
||||
<Popconfirm
|
||||
@@ -117,9 +119,10 @@ const NodeHandler: React.FC<NodeHandlerProps> = ({ node, data, type, label, inde
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{['inputs', 'parameters'].includes(label) && <PlusOutlined className="mr-2 cursor-pointer" onClick={showRelatedNodes} />}
|
||||
{['inputs', 'parameters'].includes(label) && <PlusOutlined className="cursor-pointer" onClick={showRelatedNodes} />}
|
||||
</Popconfirm>
|
||||
{data.type_name}:{label !== 'outputs' && <RequiredIcon optional={data.optional} />}
|
||||
{label !== 'outputs' && <RequiredIcon optional={data.optional} />}
|
||||
{data.type_name}
|
||||
{data.description && (
|
||||
<Tooltip title={data.description}>
|
||||
<InfoCircleOutlined className="ml-2 cursor-pointer" />
|
||||
|
@@ -11,6 +11,11 @@ export const getUniqueNodeId = (nodeData: IFlowNode, nodes: Node[]) => {
|
||||
return `${nodeData.id}_${count}`;
|
||||
};
|
||||
|
||||
// function getUniqueNodeId will add '_${count}' to id, so we need to remove it when we want to get the original id
|
||||
export const removeIndexFromNodeId = (id: string) => {
|
||||
const indexPattern = /_\d+$/;
|
||||
return id.replace(indexPattern, '');
|
||||
};
|
||||
|
||||
// 驼峰转下划线,接口协议字段命名规范
|
||||
export const mapHumpToUnderline = (flowData: IFlowData) => {
|
||||
@@ -111,7 +116,7 @@ export const convertKeysToCamelCase = (obj: Record<string, any>): Record<string,
|
||||
|
||||
function convert(obj: any): any {
|
||||
if (Array.isArray(obj)) {
|
||||
return obj.map(item => convert(item));
|
||||
return obj.map((item) => convert(item));
|
||||
} else if (isObject(obj)) {
|
||||
const newObj: Record<string, any> = {};
|
||||
for (const key in obj) {
|
||||
|
Reference in New Issue
Block a user