fix: validate gpu_selector value before check
This commit is contained in:
@@ -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 (
|
||||||
|
|||||||
@@ -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;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user