feat: support huggingface snapshot downloader

fixed: An issue where JS did not properly handle model download errors.
fixed: better security message for model downloading
This commit is contained in:
Dr.Lt.Data
2025-02-10 02:24:08 +09:00
parent 411c0633a3
commit 559c011420
8 changed files with 146 additions and 28 deletions

View File

@@ -1369,14 +1369,14 @@ export class CustomNodesManager {
});
if (res.status != 200) {
errorMsg = `${item.title} ${mode} failed: `;
errorMsg = `'${item.title}': `;
if(res.status == 403) {
errorMsg += `This action is not allowed with this security level configuration.`;
errorMsg += `This action is not allowed with this security level configuration.\n`;
} else if(res.status == 404) {
errorMsg += `With the current security level configuration, only custom nodes from the <B>"default channel"</B> can be installed.`;
errorMsg += `With the current security level configuration, only custom nodes from the <B>"default channel"</B> can be installed.\n`;
} else {
errorMsg += await res.text();
errorMsg += await res.text() + '\n';
}
break;
@@ -1387,11 +1387,11 @@ export class CustomNodesManager {
if(errorMsg) {
this.showError(errorMsg);
show_message("Installation Error:\n"+errorMsg);
show_message("[Installation Errors]\n"+errorMsg);
// reset
for(let k in target_items) {
let item = this.install_context.targets[k];
const item = target_items[k];
this.grid.updateCell(item, "action");
}
}

View File

@@ -640,7 +640,6 @@ export class ModelManager {
}
btn.classList.add("cmm-btn-loading");
this.showLoading();
this.showError("");
let needRefresh = false;
@@ -671,7 +670,14 @@ export class ModelManager {
});
if (res.status != 200) {
errorMsg = `Install failed: ${item.name} ${res.error.message}`;
errorMsg = `'${item.name}': `;
if(res.status == 403) {
errorMsg += `This action is not allowed with this security level configuration.\n`;
} else {
errorMsg += await res.text() + '\n';
}
break;
}
}
@@ -680,11 +686,11 @@ export class ModelManager {
if(errorMsg) {
this.showError(errorMsg);
show_message("Installation Error:\n"+errorMsg);
show_message("[Installation Errors]\n"+errorMsg);
// reset
for (const hash of list) {
const item = this.grid.getRowItemBy("hash", hash);
for(let k in target_items) {
const item = target_items[k];
this.grid.updateCell(item, "installed");
}
}