diff --git a/react-ui/src/components/ParameterSelect/config.tsx b/react-ui/src/components/ParameterSelect/config.tsx index 757e2a11..2548f44c 100644 --- a/react-ui/src/components/ParameterSelect/config.tsx +++ b/react-ui/src/components/ParameterSelect/config.tsx @@ -1,7 +1,10 @@ +import { ServiceData } from '@/pages/ModelDeployment/types'; import { getDatasetList, getModelList } from '@/services/dataset/index.js'; +import { getServiceListReq } from '@/services/modelDeployment'; import { getComputingResourceReq } from '@/services/pipeline'; import { ComputingResource } from '@/types'; import { type SelectProps } from 'antd'; +import { pick } from 'lodash'; // 过滤资源规格 const filterResourceStandard: SelectProps['filterOption'] = ( @@ -62,6 +65,25 @@ export const paramSelectConfig: Record = { }, optionFilterProp: 'name', }, + service: { + getOptions: async () => { + const res = await getServiceListReq({ + page: 0, + size: 1000, + }); + return ( + res?.data?.content?.map((item: ServiceData) => ({ + label: item.service_name, + value: JSON.stringify(pick(item, ['id', 'service_name'])), + })) ?? [] + ); + }, + fieldNames: { + label: 'label', + value: 'value', + }, + optionFilterProp: 'label', + }, resource: { getOptions: async () => { const res = await getComputingResourceReq({ diff --git a/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx b/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx index 60ac8fe8..56aeb333 100644 --- a/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx +++ b/react-ui/src/pages/ModelDeployment/CreateVersion/index.tsx @@ -24,7 +24,7 @@ import SessionStorage from '@/utils/sessionStorage'; import { modalConfirm } from '@/utils/ui'; import { PlusOutlined } from '@ant-design/icons'; import { useNavigate, useParams } from '@umijs/max'; -import { App, Button, Col, Flex, Form, Input, Row, Select } from 'antd'; +import { App, Button, Col, Flex, Form, Input, InputNumber, Row, Select } from 'antd'; import { omit, pick } from 'lodash'; import { useEffect, useState } from 'react'; import { @@ -120,11 +120,11 @@ function CreateServiceVersion() { // 创建版本 const createServiceVersion = async (formData: FormData) => { - const envList = formData['env_variables'] ?? []; + const envList = formData['env_variables']; const image = formData['image']; const model = formData['model']; const codeConfig = formData['code_config']; - const envVariables = envList.reduce((acc, cur) => { + const envVariables = envList?.reduce((acc, cur) => { acc[cur.key] = cur.value; return acc; }, {} as Record); @@ -139,9 +139,11 @@ function CreateServiceVersion() { pick(model, ['id', 'name', 'version', 'path', 'identifier', 'owner', 'showValue']), { showValue: 'show_value' }, ), - code_config: changePropertyName(pick(codeConfig, ['code_path', 'branch', 'showValue']), { - showValue: 'show_value', - }), + code_config: codeConfig + ? changePropertyName(pick(codeConfig, ['code_path', 'branch', 'showValue']), { + showValue: 'show_value', + }) + : undefined, service_id: serviceInfo?.id, }; @@ -334,17 +336,7 @@ function CreateServiceVersion() { - + - +