From f6a3497b0cc3f0ef2470cdb7008568213f3dff9b Mon Sep 17 00:00:00 2001 From: jialin Date: Fri, 31 Oct 2025 12:24:24 +0800 Subject: [PATCH] fix: do not trigger evaluation replica 0 --- src/pages/llmodels/config/index.ts | 1 - src/pages/llmodels/forms/basic.tsx | 9 -------- src/pages/llmodels/forms/schedule-type.tsx | 27 ---------------------- src/pages/llmodels/hooks/index.ts | 4 +++- 4 files changed, 3 insertions(+), 38 deletions(-) diff --git a/src/pages/llmodels/config/index.ts b/src/pages/llmodels/config/index.ts index 22b27bf4..c6c7285f 100644 --- a/src/pages/llmodels/config/index.ts +++ b/src/pages/llmodels/config/index.ts @@ -331,7 +331,6 @@ export const DO_NOT_TRIGGER_CHECK_COMPATIBILITY = [ 'huggingface_repo_id', 'huggingface_filename', 'model_scope_file_path', - 'replicas', 'name', 'description', 'env', diff --git a/src/pages/llmodels/forms/basic.tsx b/src/pages/llmodels/forms/basic.tsx index 8bb13d6d..f17174f5 100644 --- a/src/pages/llmodels/forms/basic.tsx +++ b/src/pages/llmodels/forms/basic.tsx @@ -9,7 +9,6 @@ import { useIntl } from '@umijs/max'; import { Form } from 'antd'; import { useMemo } from 'react'; import { sourceOptions } from '../config'; -import { useFormContext } from '../config/form-context'; import { FormData } from '../config/types'; import CatalogFrom from './catalog'; import LocalPathSource from './local-path-source'; @@ -35,19 +34,12 @@ const BasicForm: React.FC = (props) => { } = props; const intl = useIntl(); const { getRuleMessage } = useAppUtils(); - const { onValuesChange } = useFormContext(); const form = Form.useFormInstance(); const handleOnSourceChange = (val: string) => { onSourceChange?.(val); }; - const handleReplicasChange = (val: number) => { - if (val > 0) { - onValuesChange?.({}, form.getFieldsValue()); - } - }; - const clusterOptions = useMemo(() => { return clusterList?.map((item) => { return { @@ -134,7 +126,6 @@ const BasicForm: React.FC = (props) => { ]} > { } }; - const handleGpusPerReplicasChange = (val: string | number | null) => { - if (val === null) { - form.setFieldValue(['gpu_selector', 'gpus_per_replica'], -1); - } else { - form.setFieldValue(['gpu_selector', 'gpus_per_replica'], val); - } - - onValuesChange?.({}, form.getFieldsValue()); - }; - const handleGpuSelectorChange = (value: any[]) => { if (value.length > 0) { onValuesChange?.({}, form.getFieldsValue()); @@ -99,23 +89,6 @@ const ScheduleTypeForm: React.FC = () => { } }; - const handleOnStepReplicaStep = ( - value: number | string | null, - info: { offset: number | string | null; type: 'up' | 'down' } - ) => { - let newValue = value; - const isPowerOfTwo = (n: number) => (n & (n - 1)) === 0 && n !== 0; // check power of two - if (!isPowerOfTwo(value as number)) { - if (info.type === 'up') { - newValue = Math.pow(2, Math.ceil(Math.log2(value as number))); - } else { - newValue = Math.pow(2, Math.floor(Math.log2(value as number))); - } - } - form.setFieldValue(['gpu_selector', 'gpus_per_replica'], newValue); - onValuesChange?.({}, form.getFieldsValue()); - }; - const onSelectorChange = (field: string, allowEmpty?: boolean) => { const workerSelector = form.getFieldValue(field); // check if all keys have values diff --git a/src/pages/llmodels/hooks/index.ts b/src/pages/llmodels/hooks/index.ts index f1ee1ea6..4b700c09 100644 --- a/src/pages/llmodels/hooks/index.ts +++ b/src/pages/llmodels/hooks/index.ts @@ -392,9 +392,11 @@ export const useCheckCompatibility = () => { source: string; }) => { const { allValues, source } = params; + console.log('handleOnValuesChange', allValues); if ( _.isEqual(cacheFormValuesRef.current, allValues) || - noLocalPathValue(allValues) + noLocalPathValue(allValues) || + !allValues.replicas ) { console.log('No changes detected, skipping evaluation.'); return;