| @@ -1,261 +0,0 @@ | |||
| import CodeSelect from '@/components/CodeSelect'; | |||
| import ResourceSelect, { | |||
| requiredValidator, | |||
| ResourceSelectorType, | |||
| } from '@/components/ResourceSelect'; | |||
| import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'; | |||
| import { Button, Col, Flex, Form, Input, InputNumber, Radio, Row, Select } from 'antd'; | |||
| import styles from './index.less'; | |||
| type ExecuteConfigDLCProps = { | |||
| disabled?: boolean; | |||
| }; | |||
| function ExecuteConfigDLC({ disabled = false }: ExecuteConfigDLCProps) { | |||
| return ( | |||
| <> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="资源组" | |||
| name="version" | |||
| rules={[ | |||
| { | |||
| required: false, | |||
| message: '请选择资源组', | |||
| }, | |||
| ]} | |||
| > | |||
| <Select | |||
| allowClear | |||
| placeholder="请选择资源组" | |||
| options={[]} | |||
| fieldNames={{ label: 'name', value: 'name' }} | |||
| optionFilterProp="name" | |||
| showSearch | |||
| /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="框架" | |||
| name="version" | |||
| rules={[ | |||
| { | |||
| required: false, | |||
| message: '请选择框架', | |||
| }, | |||
| ]} | |||
| > | |||
| <Select | |||
| allowClear | |||
| placeholder="请选择框架" | |||
| options={[]} | |||
| fieldNames={{ label: 'name', value: 'name' }} | |||
| optionFilterProp="name" | |||
| showSearch | |||
| /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="数据集" | |||
| name="model" | |||
| rules={[ | |||
| { | |||
| validator: requiredValidator, | |||
| message: '请选择数据集', | |||
| }, | |||
| ]} | |||
| required | |||
| > | |||
| <ResourceSelect | |||
| type={ResourceSelectorType.Dataset} | |||
| placeholder="请选择数据集" | |||
| canInput={false} | |||
| size="large" | |||
| /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="代码配置" | |||
| name="code_config" | |||
| rules={[ | |||
| { | |||
| validator: requiredValidator, | |||
| message: '请选择代码配置', | |||
| }, | |||
| ]} | |||
| required | |||
| > | |||
| <CodeSelect | |||
| placeholder="请选择代码配置" | |||
| canInput={false} | |||
| size="large" | |||
| disabled={disabled} | |||
| /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="节点镜像" | |||
| name="image_type" | |||
| rules={[{ required: true, message: '请选择节点镜像' }]} | |||
| tooltip="节点镜像" | |||
| > | |||
| <Radio.Group> | |||
| <Radio value={1}>官方镜像</Radio> | |||
| <Radio value={2}>自定义镜像</Radio> | |||
| <Radio value={3}>镜像地址</Radio> | |||
| </Radio.Group> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item dependencies={['image_type']} noStyle> | |||
| {({ getFieldValue }) => { | |||
| const imageType = getFieldValue('image_type'); | |||
| if (imageType === 1 || imageType === 2) { | |||
| return ( | |||
| <Form.Item name="image_url" label=" " className="image-url"> | |||
| <Select | |||
| allowClear | |||
| placeholder="请选择框架" | |||
| options={[]} | |||
| fieldNames={{ label: 'name', value: 'name' }} | |||
| optionFilterProp="name" | |||
| showSearch | |||
| /> | |||
| </Form.Item> | |||
| ); | |||
| } else { | |||
| return ( | |||
| <Form.Item name="image_url" label=" " className="image-url"> | |||
| <Input placeholder="请输入" disabled={disabled} /> | |||
| </Form.Item> | |||
| ); | |||
| } | |||
| }} | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="节点数量" | |||
| name="replicas" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请输入节点数量', | |||
| }, | |||
| { | |||
| pattern: /^[1-9]\d*$/, | |||
| message: '节点数量必须是正整数', | |||
| }, | |||
| ]} | |||
| > | |||
| <InputNumber placeholder="请输入节点数量" min={1} precision={0} /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item label="高级配置" tooltip="高级配置"> | |||
| <Form.List name="advanced_config"> | |||
| {(fields, { add, remove }) => ( | |||
| <> | |||
| {fields.map(({ key, name, ...restField }, index) => ( | |||
| <Flex key={key} align="center" className={styles['advanced-config']}> | |||
| <Form.Item | |||
| style={{ flex: 1, marginBottom: 0 }} | |||
| {...restField} | |||
| name={[name, 'key']} | |||
| rules={[{ required: true, message: 'Missing first name' }]} | |||
| > | |||
| <Input placeholder="Key" /> | |||
| </Form.Item> | |||
| <span style={{ margin: '0 8px' }}>:</span> | |||
| <Form.Item | |||
| style={{ flex: 1, marginBottom: 0 }} | |||
| {...restField} | |||
| name={[name, 'value']} | |||
| rules={[{ required: true, message: 'Missing last name' }]} | |||
| > | |||
| <Input placeholder="Value" /> | |||
| </Form.Item> | |||
| <div style={{ width: '76px', marginLeft: '18px' }}> | |||
| <Button | |||
| style={{ | |||
| marginRight: '3px', | |||
| }} | |||
| size="middle" | |||
| shape="circle" | |||
| disabled={fields.length === 1} | |||
| type="text" | |||
| onClick={() => remove(name)} | |||
| icon={<MinusCircleOutlined />} | |||
| ></Button> | |||
| {index === fields.length - 1 && ( | |||
| <Button | |||
| size="middle" | |||
| shape="circle" | |||
| type="text" | |||
| onClick={() => add()} | |||
| icon={<PlusCircleOutlined />} | |||
| ></Button> | |||
| )} | |||
| </div> | |||
| </Flex> | |||
| ))} | |||
| {fields.length === 0 && ( | |||
| <Form.Item style={{ marginBottom: 0 }}> | |||
| <Button | |||
| style={{ background: 'white' }} | |||
| type="dashed" | |||
| onClick={() => add()} | |||
| block | |||
| icon={<PlusCircleOutlined />} | |||
| > | |||
| 添加高级配置 | |||
| </Button> | |||
| </Form.Item> | |||
| )} | |||
| </> | |||
| )} | |||
| </Form.List> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="节点启动命令" | |||
| name="mount_path" | |||
| // rules={[ | |||
| // { | |||
| // required: true, | |||
| // message: '请输入节点启动命令', | |||
| // }, | |||
| // ]} | |||
| tooltip="节点启动命令" | |||
| > | |||
| <Input placeholder="请输入节点启动命令" maxLength={64} showCount allowClear /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| </> | |||
| ); | |||
| } | |||
| export default ExecuteConfigDLC; | |||
| @@ -1,82 +0,0 @@ | |||
| import KFIcon from '@/components/KFIcon'; | |||
| import { MinusCircleOutlined, PlusCircleOutlined } from '@ant-design/icons'; | |||
| import { Button, Col, Flex, Form, Input, Row } from 'antd'; | |||
| import styles from './index.less'; | |||
| type ExecuteConfigMCProps = { | |||
| disabled?: boolean; | |||
| }; | |||
| function ExecuteConfigMC({ disabled = false }: ExecuteConfigMCProps) { | |||
| return ( | |||
| <> | |||
| <Form.List name="command"> | |||
| {(fields, { add, remove }) => ( | |||
| <> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="命令" | |||
| style={{ marginBottom: 0, marginTop: '-14px' }} | |||
| tooltip="命令" | |||
| ></Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <div className={styles['command']}> | |||
| <Flex align="center" className={styles['command__header']}> | |||
| <div className={styles['command__header__name']}>Key</div> | |||
| <div className={styles['command__header__command']}>命令</div> | |||
| <div className={styles['command__header__operation']}>操作</div> | |||
| </Flex> | |||
| {fields.map(({ key, name, ...restField }, index) => ( | |||
| <Flex key={key} align="center" className={styles['command__body']}> | |||
| <span className={styles['command__body__name']}>cmd{index + 1}</span> | |||
| <Form.Item | |||
| className={styles['command__body__command']} | |||
| {...restField} | |||
| name={[name, 'command']} | |||
| rules={[{ required: true, message: 'Missing last name' }]} | |||
| > | |||
| <Input.TextArea placeholder="Value" autoSize={{ minRows: 2, maxRows: 3 }} /> | |||
| </Form.Item> | |||
| <div className={styles['command__body__operation']}> | |||
| <Button | |||
| style={{ | |||
| marginRight: '3px', | |||
| }} | |||
| shape="circle" | |||
| disabled={fields.length === 1} | |||
| type="text" | |||
| size="middle" | |||
| onClick={() => remove(name)} | |||
| icon={<MinusCircleOutlined />} | |||
| ></Button> | |||
| {index === fields.length - 1 && ( | |||
| <Button | |||
| shape="circle" | |||
| size="middle" | |||
| type="text" | |||
| onClick={() => add()} | |||
| icon={<PlusCircleOutlined />} | |||
| ></Button> | |||
| )} | |||
| </div> | |||
| </Flex> | |||
| ))} | |||
| {fields.length === 0 && ( | |||
| <div className={styles['hyper-parameter__add']}> | |||
| <Button type="link" onClick={() => add()} icon={<KFIcon type="icon-xinjian2" />}> | |||
| 添加一行 | |||
| </Button> | |||
| </div> | |||
| )} | |||
| </div> | |||
| </> | |||
| )} | |||
| </Form.List> | |||
| </> | |||
| ); | |||
| } | |||
| export default ExecuteConfigMC; | |||
| @@ -1,119 +0,0 @@ | |||
| import SubAreaTitle from '@/components/SubAreaTitle'; | |||
| import { Col, Form, InputNumber, Row, Select, Switch } from 'antd'; | |||
| function SearchConfig() { | |||
| return ( | |||
| <> | |||
| <SubAreaTitle | |||
| title="搜索配置" | |||
| image={require('@/assets/img/search-config-icon.png')} | |||
| style={{ marginTop: '20px', marginBottom: '24px' }} | |||
| ></SubAreaTitle> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="搜索算法" | |||
| name="version" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请选择搜索算法', | |||
| }, | |||
| ]} | |||
| tooltip="搜索算法" | |||
| > | |||
| <Select | |||
| allowClear | |||
| placeholder="请选择搜索算法" | |||
| options={[]} | |||
| fieldNames={{ label: 'name', value: 'name' }} | |||
| optionFilterProp="name" | |||
| showSearch | |||
| /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="最大搜素次数" | |||
| name="replicas" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请输入最大搜素次数', | |||
| }, | |||
| { | |||
| pattern: /^[1-9]\d*$/, | |||
| message: '最大搜素次数必须是正整数', | |||
| }, | |||
| ]} | |||
| tooltip="最大搜素次数" | |||
| > | |||
| <InputNumber placeholder="请输入最大搜素次数" min={1} precision={0} /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="最大并发量" | |||
| name="replicas" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请输入最大并发量', | |||
| }, | |||
| { | |||
| pattern: /^[1-9]\d*$/, | |||
| message: '最大并发量必须是正整数', | |||
| }, | |||
| ]} | |||
| tooltip="最大并发量" | |||
| > | |||
| <InputNumber placeholder="请输入最大并发量" min={1} precision={0} /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="开启EarlyStop" | |||
| name="replicas" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请选择是否开启EarlyStop', | |||
| }, | |||
| ]} | |||
| tooltip="开启EarlyStop" | |||
| > | |||
| <Switch checkedChildren="开启" unCheckedChildren="关闭" defaultChecked /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="Start step" | |||
| name="replicas" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请输入Start step', | |||
| }, | |||
| { | |||
| pattern: /^[1-9]\d*$/, | |||
| message: 'Start step必须是正整数', | |||
| }, | |||
| ]} | |||
| tooltip="Start step" | |||
| > | |||
| <InputNumber placeholder="请输入Start step" min={1} precision={0} /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| </> | |||
| ); | |||
| } | |||
| export default SearchConfig; | |||
| @@ -1,80 +0,0 @@ | |||
| import { getAccessToken } from '@/access'; | |||
| import KFIcon from '@/components/KFIcon'; | |||
| import SubAreaTitle from '@/components/SubAreaTitle'; | |||
| import { getFileListFromEvent } from '@/utils/ui'; | |||
| import { Button, Col, Form, Input, Row, Upload, type UploadProps } from 'antd'; | |||
| import { useState } from 'react'; | |||
| import styles from './index.less'; | |||
| function UploadConfig() { | |||
| const [uuid] = useState(Date.now()); | |||
| // 上传组件参数 | |||
| const uploadProps: UploadProps = { | |||
| action: '/api/mmp/autoML/upload', | |||
| headers: { | |||
| Authorization: getAccessToken() || '', | |||
| }, | |||
| defaultFileList: [], | |||
| }; | |||
| return ( | |||
| <> | |||
| <SubAreaTitle | |||
| title="数据集配置" | |||
| image={require('@/assets/img/search-config-icon.png')} | |||
| style={{ marginTop: '20px', marginBottom: '24px' }} | |||
| ></SubAreaTitle> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item label="数据集名称" name="dataset_name"> | |||
| <Input placeholder="请输入数据集名称" maxLength={64} showCount allowClear /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Row gutter={8}> | |||
| <Col span={10}> | |||
| <Form.Item | |||
| label="预测目标列" | |||
| name="target_columns" | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请输入预测目标列', | |||
| }, | |||
| ]} | |||
| tooltip="数据集 csv 文件中哪几列是预测目标列,逗号分隔" | |||
| > | |||
| <Input placeholder="请输入预测目标列" maxLength={64} showCount allowClear /> | |||
| </Form.Item> | |||
| </Col> | |||
| </Row> | |||
| <Form.Item | |||
| label="数据集文件" | |||
| name="fileList" | |||
| valuePropName="fileList" | |||
| getValueFromEvent={getFileListFromEvent} | |||
| labelCol={{ span: 24 }} | |||
| wrapperCol={{ span: 24 }} | |||
| rules={[ | |||
| { | |||
| required: true, | |||
| message: '请上传数据集文件', | |||
| }, | |||
| ]} | |||
| > | |||
| <Upload {...uploadProps} data={{ uuid: uuid }} accept=".csv"> | |||
| <Button | |||
| className={styles['upload-button']} | |||
| type="default" | |||
| icon={<KFIcon type="icon-shangchuan" />} | |||
| > | |||
| 上传文件 | |||
| </Button> | |||
| <div className={styles['upload-tip']}>只允许上传 .csv 格式文件</div> | |||
| </Upload> | |||
| </Form.Item> | |||
| </> | |||
| ); | |||
| } | |||
| export default UploadConfig; | |||