fix: do not get the backend when local path blur
This commit is contained in:
@@ -113,7 +113,7 @@ export default {
|
|||||||
'models.form.moreparameters': 'Parameter Description',
|
'models.form.moreparameters': 'Parameter Description',
|
||||||
'models.table.vram.allocated': 'Allocated VRAM',
|
'models.table.vram.allocated': 'Allocated VRAM',
|
||||||
'models.form.backend.warning':
|
'models.form.backend.warning':
|
||||||
'The backend for GGUF format models uses llama-box.',
|
'The backend for .gguf format models uses llama-box.',
|
||||||
'models.form.backend.warning.llamabox':
|
'models.form.backend.warning.llamabox':
|
||||||
'Llama-box only supports GGUF format models. If your model files were downloaded from Ollama, you can ignore this warning.'
|
'Llama-box only supports .gguf format models. If your model files were downloaded from Ollama, you can ignore this warning.'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -108,7 +108,7 @@ export default {
|
|||||||
'models.form.releases': '版本',
|
'models.form.releases': '版本',
|
||||||
'models.form.moreparameters': '参数说明',
|
'models.form.moreparameters': '参数说明',
|
||||||
'models.table.vram.allocated': '分配显存',
|
'models.table.vram.allocated': '分配显存',
|
||||||
'models.form.backend.warning': 'GGUF 格式模型后端用 llama-box。',
|
'models.form.backend.warning': '.gguf 格式模型后端用 llama-box。',
|
||||||
'models.form.backend.warning.llamabox':
|
'models.form.backend.warning.llamabox':
|
||||||
'llama-box 仅支持 GGUF 格式模型,如果您的模型是从 Ollama 下载的模型文件,忽略此警告。'
|
'llama-box 仅支持 .gguf 格式模型,如果您的模型是从 Ollama 下载的模型文件,忽略此警告。'
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -79,10 +79,11 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateShowWarning = () => {
|
const updateShowWarning = (backend: string) => {
|
||||||
const backend = form.current?.getFieldValue?.('backend');
|
|
||||||
const localPath = form.current?.getFieldValue?.('local_path');
|
const localPath = form.current?.getFieldValue?.('local_path');
|
||||||
|
|
||||||
|
console.log('upateShowWarning', backend, localPath);
|
||||||
|
|
||||||
if (source !== modelSourceMap.local_path_value || !localPath) {
|
if (source !== modelSourceMap.local_path_value || !localPath) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -116,7 +117,7 @@ const AddModal: React.FC<AddModalProps> = (props) => {
|
|||||||
if (backend === backendOptionsMap.llamaBox) {
|
if (backend === backendOptionsMap.llamaBox) {
|
||||||
setIsGGUF(true);
|
setIsGGUF(true);
|
||||||
}
|
}
|
||||||
updateShowWarning();
|
updateShowWarning(backend);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleCancel = useCallback(() => {
|
const handleCancel = useCallback(() => {
|
||||||
|
|||||||
@@ -95,8 +95,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const updateShowWarning = () => {
|
const updateShowWarning = (backend: string) => {
|
||||||
const backend = form.getFieldValue?.('backend');
|
|
||||||
const localPath = form.getFieldValue?.('local_path');
|
const localPath = form.getFieldValue?.('local_path');
|
||||||
|
|
||||||
if (formData?.source !== modelSourceMap.local_path_value || !localPath) {
|
if (formData?.source !== modelSourceMap.local_path_value || !localPath) {
|
||||||
@@ -133,7 +132,7 @@ const UpdateModal: React.FC<AddModalProps> = (props) => {
|
|||||||
}
|
}
|
||||||
form.setFieldValue('backend_version', '');
|
form.setFieldValue('backend_version', '');
|
||||||
handleSetGPUIds(val);
|
handleSetGPUIds(val);
|
||||||
updateShowWarning();
|
updateShowWarning(backend);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleOnFocus = () => {
|
const handleOnFocus = () => {
|
||||||
|
|||||||
@@ -176,21 +176,26 @@ const Models: React.FC = () => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const createModelsChunkRequest = useCallback(async () => {
|
const createModelsChunkRequest = useCallback(
|
||||||
chunkRequedtRef.current?.current?.cancel?.();
|
async (params?: { search: string; categories: any[] }) => {
|
||||||
try {
|
const search = params?.search || queryParams.search;
|
||||||
const query = {
|
const categories = params?.categories || queryParams.categories;
|
||||||
search: queryParams.search,
|
chunkRequedtRef.current?.current?.cancel?.();
|
||||||
categories: queryParams.categories
|
try {
|
||||||
};
|
const query = {
|
||||||
chunkRequedtRef.current = setChunkRequest({
|
search: search,
|
||||||
url: `${MODELS_API}?${qs.stringify(_.pickBy(query, (val: any) => !!val))}`,
|
categories: categories
|
||||||
handler: updateHandler
|
};
|
||||||
});
|
chunkRequedtRef.current = setChunkRequest({
|
||||||
} catch (error) {
|
url: `${MODELS_API}?${qs.stringify(_.pickBy(query, (val: any) => !!val))}`,
|
||||||
// ignore
|
handler: updateHandler
|
||||||
}
|
});
|
||||||
}, [queryParams.categories, queryParams.search]);
|
} catch (error) {
|
||||||
|
// ignore
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[queryParams.categories, queryParams.search]
|
||||||
|
);
|
||||||
|
|
||||||
const createModelsInstanceChunkRequest = useCallback(async () => {
|
const createModelsInstanceChunkRequest = useCallback(async () => {
|
||||||
chunkInstanceRequedtRef.current?.current?.cancel?.();
|
chunkInstanceRequedtRef.current?.current?.cancel?.();
|
||||||
@@ -241,6 +246,10 @@ const Models: React.FC = () => {
|
|||||||
search: e.target.value
|
search: e.target.value
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
createModelsChunkRequest({
|
||||||
|
search: e.target.value,
|
||||||
|
categories: queryParams.categories
|
||||||
|
});
|
||||||
}, 350);
|
}, 350);
|
||||||
|
|
||||||
const handleNameChange = useCallback(debounceUpdateFilter, [queryParams]);
|
const handleNameChange = useCallback(debounceUpdateFilter, [queryParams]);
|
||||||
@@ -259,6 +268,10 @@ const Models: React.FC = () => {
|
|||||||
categories: value
|
categories: value
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
createModelsChunkRequest({
|
||||||
|
search: queryParams.search,
|
||||||
|
categories: value
|
||||||
|
});
|
||||||
},
|
},
|
||||||
[queryParams]
|
[queryParams]
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user