fix: check compatiblity after delete selecor

This commit is contained in:
jialin
2025-04-05 10:42:24 +08:00
parent a23f9881ee
commit 9f24e765be
6 changed files with 34 additions and 11 deletions
+13 -9
View File
@@ -79,8 +79,8 @@ const AddModal: FC<AddModalProps> = (props) => {
handleShowCompatibleAlert,
setWarningStatus,
handleBackendChangeBefore,
cancelEvaluate,
handleOnValuesChange,
checkTokenRef,
warningStatus,
submitAnyway
} = useCheckCompatibility();
@@ -182,11 +182,17 @@ const AddModal: FC<AddModalProps> = (props) => {
onCancel?.();
}, [onCancel]);
const handleOnOpen = useCallback(() => {
const handleOnOpen = () => {
console.log('handleOnOpen----------', props.source, props.deploymentType);
if (props.deploymentType === 'modelFiles') {
form.current?.form?.setFieldsValue({
...props.initialValues
});
handleOnValuesChange?.({
changedValues: {},
allValues: props.initialValues,
source: source
});
} else {
const backend =
source === modelSourceMap.ollama_library_value
@@ -194,15 +200,14 @@ const AddModal: FC<AddModalProps> = (props) => {
: backendOptionsMap.vllm;
form.current?.setFieldValue?.('backend', backend);
}
}, [source, props.initialValues, props.deploymentType]);
};
useEffect(() => {
if (!open) {
return;
} else {
if (open) {
handleOnOpen();
} else {
cancelEvaluate();
}
return () => {
setSelectedModel({});
setWarningStatus({
@@ -210,9 +215,8 @@ const AddModal: FC<AddModalProps> = (props) => {
title: '',
message: []
});
checkTokenRef.current?.cancel();
};
}, [open, handleOnOpen]);
}, [open]);
return (
<Drawer