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.table.vram.allocated': 'Allocated VRAM',
|
||||
'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':
|
||||
'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.moreparameters': '参数说明',
|
||||
'models.table.vram.allocated': '分配显存',
|
||||
'models.form.backend.warning': 'GGUF 格式模型后端用 llama-box。',
|
||||
'models.form.backend.warning': '.gguf 格式模型后端用 llama-box。',
|
||||
'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 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 = () => {
|
||||
|
||||
@@ -176,21 +176,26 @@ const Models: React.FC = () => {
|
||||
});
|
||||
};
|
||||
|
||||
const createModelsChunkRequest = useCallback(async () => {
|
||||
chunkRequedtRef.current?.current?.cancel?.();
|
||||
try {
|
||||
const query = {
|
||||
search: queryParams.search,
|
||||
categories: queryParams.categories
|
||||
};
|
||||
chunkRequedtRef.current = setChunkRequest({
|
||||
url: `${MODELS_API}?${qs.stringify(_.pickBy(query, (val: any) => !!val))}`,
|
||||
handler: updateHandler
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
}, [queryParams.categories, queryParams.search]);
|
||||
const createModelsChunkRequest = useCallback(
|
||||
async (params?: { search: string; categories: any[] }) => {
|
||||
const search = params?.search || queryParams.search;
|
||||
const categories = params?.categories || queryParams.categories;
|
||||
chunkRequedtRef.current?.current?.cancel?.();
|
||||
try {
|
||||
const query = {
|
||||
search: search,
|
||||
categories: categories
|
||||
};
|
||||
chunkRequedtRef.current = setChunkRequest({
|
||||
url: `${MODELS_API}?${qs.stringify(_.pickBy(query, (val: any) => !!val))}`,
|
||||
handler: updateHandler
|
||||
});
|
||||
} catch (error) {
|
||||
// ignore
|
||||
}
|
||||
},
|
||||
[queryParams.categories, queryParams.search]
|
||||
);
|
||||
|
||||
const createModelsInstanceChunkRequest = useCallback(async () => {
|
||||
chunkInstanceRequedtRef.current?.current?.cancel?.();
|
||||
@@ -241,6 +246,10 @@ const Models: React.FC = () => {
|
||||
search: e.target.value
|
||||
}
|
||||
});
|
||||
createModelsChunkRequest({
|
||||
search: e.target.value,
|
||||
categories: queryParams.categories
|
||||
});
|
||||
}, 350);
|
||||
|
||||
const handleNameChange = useCallback(debounceUpdateFilter, [queryParams]);
|
||||
@@ -259,6 +268,10 @@ const Models: React.FC = () => {
|
||||
categories: value
|
||||
}
|
||||
});
|
||||
createModelsChunkRequest({
|
||||
search: queryParams.search,
|
||||
categories: value
|
||||
});
|
||||
},
|
||||
[queryParams]
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user