fix: auto expand the fields group
This commit is contained in:
@@ -9,7 +9,11 @@ import _ from 'lodash';
|
||||
import React, { useEffect, useId, useRef, useState } from 'react';
|
||||
import styled from 'styled-components';
|
||||
import ColumnWrapper from '../../_components/column-wrapper';
|
||||
import { backendFields, json2Yaml } from '../config';
|
||||
import {
|
||||
builtInBackendFields,
|
||||
customBackendFields,
|
||||
json2Yaml
|
||||
} from '../config';
|
||||
import { FormData, ListItem } from '../config/types';
|
||||
import BackendForm from '../forms';
|
||||
import ImportYAML from './import-yaml';
|
||||
@@ -151,10 +155,10 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
||||
);
|
||||
|
||||
if (currentData?.is_built_in) {
|
||||
return json2Yaml(_.pick(copyValues, backendFields));
|
||||
return json2Yaml(_.pick(copyValues, builtInBackendFields));
|
||||
}
|
||||
return json2Yaml(
|
||||
_.pick(copyValues, [...backendFields, 'default_version'])
|
||||
_.pick(copyValues, [...customBackendFields, 'default_version'])
|
||||
);
|
||||
};
|
||||
|
||||
|
||||
@@ -109,13 +109,26 @@ export const customIcons = [
|
||||
'≥'
|
||||
];
|
||||
|
||||
export const backendFields = [
|
||||
/**
|
||||
* custom backend fields for config yaml
|
||||
*/
|
||||
export const customBackendFields = [
|
||||
'description',
|
||||
'health_check_path',
|
||||
'default_run_command',
|
||||
'version_configs',
|
||||
'default_backend_param'
|
||||
];
|
||||
|
||||
/**
|
||||
* built-in backend fields for config yaml
|
||||
*/
|
||||
export const builtInBackendFields = [
|
||||
'description',
|
||||
'version_configs',
|
||||
'default_backend_param'
|
||||
];
|
||||
|
||||
export const frameworks = [
|
||||
{
|
||||
label: 'CUDA',
|
||||
|
||||
@@ -37,38 +37,40 @@ const BasicForm: React.FC<AddModalProps> = ({ action, currentData }) => {
|
||||
required
|
||||
></SealInput.Input>
|
||||
</Form.Item>
|
||||
<Form.Item<FormData>
|
||||
name="health_check_path"
|
||||
rules={[{ required: false }]}
|
||||
>
|
||||
<SealInput.Input
|
||||
trim
|
||||
placeholder={intl.formatMessage(
|
||||
{ id: 'common.help.default' },
|
||||
{ content: '/v1/models' }
|
||||
)}
|
||||
label={intl.formatMessage({ id: 'backend.form.healthCheckPath' })}
|
||||
></SealInput.Input>
|
||||
</Form.Item>
|
||||
|
||||
<Form.Item name="default_run_command">
|
||||
<SealTextArea
|
||||
scaleSize={true}
|
||||
alwaysFocus={true}
|
||||
description={intl.formatMessage({
|
||||
id: 'backend.form.defaultExecuteCommand.tips'
|
||||
})}
|
||||
placeholder={intl.formatMessage(
|
||||
{ id: 'common.help.eg' },
|
||||
{ content: 'vllm serve {{model_path}} --port {{port}}' }
|
||||
)}
|
||||
autoSize={{ minRows: 2, maxRows: 4 }}
|
||||
label={intl.formatMessage({
|
||||
id: 'backend.form.defaultExecuteCommand'
|
||||
})}
|
||||
></SealTextArea>
|
||||
</Form.Item>
|
||||
|
||||
{!currentData?.is_built_in && (
|
||||
<>
|
||||
<Form.Item<FormData>
|
||||
name="health_check_path"
|
||||
rules={[{ required: false }]}
|
||||
>
|
||||
<SealInput.Input
|
||||
trim
|
||||
placeholder={intl.formatMessage(
|
||||
{ id: 'common.help.default' },
|
||||
{ content: '/v1/models' }
|
||||
)}
|
||||
label={intl.formatMessage({ id: 'backend.form.healthCheckPath' })}
|
||||
></SealInput.Input>
|
||||
</Form.Item>
|
||||
<Form.Item name="default_run_command">
|
||||
<SealTextArea
|
||||
scaleSize={true}
|
||||
alwaysFocus={true}
|
||||
description={intl.formatMessage({
|
||||
id: 'backend.form.defaultExecuteCommand.tips'
|
||||
})}
|
||||
placeholder={intl.formatMessage(
|
||||
{ id: 'common.help.eg' },
|
||||
{ content: 'vllm serve {{model_path}} --port {{port}}' }
|
||||
)}
|
||||
autoSize={{ minRows: 2, maxRows: 4 }}
|
||||
label={intl.formatMessage({
|
||||
id: 'backend.form.defaultExecuteCommand'
|
||||
})}
|
||||
></SealTextArea>
|
||||
</Form.Item>
|
||||
</>
|
||||
)}
|
||||
<Form.Item<FormData>
|
||||
name="default_backend_param"
|
||||
rules={[{ required: false }]}
|
||||
|
||||
@@ -51,7 +51,6 @@ const BackendForm: React.FC<AddModalProps> = forwardRef(
|
||||
}
|
||||
return item;
|
||||
});
|
||||
|
||||
onFinish(data);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user