chore: show existing when add file
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { PageAction } from '@/config';
|
||||
import { PageActionType } from '@/config/types';
|
||||
import CollapsePanel from '@/pages/_components/collapse-panel';
|
||||
import { useIntl } from '@umijs/max';
|
||||
@@ -122,22 +123,21 @@ const DataForm: React.FC<DataFormProps> = forwardRef((props, ref) => {
|
||||
|
||||
const SegmentedTop = useMemo(() => {
|
||||
if (
|
||||
[
|
||||
modelSourceMap.huggingface_value,
|
||||
modelSourceMap.modelscope_value
|
||||
].includes(source) &&
|
||||
formKey === deployFormKeyMap.deployment
|
||||
modelSourceMap.local_path_value === source ||
|
||||
action === PageAction.EDIT ||
|
||||
formKey === deployFormKeyMap.catalog
|
||||
) {
|
||||
return {
|
||||
top: 50,
|
||||
offsetTop: 146
|
||||
top: 0,
|
||||
offsetTop: 96
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
top: 0,
|
||||
offsetTop: 96
|
||||
top: 50,
|
||||
offsetTop: 146
|
||||
};
|
||||
}, [source, formKey]);
|
||||
}, [source, formKey, action]);
|
||||
|
||||
const handleSumit = () => {
|
||||
form.submit();
|
||||
|
||||
@@ -98,7 +98,6 @@ const LocalPathForm: React.FC = () => {
|
||||
<SealInput.Input
|
||||
allowClear
|
||||
required
|
||||
onBlur={handleOnBlur}
|
||||
onFocus={handleOnFocus}
|
||||
label={intl.formatMessage({ id: 'models.form.filePath' })}
|
||||
description={<TooltipList list={localPathTipsList}></TooltipList>}
|
||||
|
||||
@@ -94,6 +94,14 @@ const ScheduleTypeForm: React.FC = () => {
|
||||
const handleOnStepReplica = (value: number | null) => {
|
||||
if (value === null) {
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], 1);
|
||||
return;
|
||||
}
|
||||
|
||||
const isPowerOfTwo = (n: number) => (n & (n - 1)) === 0 && n !== 0; // check power of two
|
||||
if (!isPowerOfTwo(value)) {
|
||||
const newValue = Math.pow(2, Math.round(Math.log2(value)));
|
||||
form.setFieldValue(['gpu_selector', 'gpus_per_replica'], newValue);
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user