feat: 模型管理相关接口完成联调

develop2
donghao 11 months ago
parent 7a37d4db6e
commit cff535675c

@ -0,0 +1,9 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-31 14:46:59
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-31 14:47:08
* @FilePath: \general-ai-platform-web\config\defaultApi.ts
* @Description: api
*/
export const fileApiActionUrl = '/api/v1/file/upload';

@ -58,7 +58,7 @@ export const mockGetBusinessProjectData = {
contactWay: '17755551234', // 联系方式
validity_period: '2016-01-01 ~ 2099-12-31',
remark:
'南京苏胜天信息科技有限公司成立于2016年拥有专业计算机视觉和深度学习方面的技术团队,助力制造业工业检测实现智能化,实现企业降本增效。公司核心技术是机器视觉算法,致力于自动化成套视觉检测设备。 ',
'南京苏胜天信息科技有限公司成立于2016年拥有专业计算机视觉和机器学习方面的技术团队,助力制造业工业检测实现智能化,实现企业降本增效。公司核心技术是机器视觉算法,致力于自动化成套视觉检测设备。 ',
},
{
id: '4',
@ -118,7 +118,7 @@ export const mockGetBusinessAlgorithmData = {
{
id: '1',
name: '气泡缺陷检测', // 公司名称
typeName: '经典算法', // 算法类型 经典算法 深度学习
typeName: '经典算法', // 算法类型 经典算法 机器学习
version: '1.6.25', // 版本
industry: 1003,
industryName: '食品、饮料、医疗卫生', // 公司所属行业
@ -129,7 +129,7 @@ export const mockGetBusinessAlgorithmData = {
{
id: '2',
name: '未带安全帽识别', // 公司名称
typeName: '深度学习', // 算法类型 经典算法 深度学习
typeName: '机器学习', // 算法类型 经典算法 机器学习
version: '3.1.09', // 版本
industry: 1004,
industryName: '通用', // 公司所属行业
@ -140,7 +140,7 @@ export const mockGetBusinessAlgorithmData = {
{
id: '3',
name: '元器件(插件)混料检测', // 公司名称
typeName: '经典算法', // 算法类型 经典算法 深度学习
typeName: '经典算法', // 算法类型 经典算法 机器学习
version: '2.4.18', // 版本
industry: 1005,
industryName: '手机、电子、SMT', // 公司所属行业
@ -151,7 +151,7 @@ export const mockGetBusinessAlgorithmData = {
{
id: '4',
name: '中心孔缺陷检测', // 公司名称
typeName: '深度学习', // 算法类型 经典算法 深度学习
typeName: '机器学习', // 算法类型 经典算法 机器学习
version: '1.0.89', // 版本
industry: 1006,
industryName: '锂电池', // 公司所属行业
@ -162,7 +162,7 @@ export const mockGetBusinessAlgorithmData = {
{
id: '5',
name: '确定最佳剪切线位置', // 公司名称
typeName: '经典算法', // 算法类型 经典算法 深度学习
typeName: '经典算法', // 算法类型 经典算法 机器学习
version: '2.2.55', // 版本
industry: 1007,
industryName: '钢铁、冶金、铸造', // 公司所属行业

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-25 15:45:31
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-04-29 14:44:39
* @LastEditTime: 2024-05-31 14:28:44
* @FilePath: \general-ai-platform-web\mock\pools\deviceGroupData.ts
* @Description: ,`customMade`, koroFileHeader : https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
*/
@ -304,7 +304,6 @@ export const mockGetDeviceGroupListData = {
managerName: '刘芳',
managerPhone: '16526365632',
remark: '--',
// TODO 完成设备节点列表数据的构建
},
{
level: 1,

File diff suppressed because it is too large Load Diff

@ -1,7 +1,6 @@
.app_page_wrap {
height: calc(100vh);
padding: 0;
/* TODO 替换整体页面背景图 */
}
.app_page_wrap .ant-pro-layout .ant-pro-layout-content {
position: relative;

@ -230,7 +230,7 @@ const csrfAndJwtHeaderInterceptor = (url: string, options: RequestConfig) => {
let bearerToken = {};
const access = localStorage.getItem('access');
if (access) {
bearerToken = { 'X-Token': `${access}` };
bearerToken = { token: `${access}` };
}
let locale = getLocale();
return {

@ -36,7 +36,6 @@ const IsBatchDelete: React.FC<IsBatchDeleteProps> = (props) => {
okText: intl.formatMessage({ id: 'common.yes', defaultMessage: '$$$' }),
cancelText: intl.formatMessage({ id: 'common.no', defaultMessage: '$$$' }),
onOk() {
// TODO 未对接批量删除接口
props.deleteApi();
},
onCancel() {

@ -35,7 +35,6 @@ const tagInputStyle: React.CSSProperties = {
verticalAlign: 'top',
};
// TODO 整体样式需要按UI图调整 交互在确认时要把tags赋值给form
const CategorizeUpdate: React.FC<CategorizeUpdateProps> = (props) => {
const [form] = Form.useForm<Record<string, any>>();
const [tags, setTags] = useState<string[]>([]);

@ -24,7 +24,7 @@
}
.base_tree_wrap .tree_node_0 {
width: 100%;
margin: 12px 0;
margin: 8px 0;
padding: 8px 17px;
background: #f5f5f5;
border-radius: 4px;

@ -22,7 +22,7 @@
.tree_node_0 {
width: 100%;
margin: 12px 0;
margin: 8px 0;
padding: 8px 17px;
background: #f5f5f5;
border-radius: 4px;

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-10 17:21:34
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-14 17:05:30
* @LastEditTime: 2024-05-31 13:40:48
* @FilePath: \general-ai-manage\src\locales\zh-CN\model.ts
* @Description:
*/
@ -24,7 +24,9 @@ export const model_index: { [key: string]: string } = {
'model_index.table.list.setIndustry': '行业类别设置',
'model_index.table.list.update': '更新模型',
'model_index.table.list.detail': '详情配置',
'model_index.create.form.add': '新建模型',
'model_index.form.action.add': '新建模型',
'model_index.form.action.edit': '编辑模型',
'model_index.create.form.name': '模型名称',
'model_index.create.form.rule.required.name': '请填写模型名称',
'model_index.create.form.type': '模型分类',

@ -327,7 +327,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
data: { path: `models/${Date.now()}` },
headers: {
'X-CSRFToken': cookie.load('csrftoken'),
Authorization: `Bearer ${localStorage.getItem('access') || ''}`,
token: `Bearer ${localStorage.getItem('access') || ''}`,
},
}}
/>

@ -61,7 +61,6 @@ const CreateDeviceForm: React.FC<CreateDeviceFormProps> = (props) => {
submitTimeout={2000}
onFinish={async (values) => {
console.log(values, 'add_finish_values');
// TODO 对接新增接口
let resp = await apiEntityNodesDeviceAdd({
...values,
entity_id: props.commInfo.id,

@ -1,8 +1,8 @@
import { apiFileDelete, apiFileUpload } from '@/services/business/file';
import {
ProForm,
ProFormInstance,
ProFormList,
ProFormSelect,
ProFormText,
ProFormTextArea,
ProFormUploadDragger,
@ -21,22 +21,13 @@ import {
} from '../../../../../config/defaultForm';
// import {beforeUploadFile} from "@/utils/common";
// @ts-ignore
import cookie from 'react-cookies';
export type FormValueType = {
target?: string;
template?: string;
type?: string;
time?: string;
frequency?: string;
} & Partial<API.ModelVersion>;
import { fileApiActionUrl } from '../../../../../config/defaultApi';
export type CreateFormProps = {
createModalOpen: boolean;
handleModal: () => void;
values: Partial<API.ModelVersion>;
modelInfo: Record<string, any>;
reload: any;
currentDefaultFieldsData?: Record<string, any>;
};
const waitTime = (time: number = 100) => {
return new Promise((resolve) => {
@ -56,18 +47,21 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
>();
const intl = useIntl();
const [isHasModelFkId, setIsHasModelFkId] = useState<boolean>(false);
const [dataFormList] = useState<any>([]);
const dataFormListRef = useRef(dataFormList);
const [fileList, setFileList] = useState<UploadFile<any>[]>([]);
// const [projectFileList, setProjectFileList] = useState<UploadFile<any>[]>([]);
const [configFileList, setConfigFileList] = useState<UploadFile<any>[]>([]);
// const [form] = Form.useForm<Record<string, any>>();
// const [form] = Form.useForm<API.ModelVersion>();
const [current, setCurrent] = useState(0);
const formRef = useRef<ProFormInstance>();
const [filePath, setFilePath] = useState('');
const formBaseRef = useRef<ProFormInstance>();
const formProjectFileRef = useRef<ProFormInstance>();
// const [filePath, setFilePath] = useState('');
const handleFileChange = ({ file }: { file: UploadFile }) => {
console.log(configFileList, 'handleFileChange_configFileList');
let curFile: any;
switch (file.status) {
@ -75,30 +69,32 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
case 'done':
curFile = [file];
break;
case 'removed':
default:
curFile = [];
break;
}
setFileList([...curFile]);
setConfigFileList([...curFile]);
};
// test 测试数据
useEffect(() => {
if (props.currentDefaultFieldsData) {
// 如果是在模型详情新增版本ModelFkId不可编辑
console.log(props.values, isHasModelFkId, 'currentDefaultFieldsData');
setIsHasModelFkId(true);
} else {
setIsHasModelFkId(false);
}
}, []);
// if (formBaseRef) {
formBaseRef.current?.setFieldsValue({
version: '0.0.91', // 设备分类的suid
comment:
'测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注',
});
// }
}, [props.createModalOpen]);
return (
<StepsForm<{
name: string;
}>
onFinish={async (values) => {
console.log('All form values:', values);
console.log('All form values:', values, { model_id: props.modelInfo?.model_id });
// 在这里处理提交数据例如调用API
message.success('提交成功');
}}
@ -120,8 +116,8 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
width={proFormSmallModelWidth}
onCancel={() => {
setCurrent(0);
formRef.current?.resetFields();
setFileList([]);
formBaseRef.current?.resetFields();
// setProjectFileList([]);
props.handleModal();
}}
open={props.createModalOpen}
@ -139,7 +135,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
}>
className="gn_form"
name="base"
formRef={formRef}
formRef={formBaseRef}
title={
<FormattedMessage id="model_detail.version.stepForm.base" defaultMessage="版本信息" />
}
@ -152,29 +148,21 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
),
}}
onFinish={async () => {
// setFormData(formRef.current?.getFieldsValue());
// setFormData(formBaseRef.current?.getFieldsValue());
await waitTime(500);
return true;
}}
>
<ProForm.Group>
{/* //TODO 默认填充模型 无需选择 */}
<ProFormSelect
{/* 默认填充模型 无需选择 */}
<ProFormText
width={proFormSmallItemStyleProps.width}
name="modelFkId"
name="model_name"
label={
<FormattedMessage id="model_detail.version.form.modelFkId" defaultMessage="$$$" />
}
placeholder={`${intl.formatMessage({
id: 'common.please_select',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'model_detail.version.form.modelFkId',
defaultMessage: '$$$',
})}`}
required={true}
// initialValue={props.values.modelFkId}
showSearch
initialValue={props.modelInfo?.name}
debounceTime={1000}
disabled={true}
// request={async (keyWord) => {
@ -194,7 +182,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
fieldProps={{
prefix: <span>V</span>,
}}
name="name"
name="version"
label={<FormattedMessage id="model_detail.version.form.name" defaultMessage="版本号" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
@ -218,7 +206,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
/>
<ProFormTextArea
width={proFormSmallItemStyleProps.width}
name="remark"
name="comment"
label={<FormattedMessage id="model_detail.version.form.remark" defaultMessage="备注" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
@ -236,6 +224,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
<StepsForm.StepForm<{
project_file: string;
}>
formRef={formProjectFileRef}
className="gn_form"
name="project_file"
title={
@ -254,10 +243,11 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
),
}}
onFinish={async (values: any) => {
if ('projectFilePath' in values && values['projectFilePath'].length > 0) {
let projectFilePath = values['projectFilePath'][0]?.response?.data?.path || '';
setFilePath(projectFilePath);
}
console.log(values, 'values');
// if ('projectFilePath' in values && values['projectFilePath'].length > 0) {
// let projectFilePath = values['projectFilePath'][0]?.response?.data?.path || '';
// setFilePath(projectFilePath);
// }
return true;
}}
>
@ -271,8 +261,45 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
}
description=""
icon={<i className="iconfont icon-shangchuanwenjian text_primary text-[32px]"></i>}
name="projectFilePath"
action="/api/v1/file/uploadFile"
name="model_file_name"
// action={fileApiActionUrl}
onRemove={async (file) => {
// 这里可以添加删除文件的接口调用逻辑
// await deleteFileFromServer(file);
// setFileList((prevList) => {
// const newList = prevList.filter((item) => item.uid !== file.uid);
// return newList;
// });
const currFileId = formProjectFileRef?.current?.getFieldValue('model_file');
const resp = await apiFileDelete({ file_md5: currFileId });
console.log(resp, 'apiFileDelete_resp', file);
message.success('文件已删除');
return true; // 确保文件从文件列表中移除
}}
onChange={async ({ file, fileList }) => {
// 检查文件状态
console.log(
file,
fileList,
'onChange_ProjectFile',
formProjectFileRef?.current?.getFieldValue('model_file'),
);
if (file.status === 'removed') {
// 删除文件
// setProjectFileList(fileList.filter((item) => item.uid !== file.uid));
// const currFileId = formProjectFileRef?.current?.getFieldValue('model_file')
// const resp = await apiFileDelete({file_md5: currFileId})
// console.log(resp,'apiFileDelete_resp')
// message.success(`${file.name} 删除成功`);
} else {
// 处理上传
// formProjectFileRef?.current?.setFieldValue('model_file_name', [file]);
// handleUpload(file);
}
// setProjectFileList(fileList);
}}
max={1}
fieldProps={{
className: 'gn_proFormUploadDragger_formItem',
@ -281,8 +308,17 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
data: { path: `models/${Date.now()}` },
headers: {
'X-CSRFToken': cookie.load('csrftoken'),
Authorization: `Bearer ${localStorage.getItem('access') || ''}`,
// 'X-CSRFToken': cookie.load('csrftoken'),
// Authorization: `Bearer ${localStorage.getItem('access') || ''}`,
},
beforeUpload: async (file) => {
const formData = new FormData();
formData.append('file', file);
const resp = await apiFileUpload(formData);
formProjectFileRef?.current?.setFieldValue('model_file', resp?.data?.result);
console.log(resp, 'apiFileUpload_resp');
// form.setFieldValue('logo', base64);
return false; // 阻止自动上传
},
}}
/>
@ -306,14 +342,15 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
),
}}
onFinish={async (values: any) => {
setFileList([]);
let formData = formRef.current?.getFieldsValue();
if (formData?.modelFkId) {
// setConfigFileList([]);
console.log(values, 'config_values');
let formData1 = formBaseRef.current?.getFieldsValue();
if (formData1?.model_name) {
await waitTime(500);
formData.modelConfig = { params: values?.params || [] };
if (filePath) {
formData.path = filePath;
}
// formData1.modelConfig = { params: values?.params || [] };
// if (filePath) {
// formData1.path = filePath;
// }
// postModelVersionCreateModelVersion(formData)
// .then(() => {
// message.success(
@ -342,8 +379,8 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
}
description=""
icon={<i className="iconfont icon-shangchuanwenjian text_primary text-[32px]"></i>}
value={fileList}
name="dragger"
name="config_file"
action={fileApiActionUrl}
fieldProps={{
className: 'gn_proFormUploadDragger_formItem',
onChange: handleFileChange,
@ -397,7 +434,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
{/* // TODO label字重与上面统一, 操作按钮需要与输入框对齐 */}
<ProFormList
name="config_str"
name="config_str_arr"
label={
<div>
<span className="font-bold"></span>

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-08 10:36:06
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-21 09:17:25
* @LastEditTime: 2024-05-31 14:38:28
* @FilePath: \general-ai-manage\src\pages\Model\ModelDetail\index.tsx
* @Description:
* @
@ -14,7 +14,8 @@ import InnerPageBack from '@/components/Back/innerPageBack';
import { CommButton } from '@/components/Button';
import TableActionCard from '@/components/TableActionCard';
import IsDelete from '@/components/TableActionCard/isDelete';
import { getModelDetail, getModelVersionList } from '@/services/testApi/model';
import { apiModelInfo, apiModelVersionList } from '@/services/business/model';
import { isSuccessApi } from '@/utils/forApi';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProDescriptions, ProTable } from '@ant-design/pro-components';
@ -35,7 +36,7 @@ const ModelDetail: React.FC = () => {
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
// const [currentRow, setCurrentRow] = useState<Record<string, any>>({});
const [modelInfo, setModelInfo] = useState<Record<string, any>>({});
/**
* @en-US The pop-up window of the distribution update window
* @zh-CN
@ -67,16 +68,16 @@ const ModelDetail: React.FC = () => {
title: (
<FormattedMessage id="model_index.table.list.defaultVersionFkId" defaultMessage="$$$" />
),
dataIndex: 'defaultVersionFkId',
dataIndex: 'default_version',
},
{
title: <FormattedMessage id="model_index.table.list.updateTime" defaultMessage="$$$" />,
dataIndex: 'updateTime',
dataIndex: 'update_time',
valueType: 'dateTime',
},
{
title: <FormattedMessage id="model_index.table.list.remark" defaultMessage="$$$" />,
dataIndex: 'remark',
dataIndex: 'comment',
},
];
const columns: ProColumns<Record<string, any>>[] = [
@ -227,9 +228,13 @@ const ModelDetail: React.FC = () => {
columns={ModelDetailColumns}
request={async () => {
console.log(routeParams, 'id');
const resp = await getModelDetail({
const resp = await apiModelInfo({
id: Number(routeParams.id),
});
if (!isSuccessApi(resp)) {
return { data: {}, success: true };
}
setModelInfo({ ...resp.data, model_id: Number(routeParams.id) });
// postModelVersionGetModelVersionList({modelFkId: 3})
console.log('model_detail_resp', resp);
return {
@ -299,8 +304,12 @@ const ModelDetail: React.FC = () => {
const reqParams = {
pageNo: current,
...rest,
model_id: Number(routeParams.id),
};
let resp = await getModelVersionList({ ...reqParams });
let resp = await apiModelVersionList({ ...reqParams });
if (!isSuccessApi(resp)) {
return { data: [], success: true };
}
console.log(resp, 'getModelVersionList_resp');
return {
data: resp.data?.data,
@ -319,6 +328,7 @@ const ModelDetail: React.FC = () => {
<CreateForm
createModalOpen={createModalOpen}
handleModal={handleCreateModal}
modelInfo={modelInfo}
reload={reloadList}
/>
</div>

@ -1,5 +1,5 @@
// import { postModelCategoryCreateModelCategory } from '@/services/resource/ModelCategory';
import { getDictIndustry } from '@/services/testApi/dict';
import { apiModelAdd, apiModelClassificationList } from '@/services/business/model';
import { isSuccessApi } from '@/utils/forApi';
import {
ModalForm,
ProForm,
@ -9,36 +9,40 @@ import {
ProFormTextArea,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Form } from 'antd';
import React from 'react';
import { Form, message } from 'antd';
import React, { useEffect } from 'react';
import {
proFormSmallItemStyleProps,
proFormSmallModelWidth,
} from '../../../../../config/defaultForm';
// @ts-ignore
export type FormValueType = {
target?: string;
template?: string;
type?: string;
time?: string;
frequency?: string;
} & Partial<Record<string, any>>;
export type CreateFormProps = {
createModalOpen: boolean;
handleModal: () => void;
reload: any;
};
const CreateForm: React.FC<CreateFormProps> = (props) => {
const intl = useIntl();
const [form] = Form.useForm<Record<string, any>>();
// test 测试数据
useEffect(() => {
if (props.createModalOpen) {
form.setFieldsValue({
name: '晶圆检测工艺00',
classification: 11, // 设备分类的suid
model_type: 1001,
comment:
'测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注测试一下备注',
});
}
}, [props.createModalOpen]);
return (
<ModalForm<Record<string, any>>
className="gn_form gn_modal_form"
width={proFormSmallModelWidth}
title={intl.formatMessage({
id: 'model_index.create.form.add',
id: 'model_index.form.action.add',
defaultMessage: '新建',
})}
open={props.createModalOpen}
@ -51,15 +55,21 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
submitTimeout={2000}
onFinish={async (values) => {
console.log(values, 'add_finish_values');
// TODO 对接新增接口
// postModelCategoryCreateModelCategory(values)
// .then(() => {
// message.success(intl.formatMessage({ id: 'common.action.success', defaultMessage: '$$$' }));
// props.reload();
// })
// .catch(() => {
// message.error(intl.formatMessage({ id: 'common.action.failure', defaultMessage: '$$$' }));
// });
let resp = await apiModelAdd({
...values,
});
if (isSuccessApi(resp)) {
message.success(
intl.formatMessage({ id: 'common.action.success', defaultMessage: '$$$' }),
);
props.reload();
props.handleModal();
} else {
message.error(
resp?.meta?.message ||
intl.formatMessage({ id: 'common.action.failure', defaultMessage: '$$$' }),
);
}
props.handleModal();
return true;
}}
@ -89,17 +99,19 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
},
]}
/>
{/* //TODO 按UI效果调整模型分类 */}
<ProFormRadio.Group
name="type"
name="model_type"
label={<FormattedMessage id="model_index.create.form.type" defaultMessage="分类" />}
radioType="button"
options={['经典算法', '深度学习']}
options={[
{ label: '经典算法', value: 1001 },
{ label: '机器学习', value: 1002 },
]}
required={true}
/>
<ProFormSelect
width={proFormSmallItemStyleProps.width}
name="industry"
name="classification"
label={<FormattedMessage id="model_index.create.form.industry" defaultMessage="行业" />}
placeholder={`${intl.formatMessage({
id: 'common.please_select',
@ -112,7 +124,8 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
showSearch
debounceTime={500}
request={async () => {
const { data } = await getDictIndustry();
const { data } = await apiModelClassificationList();
console.log(data, 'apiModelClassificationList_data');
return data?.data?.map((v: Record<string, any>) => {
return { ...v, label: v.name, value: v.id };
});
@ -131,7 +144,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
/>
<ProFormTextArea
width={proFormSmallItemStyleProps.width}
name="remark"
name="comment"
label={<FormattedMessage id="model_index.create.form.remark" defaultMessage="简介" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',

@ -0,0 +1,164 @@
import { apiModelClassificationList, apiModelEdit } from '@/services/business/model';
import { isSuccessApi } from '@/utils/forApi';
import {
ModalForm,
ProForm,
ProFormRadio,
ProFormSelect,
ProFormText,
ProFormTextArea,
} from '@ant-design/pro-components';
import { FormattedMessage, useIntl } from '@umijs/max';
import { Form, message } from 'antd';
import React, { useEffect } from 'react';
import {
proFormSmallItemStyleProps,
proFormSmallModelWidth,
} from '../../../../../config/defaultForm';
export type UpdateFormProps = {
updateModalOpen: boolean;
values: Record<string, any>;
handleModal: () => void;
reload: any;
};
const UpdateForm: React.FC<UpdateFormProps> = (props) => {
const intl = useIntl();
const [form] = Form.useForm<Record<string, any>>();
function resetForm() {
form.resetFields();
}
useEffect(() => {
if (props.updateModalOpen && props.values?.id) {
form.setFieldsValue({ ...props.values, classification: props.values?.classification_id });
console.log(props.values, 'useEffect_values');
} else {
resetForm();
}
}, [props.updateModalOpen, props.values]);
return (
<ModalForm<Record<string, any>>
className="gn_form gn_modal_form"
width={proFormSmallModelWidth}
title={intl.formatMessage({
id: 'model_index.form.action.edit',
defaultMessage: '编辑',
})}
open={props.updateModalOpen}
form={form}
autoFocusFirstInput
modalProps={{
destroyOnClose: true,
onCancel: () => props.handleModal(),
}}
submitTimeout={2000}
onFinish={async (values) => {
console.log(values, 'add_finish_values');
let resp = await apiModelEdit({
...values,
id: props.values?.id,
});
if (isSuccessApi(resp)) {
message.success(
intl.formatMessage({ id: 'common.action.success', defaultMessage: '$$$' }),
);
props.reload();
props.handleModal();
} else {
message.error(
resp?.meta?.message ||
intl.formatMessage({ id: 'common.action.failure', defaultMessage: '$$$' }),
);
}
props.handleModal();
return true;
}}
>
<ProForm.Group>
<ProFormText
width={proFormSmallItemStyleProps.width}
name="name"
label={<FormattedMessage id="model_index.create.form.name" defaultMessage="名称" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'model_index.create.form.name',
defaultMessage: '$$$',
})}`}
required={true}
rules={[
{
required: true,
message: (
<FormattedMessage
id="model_index.create.form.rule.required.name"
defaultMessage="name is required"
/>
),
},
]}
/>
<ProFormRadio.Group
name="model_type"
label={<FormattedMessage id="model_index.create.form.type" defaultMessage="分类" />}
radioType="button"
options={[
{ label: '经典算法', value: 1001 },
{ label: '机器学习', value: 1002 },
]}
required={true}
/>
<ProFormSelect
width={proFormSmallItemStyleProps.width}
name="classification"
label={<FormattedMessage id="model_index.create.form.industry" defaultMessage="行业" />}
placeholder={`${intl.formatMessage({
id: 'common.please_select',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'model_index.create.form.industry',
defaultMessage: '$$$',
})}`}
required={true}
showSearch
debounceTime={500}
request={async () => {
const { data } = await apiModelClassificationList();
console.log(data, 'apiModelClassificationList_data');
return data?.data?.map((v: Record<string, any>) => {
return { ...v, label: v.name, value: v.id };
});
}}
rules={[
{
required: true,
message: (
<FormattedMessage
id="model_index.create.form.rule.required.industry"
defaultMessage="name is required"
/>
),
},
]}
/>
<ProFormTextArea
width={proFormSmallItemStyleProps.width}
name="comment"
label={<FormattedMessage id="model_index.create.form.remark" defaultMessage="简介" />}
placeholder={`${intl.formatMessage({
id: 'common.please_input',
defaultMessage: '$$$',
})}${intl.formatMessage({
id: 'model_index.create.form.remark',
defaultMessage: '$$$',
})}`}
required={false}
disabled={false}
/>
</ProForm.Group>
</ModalForm>
);
};
export default UpdateForm;

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-07 14:02:00
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-30 16:39:17
* @LastEditTime: 2024-05-31 14:36:33
* @FilePath: \general-ai-manage\src\pages\ModelIndex\ModelIndex.tsx
* @Description:
* @
@ -17,11 +17,13 @@ import CategorizeUpdate from '@/components/CategorizeUpdate';
import TableActionCard from '@/components/TableActionCard';
import IsDelete from '@/components/TableActionCard/isDelete';
import {
apiBasemodelClassificationAdd,
apiBasemodelClassificationDelete,
apiBasemodelClassificationList,
apiBasemodelList,
} from '@/services/business/basemodel';
apiModelClassificationAdd,
apiModelClassificationDelete,
apiModelClassificationList,
apiModelDelete,
apiModelInfo,
apiModelList,
} from '@/services/business/model';
import { isSuccessApi } from '@/utils/forApi';
import { ReactComponent as ResetIcon } from '/public/home/reset_icon.svg';
import { ReactComponent as SearchIcon } from '/public/home/search_icon.svg';
@ -30,10 +32,11 @@ import { SearchOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProForm, ProFormText, ProTable } from '@ant-design/pro-components';
import { Access, FormattedMessage, history, useAccess, useIntl } from '@umijs/max';
import { Button } from 'antd';
import { Button, message } from 'antd';
import React, { useEffect, useRef, useState } from 'react';
import { proTableCommonOptions, proTablePaginationOptions } from '../../../../config/defaultTable';
import CreateForm from './components/createForm';
import UpdateForm from './components/updateForm';
import './index.less';
const ModelIndex: React.FC = () => {
@ -43,27 +46,40 @@ const ModelIndex: React.FC = () => {
const actionRef = useRef<ActionType>();
const [querysData, setQuerysData] = useState<Record<string, any>>({}); // 列表查询参数
const [createModalOpen, setCreateModalOpen] = useState<boolean>(false);
const [updateModalOpen, setUpdateModalOpen] = useState<boolean>(false);
const [currentRow, setCurrentRow] = useState<Record<string, any>>({});
// 设置分类
const [industryOpen, setIndustryOpen] = useState<boolean>(false);
// const [categoryFkIdIds, setCategoryFkIdIds] = useState([]);
// 动态设置每页数量
const [currentPageSize, setCurrentPageSize] = useState<number>(10);
// const [currentRow, setCurrentRow] = useState<Record<string,any>>({});
const [form] = ProForm.useForm(); // form 对象
/**新增 设置行业分类 删除 */
// 新增
const handleCreateModal = () => {
setCreateModalOpen(!createModalOpen);
};
// 编辑
const handleUpdateModal = () => {
setUpdateModalOpen(!updateModalOpen);
};
// 设置行业分类
const handleSetIndustry = () => {
setIndustryOpen(!industryOpen);
};
/**
* @en-US The pop-up window of the distribution update window
* @zh-CN
* */
// const [updateModalOpen, setUpdateModalOpen] = useState<boolean>(false);
// 模型信息
async function loadDetail(record) {
const resp = await apiModelInfo({ id: record?.id });
if (isSuccessApi(resp) && resp?.data) {
setCurrentRow({ ...resp?.data, id: record?.id });
}
}
function reloadList() {
actionRef.current?.reload();
}
// const [showDetail, setShowDetail] = useState<boolean>(false);
const columns: ProColumns<Record<string, any>>[] = [
{
@ -75,12 +91,12 @@ const ModelIndex: React.FC = () => {
},
{
title: <FormattedMessage id="model_index.table.list.type" defaultMessage="$$$" />,
dataIndex: 'type',
dataIndex: 'model_type',
hideInSearch: true,
render: (dom, record) => {
let activeName = 'active_primary';
switch (record.type) {
case '深度学习':
switch (record.model_type) {
case '机器学习':
activeName = 'active3';
break;
default:
@ -97,23 +113,29 @@ const ModelIndex: React.FC = () => {
},
{
title: <FormattedMessage id="model_index.table.list.industry" defaultMessage="$$$" />,
dataIndex: 'industry',
dataIndex: 'classification_name',
hideInSearch: true,
},
{
title: (
<FormattedMessage id="model_index.table.list.defaultVersionFkId" defaultMessage="$$$" />
),
dataIndex: 'defaultVersionFkId',
dataIndex: 'default_version',
hideInSearch: true,
},
{
title: <FormattedMessage id="model_index.table.list.updateTime" defaultMessage="$$$" />,
dataIndex: 'updateTime',
dataIndex: 'update_time',
sorter: true,
hideInSearch: true,
valueType: 'dateTime',
render: (dom, record) => {
if (record.update_time === 'None') {
return '-';
}
return dom;
},
},
{
@ -142,29 +164,37 @@ const ModelIndex: React.FC = () => {
</Button>
),
},
// {
// key: 'update',
// renderDom: (
// <Button
// key="update"
// type="link"
// size="small"
// onClick={() => {
// setUpdateModalOpen(true);
// setCurrentRow(record);
// }}
// >
// <FormattedMessage id="pages.searchTable.update" defaultMessage="Update" />
// </Button>
// ),
// },
{
key: 'update',
renderDom: (
<Button
key="update"
type="link"
size="small"
onClick={() => {
loadDetail(record);
setUpdateModalOpen(true);
}}
>
<FormattedMessage id="pages.searchTable.update" defaultMessage="Update" />
</Button>
),
},
{
key: 'destroy',
renderDom: (
<IsDelete
deleteApi={() => {
// TODO 调用删除接口
// handleDestroy(record).then(() => {});
console.log('删除成功');
apiModelDelete({ id: record.id }).then(() => {
message.success(
intl.formatMessage({
id: 'common.action.success',
defaultMessage: '$$$',
}),
);
reloadList();
});
}}
></IsDelete>
),
@ -175,9 +205,6 @@ const ModelIndex: React.FC = () => {
},
];
function reloadList() {
actionRef.current?.reload();
}
// 筛选查询
useEffect(() => {
if (actionRef) {
@ -269,6 +296,7 @@ const ModelIndex: React.FC = () => {
</Access>
}
>
{/* // TODO 需要控制表格溢出滚动高度 */}
<ProTable
className="gn_pro_table"
cardProps={{
@ -310,7 +338,10 @@ const ModelIndex: React.FC = () => {
let sort_select = sort[reqParams.orderKey];
reqParams.desc = sort_select === 'descend';
}
let resp = await apiBasemodelList({ ...reqParams, ...querysData });
let resp = await apiModelList({ ...reqParams, ...querysData });
if (!isSuccessApi(resp)) {
return { data: [], success: true };
}
return {
data: resp.data.data,
success: resp.success,
@ -327,24 +358,30 @@ const ModelIndex: React.FC = () => {
handleModal={handleCreateModal}
reload={reloadList}
/>
<UpdateForm
updateModalOpen={updateModalOpen}
handleModal={handleUpdateModal}
values={currentRow}
reload={reloadList}
/>
<CategorizeUpdate
visible={industryOpen}
handleModal={handleSetIndustry}
values={{ industry: [{ name: '', value: '' }] }}
apiRequest={async () => {
let resp = await apiBasemodelClassificationList();
let resp = await apiModelClassificationList();
return {
data: resp.data,
};
}}
beforeCloseRequest={async (params, successRes) => {
let resp = await apiBasemodelClassificationDelete({ id: params.id });
let resp = await apiModelClassificationDelete({ id: params.id });
if (isSuccessApi(resp)) {
successRes(resp);
}
}}
beforeAddRequest={async (params, successRes) => {
let resp = await apiBasemodelClassificationAdd({ name: params });
let resp = await apiModelClassificationAdd({ name: params });
if (isSuccessApi(resp)) {
successRes(resp);
}

@ -1,5 +1,5 @@
import { CommButton } from '@/components/Button';
import { getModelRuntimeLibFilesList } from '@/services/testApi/model';
import { apiModelHubSync } from '@/services/business/model';
import {
ModalForm,
ProForm,
@ -15,19 +15,10 @@ import {
proFormSmallItemStyleProps,
proFormSmallModelWidth,
} from '../../../../../config/defaultForm';
// @ts-ignore
export type FormValueType = {
target?: string;
template?: string;
type?: string;
time?: string;
frequency?: string;
} & Partial<API.ModelCategory>;
export type CreateFormProps = {
createModalOpen: boolean;
handleModal: () => void;
values: Partial<API.ModelCategory>;
reload: any;
};
const CreateForm: React.FC<CreateFormProps> = (props) => {
@ -188,7 +179,7 @@ const CreateForm: React.FC<CreateFormProps> = (props) => {
showSearch
debounceTime={500}
request={async () => {
const { data } = await getModelRuntimeLibFilesList();
const { data } = await apiModelHubSync();
return data?.data?.map((v: Record<string, any>) => {
return { ...v, label: v.name, value: v.id };
});

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-04-08 10:36:06
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-17 16:21:21
* @LastEditTime: 2024-05-31 14:20:31
* @FilePath: \general-ai-manage\src\pages\Model\ModelRuntimeLib\index.tsx
* @Description:
* @
@ -10,10 +10,13 @@
* 2.
*
*/
import { apiModelHubList } from '@/services/business/model';
import { isSuccessApi } from '@/utils/forApi';
import { CommButton } from '@/components/Button';
import TableActionCard from '@/components/TableActionCard';
import IsDelete from '@/components/TableActionCard/isDelete';
import { getModelRuntimeLibList } from '@/services/testApi/model';
import { SearchOutlined } from '@ant-design/icons';
import type { ActionType, ProColumns } from '@ant-design/pro-components';
import { ProCard, ProForm, ProFormText, ProTable } from '@ant-design/pro-components';
@ -102,24 +105,6 @@ const ModelRuntimeLib: React.FC = () => {
<TableActionCard
key="TableActionCardRef"
renderActions={[
// {
// key: 'detail',
// renderDom: (
// <Button
// key="detail"
// type="link"
// size="small"
// onClick={() => {
// // setCurrentRow(record);
// history.push('/home/model-detail');
// // doToDetail(record);
// // setShowDetail(true);
// }}
// >
// <FormattedMessage id="pages.searchTable.detail" defaultMessage="Update" />
// </Button>
// ),
// },
{
key: 'update',
renderDom: (
@ -236,6 +221,7 @@ const ModelRuntimeLib: React.FC = () => {
</Access>
}
>
{/* // TODO 需要控制表格溢出滚动高度 */}
<ProTable
className="gn_pro_table"
cardProps={{
@ -277,9 +263,12 @@ const ModelRuntimeLib: React.FC = () => {
let sort_select = sort[reqParams.orderKey];
reqParams.desc = sort_select === 'descend';
}
let resp = await getModelRuntimeLibList({ ...reqParams, ...querysData });
let resp = await apiModelHubList({ ...reqParams, ...querysData });
if (isSuccessApi(resp)) {
return { data: [], success: true };
}
return {
data: resp.data.data,
data: resp.data?.data,
success: resp.success,
total: resp.data.count,
current: current,

@ -48,7 +48,7 @@ const AlgorithmCard: React.FC<AlgorithmCardProps> = ({ info }) => {
className="tag_type"
style={{
background:
info.typeName === '深度学习'
info.typeName === '机器学习'
? 'linear-gradient( 180deg, #FFB21A 0%, #FF9B3E 100%)'
: 'linear-gradient(180deg, #21c7ff 0%, #428cff 100%)',
}}

@ -4,7 +4,6 @@
header {
height: 102px;
background-color: #dfecff;
// TODO 0517 缺少背景图
background-image: url('../../../../public/home/business_line.svg');
background-repeat: no-repeat;
background-position: center center;

@ -187,7 +187,7 @@ const Login: React.FC = () => {
}
};
// TODO 测试使用admin
// TEST 测试使用admin
const [form] = Form.useForm<Record<string, any>>();
useEffect(() => {

@ -1,308 +0,0 @@
/*
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-30 14:44:21
* @FilePath: \general-ai-platform-web\src\services\business\basemodel.ts
* @Description:
*/
// @ts-ignore
/* eslint-disable */
import { request } from '@umijs/max';
/** 基础模型管理 */
// 添加模型分类
export async function apiBasemodelClassificationAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/classification/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型分类列表
export async function apiBasemodelClassificationList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/classification/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型分类
export async function apiBasemodelClassificationDelete(
body: any,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/classification/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 添加模型
export async function apiBasemodelAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型列表
export async function apiBasemodelList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型
export async function apiBasemodelDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型
export async function apiBasemodelEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型信息
export async function apiBasemodelInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
/** 模型版本 */
// 添加模型版本
export async function apiBasemodelVersionAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型版本
export async function apiBasemodelVersionEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型版本列表
export async function apiBasemodelVersionList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型版本信息
export async function apiBasemodelVersionInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 设置模型默认版本
export async function apiBasemodelVersionSetdefault(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/setdefault`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型版本
export async function apiBasemodelVersionDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/version/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
/** 模型运行库 */
// 添加模型运行库
export async function apiBasemodelHubAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/hub/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型运行库
export async function apiBasemodelHubEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/hub/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型运行库列表
export async function apiBasemodelHubList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/hub/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型运行库
export async function apiBasemodelHubDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/hub/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型运行库信息
export async function apiBasemodelHubInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/basemodel/hub/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}

@ -365,12 +365,12 @@ export async function apiEntityNodesDeviceModels(body: any, options?: { [key: st
}
// 企业节点,节点信息 -> 设备列表 -> 基础模型配置 -> 基础模型参数配置
export async function apiEntityNodesDeviceBasemodelCustomConfig(
export async function apiEntityNodesDeviceModelCustomConfig(
body: any,
options?: { [key: string]: any },
) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/enterprise/entity/nodes/device/basemodel/custom/config`,
`/api/v1/enterprise/entity/nodes/device/model/custom/config`,
{
method: 'POST',
headers: {

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-30 14:14:24
* @LastEditTime: 2024-05-31 15:11:29
* @FilePath: \general-ai-platform-web\src\services\business\file.ts
* @Description: api
*/
@ -18,6 +18,7 @@ export async function apiFileUpload(body: any, options?: { [key: string]: any })
{
method: 'POST',
headers: {
'Content-Type': 'multipart/form-data',
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},

@ -2,7 +2,7 @@
* @Author: donghao donghao@supervision.ltd
* @Date: 2024-05-24 17:57:19
* @LastEditors: donghao donghao@supervision.ltd
* @LastEditTime: 2024-05-30 14:58:40
* @LastEditTime: 2024-05-31 14:19:28
* @FilePath: \general-ai-platform-web\src\services\business\model.ts
* @Description: api
*/
@ -88,3 +88,312 @@ export async function apiModelDeploymentInfo(body: any, options?: { [key: string
},
);
}
/** 基础模型管理 */
// 添加模型分类
export async function apiModelClassificationAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/classification/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型分类列表
export async function apiModelClassificationList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/classification/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型分类
export async function apiModelClassificationDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/classification/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 添加模型
export async function apiModelAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型列表
export async function apiModelList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型
export async function apiModelDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型
export async function apiModelEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型信息
export async function apiModelInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
/** 模型版本 */
// 添加模型版本
export async function apiModelVersionAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/version/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型版本
export async function apiModelVersionEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/version/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型版本列表
export async function apiModelVersionList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/version/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型版本信息
export async function apiModelVersionInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/version/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 设置模型默认版本
export async function apiModelVersionSetdefault(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/version/setdefault`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型版本
export async function apiModelVersionDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/version/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
/** 模型运行库 */
// 查询docker registry中的镜像
export async function apiModelHubSync(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/hub/sync`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 添加模型运行库
export async function apiModelHubAdd(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/hub/add`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 编辑模型运行库
export async function apiModelHubEdit(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/hub/edit`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型运行库列表
export async function apiModelHubList(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/hub/list`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 删除模型运行库
export async function apiModelHubDelete(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/hub/delete`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}
// 模型运行库信息
export async function apiModelHubInfo(body: any, options?: { [key: string]: any }) {
return request<API.Response & { data?: API.ENTITY_INDEX_DATA; msg?: string }>(
`/api/v1/model/hub/info`,
{
method: 'POST',
headers: {
// 'Content-Type': 'application/json',
// "Content-Type": "application/x-www-form-urlencoded; charset=UTF-8"
},
data: body,
...(options || {}),
},
);
}

@ -1,5 +1,5 @@
declare namespace API {
/**basemodel api */
/**model api */
/**device api */
@ -19,7 +19,6 @@ declare namespace API {
/**file api */
/**model api */
/**user api */
type LOGIN_DATA = {
expiresAt?: number;

Loading…
Cancel
Save