mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
refac
Co-Authored-By: G30 <50341825+silentoplayz@users.noreply.github.com>
This commit is contained in:
parent
af1db82c7d
commit
5bec4a8005
1 changed files with 5 additions and 3 deletions
|
|
@ -469,11 +469,11 @@
|
|||
if (importFiles.length > 0) {
|
||||
const reader = new FileReader();
|
||||
reader.onload = async (event) => {
|
||||
modelsImportInProgress = true;
|
||||
|
||||
try {
|
||||
const models = JSON.parse(String(event.target.result));
|
||||
modelsImportInProgress = true;
|
||||
const res = await importModels(localStorage.token, models);
|
||||
modelsImportInProgress = false;
|
||||
|
||||
if (res) {
|
||||
toast.success($i18n.t('Models imported successfully'));
|
||||
|
|
@ -482,9 +482,11 @@
|
|||
toast.error($i18n.t('Failed to import models'));
|
||||
}
|
||||
} catch (e) {
|
||||
toast.error($i18n.t('Invalid JSON file'));
|
||||
toast.error(e?.detail ?? $i18n.t('Invalid JSON file'));
|
||||
console.error(e);
|
||||
}
|
||||
|
||||
modelsImportInProgress = false;
|
||||
};
|
||||
reader.readAsText(importFiles[0]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue