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) => {
|
||||
if (!value?.length || !value) {
|
||||
return;
|
||||
}
|
||||
onValuesChange?.({}, form.getFieldsValue());
|
||||
};
|
||||
|
||||
|
||||
@@ -27,9 +27,6 @@ const OllamaForm: React.FC = () => {
|
||||
};
|
||||
|
||||
const handleOnBlur = (e: any) => {
|
||||
if (!e.target.value) {
|
||||
return;
|
||||
}
|
||||
onValuesChange?.({}, formInstance.getFieldsValue());
|
||||
};
|
||||
return (
|
||||
|
||||
@@ -428,6 +428,13 @@ export const useCheckCompatibility = () => {
|
||||
};
|
||||
|
||||
const checkRequiredValue = (allValues: any) => {
|
||||
const { scheduleType } = allValues;
|
||||
const gpuIds = allValues.gpu_selector?.gpu_ids || [];
|
||||
|
||||
if (scheduleType === 'manual') {
|
||||
return !gpuIds.length;
|
||||
}
|
||||
|
||||
const noLocalValue =
|
||||
allValues.source === modelSourceMap.local_path_value &&
|
||||
!allValues.local_path;
|
||||
@@ -435,6 +442,7 @@ export const useCheckCompatibility = () => {
|
||||
const noOllamaValue =
|
||||
allValues.source === modelSourceMap.ollama_library_value &&
|
||||
!allValues.ollama_library_model_name;
|
||||
|
||||
return noLocalValue || noOllamaValue;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user