Browse Source

feat: 创建服务时,模型数据调整

pull/273/head
zhaowei 6 months ago
parent
commit
e59ff1eae3
4 changed files with 25 additions and 9 deletions
  1. +1
    -1
      react-ui/src/pages/Experiment/components/ExperimentParameter/index.tsx
  2. +1
    -3
      react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx
  3. +22
    -4
      react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx
  4. +1
    -1
      react-ui/src/pages/ModelDeployment/types.ts

+ 1
- 1
react-ui/src/pages/Experiment/components/ExperimentParameter/index.tsx View File

@@ -58,7 +58,7 @@ function ExperimentParameter({ nodeData, globalParams }: ExperimentParameterProp
</Flex>
))
) : (
<div className={styles['experiment-parameter__list-empty']}>无参数</div>
<div className={styles['experiment-parameter__list-empty']}>无</div>
)}
</>
)}


+ 1
- 3
react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx View File

@@ -117,7 +117,6 @@ function CreateServiceVersion() {
// 创建版本
const createServiceVersion = async (formData: FormData) => {
const envList = formData['env_variables'];
const model = formData['model'];
const envVariables = envList?.reduce((acc, cur) => {
acc[cur.key] = cur.value;
return acc;
@@ -125,10 +124,9 @@ function CreateServiceVersion() {

// 根据后台要求,修改表单数据
const object = {
...omit(formData, ['replicas', 'env_variables', 'model']),
...omit(formData, ['replicas', 'env_variables']),
replicas: Number(formData.replicas),
env_variables: envVariables,
model: changePropertyName(model, { showValue: 'show_value' }),
service_id: serviceId,
};



+ 22
- 4
react-ui/src/pages/ModelDeployment/ServiceInfo/index.tsx View File

@@ -10,6 +10,7 @@ import SubAreaTitle from '@/components/SubAreaTitle';
import { ServiceRunStatus, serviceStatusOptions } from '@/enums';
import { useCacheState } from '@/hooks/useCacheState';
import { useComputingResource } from '@/hooks/useComputingResource';
import { ModelData } from '@/pages/Dataset/config';
import {
deleteServiceVersionReq,
getServiceInfoReq,
@@ -18,6 +19,7 @@ import {
} from '@/services/modelDeployment';
import themes from '@/styles/theme.less';
import { formatDate } from '@/utils/date';
import { formatModel } from '@/utils/format';
import { openAntdModal } from '@/utils/modal';
import { to } from '@/utils/promise';
import SessionStorage from '@/utils/sessionStorage';
@@ -110,8 +112,8 @@ function ServiceInfo() {
if (res && res.data) {
const { content = [], totalElements = 0 } = res.data;
content.forEach((item: ServiceVersionData) => {
if (item.model && !item.model.show_value) {
item.model.show_value = `${item.model.name}:${item.model.version}`;
if (item.model && !item.model.showValue) {
item.model.showValue = `${item.model.name}:${item.model.version}`;
}
});
setTableData(content);
@@ -258,6 +260,20 @@ function ServiceInfo() {
},
};

// 去模型
const gotoModel = (record: ServiceVersionData, e: React.MouseEvent) => {
e.stopPropagation();

const model = record.model as any as ModelData;
const link = formatModel(model)?.link;
if (link) {
setCacheState({
pagination,
});
navigate(link);
}
};

const columns: TableProps<ServiceVersionData>['columns'] = [
{
title: '序号',
@@ -278,10 +294,12 @@ function ServiceInfo() {
},
{
title: '模型版本',
dataIndex: ['model', 'show_value'],
dataIndex: ['model', 'showValue'],
key: 'model',
width: '20%',
render: tableCellRender(true),
render: tableCellRender(true, TableCellValueType.Link, {
onClick: gotoModel,
}),
},
{
title: '镜像版本',


+ 1
- 1
react-ui/src/pages/ModelDeployment/types.ts View File

@@ -34,7 +34,7 @@ export type ServiceVersionData = {
path: string;
identifier: string;
owner: string;
show_value: string;
showValue: string;
};
code_config: {
// 代码配置


Loading…
Cancel
Save