参数名称
- 参数类型
+
+ 参数类型
+
+
+
+
取值范围
操作
@@ -465,33 +512,25 @@ function ExecuteConfig() {
-
-
-
-
-
-
-
-
-
+
diff --git a/react-ui/src/pages/HyperParameter/components/CreateForm/index.less b/react-ui/src/pages/HyperParameter/components/CreateForm/index.less
index 8f8bae7b..7d945b21 100644
--- a/react-ui/src/pages/HyperParameter/components/CreateForm/index.less
+++ b/react-ui/src/pages/HyperParameter/components/CreateForm/index.less
@@ -48,6 +48,28 @@
content: '*';
margin-inline-end: 4px;
}
+
+ :global {
+ .anticon-question-circle {
+ vertical-align: middle;
+ cursor: help;
+ }
+ }
+ }
+
+ &__tooltip {
+ max-width: 600px;
+ :global {
+ .ant-tooltip-inner {
+ max-height: 400px;
+ overflow-y: auto;
+ white-space: pre-line;
+
+ &::-webkit-scrollbar-thumb {
+ background: rgba(255, 255, 255, 0.5);
+ }
+ }
+ }
}
&__operation {
diff --git a/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx b/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx
index 167cbbe4..4daa2298 100644
--- a/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx
+++ b/react-ui/src/pages/HyperParameter/components/HyperParameterBasic/index.tsx
@@ -1,10 +1,11 @@
import { hyperParameterOptimizedMode } from '@/enums';
-import ConfigInfo, { formatDate, type BasicInfoData } from '@/pages/AutoML/components/ConfigInfo';
+import { useComputingResource } from '@/hooks/resource';
+import ConfigInfo, { type BasicInfoData } from '@/pages/AutoML/components/ConfigInfo';
import { experimentStatusInfo } from '@/pages/Experiment/status';
import { HyperparameterData } from '@/pages/HyperParameter/types';
import { type NodeStatus } from '@/types';
import { elapsedTime } from '@/utils/date';
-import { formatDataset, formatSelectCodeConfig } from '@/utils/format';
+import { formatDataset, formatDate, formatSelectCodeConfig } from '@/utils/format';
import { Flex } from 'antd';
import classNames from 'classnames';
import { useMemo } from 'react';
@@ -29,6 +30,17 @@ function HyperParameterBasic({
runStatus,
isInstance = false,
}: HyperParameterBasicProps) {
+ const getResourceDescription = useComputingResource()[2];
+
+ // 格式化资源规格
+ const formatResource = (resource?: string) => {
+ if (!resource) {
+ return undefined;
+ }
+
+ return getResourceDescription(resource);
+ };
+
const basicDatas: BasicInfoData[] = useMemo(() => {
if (!info) {
return [];
@@ -120,13 +132,9 @@ function HyperParameterBasic({
ellipsis: true,
},
{
- label: 'CPU 数量',
- value: info.cpu,
- ellipsis: true,
- },
- {
- label: 'GPU 数量',
- value: info.gpu,
+ label: '资源规格',
+ value: info.resource,
+ format: formatResource,
ellipsis: true,
},
];
diff --git a/react-ui/src/pages/HyperParameter/types.ts b/react-ui/src/pages/HyperParameter/types.ts
index bb412c09..68f77fb2 100644
--- a/react-ui/src/pages/HyperParameter/types.ts
+++ b/react-ui/src/pages/HyperParameter/types.ts
@@ -23,8 +23,7 @@ export type FormData = {
num_samples: number; // 总实验次数
max_t: number; // 单次试验最大时间
min_samples_required: number; // 计算中位数的最小试验数
- cpu: number; // cpu 数
- gpu: number; // gpu 数
+ resource: string; // 资源规格
parameters: FormParameter[];
points_to_evaluate: { [key: string]: any }[];
};
diff --git a/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx b/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx
index b8de0bcf..38171380 100644
--- a/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx
+++ b/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx
@@ -432,7 +432,14 @@ function CreateServiceVersion() {
{(fields, { add, remove }) => (
<>
{fields.map(({ key, name, ...restField }, index) => (
-
+
@@ -519,7 +527,7 @@ function CreateServiceVersion() {
-
+
diff --git a/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx b/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx
index cce8a1b8..d3eeaff5 100644
--- a/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx
+++ b/react-ui/src/pages/ModelDeployment/VersionInfo/index.tsx
@@ -11,7 +11,7 @@ import { to } from '@/utils/promise';
import { useParams } from '@umijs/max';
import { Tabs, type TabsProps } from 'antd';
import { useEffect, useState } from 'react';
-import BasicInfo from '../components/BasicInfo';
+import VersionBasicInfo from '../components/VersionBasicInfo';
import ServerLog from '../components/ServerLog';
import UserGuide from '../components/UserGuide';
import { ServiceVersionData } from '../types';
@@ -75,7 +75,7 @@ function ServiceVersionInfo() {
image={require('@/assets/img/mirror-basic.png')}
style={{ marginBottom: '26px' }}
>
-
+
diff --git a/react-ui/src/pages/ModelDeployment/components/BasicInfo/index.tsx b/react-ui/src/pages/ModelDeployment/components/BasicInfo/index.tsx
deleted file mode 100644
index 32497e13..00000000
--- a/react-ui/src/pages/ModelDeployment/components/BasicInfo/index.tsx
+++ /dev/null
@@ -1,120 +0,0 @@
-import LabelValue from '@/components/LabelValue';
-import { useComputingResource } from '@/hooks/resource';
-import { ServiceVersionData } from '@/pages/ModelDeployment/types';
-import { getGitUrl } from '@/utils';
-import { formatDate } from '@/utils/date';
-import { Link } from '@umijs/max';
-import { Col, Row } from 'antd';
-import ServiceRunStatusCell from '../ModelDeployStatusCell';
-import styles from './index.less';
-
-type BasicInfoProps = {
- info?: ServiceVersionData;
-};
-
-function BasicInfo({ info }: BasicInfoProps) {
- const getResourceDescription = useComputingResource()[2];
-
- // 格式化环境变量
- const formatEnvText = () => {
- if (!info?.env_variables || Object.keys(info.env_variables).length === 0) {
- return '--';
- }
- const env = info.env_variables;
- return Object.entries(env)
- .map(([key, value]) => `${key}: ${value}`)
- .join('\n');
- };
-
- const formatCodeConfig = () => {
- if (info && info.code_config && info.code_config.code_path) {
- const { code_path, branch } = info.code_config;
- const url = getGitUrl(code_path, branch);
- return (
-
- {info?.code_config?.show_value}
-
- );
- }
- return '--';
- };
-
- const formatResource = () => {
- if (info && info.resource) {
- return getResourceDescription(info.resource);
- }
- return undefined;
- };
-
- const formatModel = () => {
- if (info && info.model) {
- const model = info.model;
- const path = `/dataset/model/info/${model.id}?version=${model.version}&name=${model.name}&owner=${model.owner}&identifier=${model.identifier}`;
- return {info?.model?.show_value};
- }
- return undefined;
- };
-
- return (
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- );
-}
-
-export default BasicInfo;
diff --git a/react-ui/src/pages/ModelDeployment/components/BasicInfo/index.less b/react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.less
similarity index 100%
rename from react-ui/src/pages/ModelDeployment/components/BasicInfo/index.less
rename to react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.less
diff --git a/react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.tsx b/react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.tsx
new file mode 100644
index 00000000..3ddfb0e2
--- /dev/null
+++ b/react-ui/src/pages/ModelDeployment/components/VersionBasicInfo/index.tsx
@@ -0,0 +1,134 @@
+import BasicInfo, { type BasicInfoData } from '@/components/BasicInfo';
+import { ServiceRunStatus } from '@/enums';
+import { useComputingResource } from '@/hooks/resource';
+import { ServiceVersionData } from '@/pages/ModelDeployment/types';
+import { formatDate } from '@/utils/date';
+import { formatModel, formatSelectCodeConfig } from '@/utils/format';
+import { Flex } from 'antd';
+import ModelDeployStatusCell from '../ModelDeployStatusCell';
+
+type BasicInfoProps = {
+ info?: ServiceVersionData;
+};
+
+// 格式化状态
+const formatStatus = (status?: ServiceRunStatus) => {
+ if (!status) {
+ return undefined;
+ }
+
+ return (
+
+ {ModelDeployStatusCell(status)}
+
+ );
+};
+
+// 格式化环境变量
+const formatEnvText = (env?: Record) => {
+ if (!env || Object.keys(env).length === 0) {
+ return undefined;
+ }
+
+ return Object.entries(env).map(([key, value]) => ({
+ value: `${key}: ${value}`,
+ }));
+};
+
+function VersionBasicInfo({ info }: BasicInfoProps) {
+ const getResourceDescription = useComputingResource()[2];
+
+ // 格式化资源规格
+ const formatResource = (resource?: string) => {
+ if (!resource) {
+ return undefined;
+ }
+
+ return getResourceDescription(resource);
+ };
+
+ const datas: BasicInfoData[] = [
+ {
+ label: '服务名称',
+ value: info?.service_name,
+ ellipsis: true,
+ },
+ {
+ label: '版本名称',
+ value: info?.version,
+ ellipsis: true,
+ },
+ {
+ label: '代码配置',
+ value: info?.code_config,
+ format: formatSelectCodeConfig,
+ ellipsis: true,
+ },
+ {
+ label: '镜像',
+ value: info?.image,
+ ellipsis: true,
+ },
+ {
+ label: '状态',
+ value: info?.run_state,
+ format: formatStatus,
+ ellipsis: true,
+ },
+ {
+ label: '模型',
+ value: info?.model,
+ format: formatModel,
+ ellipsis: true,
+ },
+ {
+ label: '资源规格',
+ value: info?.resource,
+ format: formatResource,
+ ellipsis: true,
+ },
+ {
+ label: '挂载路径',
+ value: info?.mount_path,
+ ellipsis: true,
+ },
+ {
+ label: 'API URL',
+ value: info?.url,
+ ellipsis: true,
+ },
+
+ {
+ label: '副本数量',
+ value: info?.replicas,
+ ellipsis: true,
+ },
+ {
+ label: '创建时间',
+ value: info?.create_time,
+ format: formatDate,
+ ellipsis: true,
+ },
+ {
+ label: '更新时间',
+ value: info?.update_time,
+ format: formatDate,
+ ellipsis: true,
+ },
+ {
+ label: '环境变量',
+ value: info?.env_variables,
+ format: formatEnvText,
+ ellipsis: true,
+ },
+ {
+ label: '描述',
+ value: info?.description,
+ ellipsis: true,
+ },
+ ];
+
+ return ;
+}
+
+export default VersionBasicInfo;
diff --git a/react-ui/src/utils/format.ts b/react-ui/src/utils/format.ts
index 579ae103..c7d34e7d 100644
--- a/react-ui/src/utils/format.ts
+++ b/react-ui/src/utils/format.ts
@@ -1,6 +1,14 @@
import { ResourceInfoTabKeys } from '@/pages/Dataset/components/ResourceInfo';
-import { DataSource, DatasetData, ProjectDependency, TrainTask } from '@/pages/Dataset/config';
+import {
+ DataSource,
+ DatasetData,
+ ModelData,
+ ProjectDependency,
+ TrainTask,
+} from '@/pages/Dataset/config';
import { getGitUrl } from '@/utils';
+// 格式化日期
+export { formatDate } from '@/utils/date';
// 格式化数据集数组
export const formatDatasets = (datasets?: DatasetData[]) => {
@@ -9,7 +17,7 @@ export const formatDatasets = (datasets?: DatasetData[]) => {
}
return datasets.map((item) => ({
value: item.name,
- url: `${origin}/dataset/dataset/info/${item.id}?tab=${ResourceInfoTabKeys.Introduction}&version=${item.version}&name=${item.name}&owner=${item.owner}&identifier=${item.identifier}`,
+ link: `/dataset/dataset/info/${item.id}?tab=${ResourceInfoTabKeys.Introduction}&version=${item.version}&name=${item.name}&owner=${item.owner}&identifier=${item.identifier}`,
}));
};
@@ -20,7 +28,19 @@ export const formatDataset = (dataset?: DatasetData) => {
}
return {
value: dataset.name,
- url: `${origin}/dataset/dataset/info/${dataset.id}?tab=${ResourceInfoTabKeys.Introduction}&version=${dataset.version}&name=${dataset.name}&owner=${dataset.owner}&identifier=${dataset.identifier}`,
+ link: `/dataset/dataset/info/${dataset.id}?tab=${ResourceInfoTabKeys.Introduction}&version=${dataset.version}&name=${dataset.name}&owner=${dataset.owner}&identifier=${dataset.identifier}`,
+ };
+};
+
+// 格式化模型
+export const formatModel = (model: ModelData) => {
+ if (!model) {
+ return undefined;
+ }
+
+ return {
+ value: model.name,
+ link: `/dataset/model/info/${model.id}?tab=${ResourceInfoTabKeys.Introduction}&version=${model.version}&name=${model.name}&owner=${model.owner}&identifier=${model.identifier}`,
};
};
@@ -48,14 +68,15 @@ export const formatCodeConfig = (project?: ProjectDependency) => {
export const formatSelectCodeConfig = (value?: {
code_path: string;
branch: string;
- showValue: string;
+ showValue?: string;
+ show_value?: string;
}) => {
if (!value) {
return undefined;
}
- const { showValue, code_path, branch } = value;
+ const { showValue, show_value, code_path, branch } = value;
return {
- value: showValue,
+ value: showValue || show_value,
url: getRepoUrl({
url: code_path,
branch,
@@ -70,7 +91,7 @@ export const formatTrainTask = (task?: TrainTask) => {
}
return {
value: task.name,
- url: `${origin}/pipeline/experiment/instance/${task.workflow_id}/${task.ins_id}`,
+ url: `/pipeline/experiment/instance/${task.workflow_id}/${task.ins_id}`,
};
};
@@ -85,3 +106,31 @@ export const formatSource = (source?: string) => {
}
return source;
};
+
+// 格式化字符串数组
+export const formatList = (value: string[] | null | undefined): string => {
+ if (
+ value === undefined ||
+ value === null ||
+ Array.isArray(value) === false ||
+ value.length === 0
+ ) {
+ return '--';
+ }
+ return value.join(',');
+};
+
+// 格式化布尔值
+export const formatBoolean = (value: boolean): string => {
+ return value ? '是' : '否';
+};
+
+type FormatEnum = (value: string | number) => string;
+
+// 格式化枚举
+export const formatEnum = (options: { value: string | number; label: string }[]): FormatEnum => {
+ return (value: string | number) => {
+ const option = options.find((item) => item.value === value);
+ return option ? option.label : '--';
+ };
+};