fix: validate gpu_selector value before check

This commit is contained in:
jialin
2025-04-07 20:04:40 +08:00
parent 3843d1bd3e
commit 529a2ecd81
3 changed files with 8 additions and 6 deletions
@@ -191,9 +191,6 @@ const AdvanceConfig: React.FC<AdvanceConfigProps> = (props) => {
}; };
const handleGpuSelectorChange = (value: any[] | string) => { const handleGpuSelectorChange = (value: any[] | string) => {
if (!value?.length || !value) {
return;
}
onValuesChange?.({}, form.getFieldsValue()); onValuesChange?.({}, form.getFieldsValue());
}; };
@@ -27,9 +27,6 @@ const OllamaForm: React.FC = () => {
}; };
const handleOnBlur = (e: any) => { const handleOnBlur = (e: any) => {
if (!e.target.value) {
return;
}
onValuesChange?.({}, formInstance.getFieldsValue()); onValuesChange?.({}, formInstance.getFieldsValue());
}; };
return ( return (
+8
View File
@@ -428,6 +428,13 @@ export const useCheckCompatibility = () => {
}; };
const checkRequiredValue = (allValues: any) => { const checkRequiredValue = (allValues: any) => {
const { scheduleType } = allValues;
const gpuIds = allValues.gpu_selector?.gpu_ids || [];
if (scheduleType === 'manual') {
return !gpuIds.length;
}
const noLocalValue = const noLocalValue =
allValues.source === modelSourceMap.local_path_value && allValues.source === modelSourceMap.local_path_value &&
!allValues.local_path; !allValues.local_path;
@@ -435,6 +442,7 @@ export const useCheckCompatibility = () => {
const noOllamaValue = const noOllamaValue =
allValues.source === modelSourceMap.ollama_library_value && allValues.source === modelSourceMap.ollama_library_value &&
!allValues.ollama_library_model_name; !allValues.ollama_library_model_name;
return noLocalValue || noOllamaValue; return noLocalValue || noOllamaValue;
}; };