fix: auto expand the fields group
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import SealInput from '@/components/seal-form/seal-input';
|
||||
import SealSelect from '@/components/seal-form/seal-select';
|
||||
import { modelNameReg } from '@/config';
|
||||
import useAppUtils from '@/hooks/use-app-utils';
|
||||
import {
|
||||
ClusterStatusLabelMap,
|
||||
@@ -65,10 +66,15 @@ const BasicForm: React.FC<BasicFormProps> = (props) => {
|
||||
{
|
||||
required: true,
|
||||
message: getRuleMessage('input', 'common.table.name')
|
||||
},
|
||||
{
|
||||
pattern: modelNameReg,
|
||||
message: intl.formatMessage({ id: 'models.form.rules.name' })
|
||||
}
|
||||
]}
|
||||
>
|
||||
<SealInput.Input
|
||||
description={intl.formatMessage({ id: 'models.form.rules.name' })}
|
||||
label={intl.formatMessage({
|
||||
id: 'common.table.name'
|
||||
})}
|
||||
|
||||
@@ -30,12 +30,10 @@ import BasicForm from './basic';
|
||||
import Performance from './performance';
|
||||
import ScheduleTypeForm from './schedule-type';
|
||||
|
||||
const advancedRequiredFields = [
|
||||
'gpu_selector',
|
||||
'backend',
|
||||
'image_name',
|
||||
'run_command'
|
||||
];
|
||||
const advancedRequiredFields = ['backend', 'image_name', 'run_command'];
|
||||
|
||||
const scheduleRequiredFields = ['gpu_selector'];
|
||||
|
||||
const performanceRequiredFields = ['speculative_config'];
|
||||
|
||||
const SegmentedInner = styled(Segmented)`
|
||||
@@ -281,6 +279,14 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
performanceRequiredFields.includes(name)
|
||||
);
|
||||
|
||||
const isScheduleRequired = names.some((name: string) =>
|
||||
scheduleRequiredFields.includes(name)
|
||||
);
|
||||
|
||||
if (isScheduleRequired) {
|
||||
collapseKeys.push('scheduling');
|
||||
}
|
||||
|
||||
if (isPerformanceRequired) {
|
||||
collapseKeys.push('performance');
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ const SpeculativeDecode = () => {
|
||||
const onValuesChangeDebounced = _.debounce(() => {
|
||||
const allValues = form.getFieldsValue();
|
||||
onValuesChange?.({}, allValues);
|
||||
}, 200);
|
||||
}, 150);
|
||||
|
||||
const handleSpeculativeEnabledChange = (e: any) => {
|
||||
if (e.target.checked) {
|
||||
@@ -57,8 +57,8 @@ const SpeculativeDecode = () => {
|
||||
});
|
||||
} else {
|
||||
speculativeConfigRef.current = form.getFieldValue('speculative_config');
|
||||
onValuesChangeDebounced();
|
||||
}
|
||||
onValuesChangeDebounced();
|
||||
};
|
||||
|
||||
const handleAlgorithemChange = (value: string) => {
|
||||
|
||||
Reference in New Issue
Block a user