fix: do not get the backend when local path blur

This commit is contained in:
jialin
2025-03-12 17:41:38 +08:00
parent a7170a4eee
commit fc0899d9d3
5 changed files with 38 additions and 25 deletions
@@ -79,10 +79,11 @@ const AddModal: React.FC<AddModalProps> = (props) => {
}
};
const updateShowWarning = () => {
const backend = form.current?.getFieldValue?.('backend');
const updateShowWarning = (backend: string) => {
const localPath = form.current?.getFieldValue?.('local_path');
console.log('upateShowWarning', backend, localPath);
if (source !== modelSourceMap.local_path_value || !localPath) {
return;
}
@@ -116,7 +117,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
if (backend === backendOptionsMap.llamaBox) {
setIsGGUF(true);
}
updateShowWarning();
updateShowWarning(backend);
};
const handleCancel = useCallback(() => {
@@ -95,8 +95,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
}
};
const updateShowWarning = () => {
const backend = form.getFieldValue?.('backend');
const updateShowWarning = (backend: string) => {
const localPath = form.getFieldValue?.('local_path');
if (formData?.source !== modelSourceMap.local_path_value || !localPath) {
@@ -133,7 +132,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
}
form.setFieldValue('backend_version', '');
handleSetGPUIds(val);
updateShowWarning();
updateShowWarning(backend);
};
const handleOnFocus = () => {