chore: show existing when add file

This commit is contained in:
jialin
2025-10-23 11:52:49 +08:00
parent cc0580301e
commit a815e71bfe
25 changed files with 256 additions and 97 deletions
+10 -10
View File
@@ -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());
}
};