Fix error message display

pull/4644/head
awsr 2026-02-12 03:32:38 -08:00
parent 6971f3438c
commit 9f9d67713d
No known key found for this signature in database
1 changed files with 15 additions and 6 deletions

View File

@ -183,6 +183,7 @@ class SimpleProgressBar {
#hideTimeout = null;
#interval = null;
#max = 0;
#errorState = false;
/** @type {Set} */
#monitoredSet;
@ -199,6 +200,7 @@ class SimpleProgressBar {
}
start(total) {
if (this.#errorState) return;
this.clear();
this.#max = total;
this.#interval = setInterval(() => {
@ -215,6 +217,7 @@ class SimpleProgressBar {
clear() {
this.#stop();
this.#errorState = false;
clearTimeout(this.#hideTimeout);
this.#hideTimeout = null;
this.#container.style.display = 'none';
@ -224,12 +227,17 @@ class SimpleProgressBar {
}
error(message) {
this.#stop();
clearTimeout(this.#hideTimeout);
this.#text.textContent = message;
this.#hideTimeout = setTimeout(() => {
this.clear();
}, 2000);
if (!this.#errorState) {
this.#errorState = true;
this.#stop();
this.#container.style.display = 'block';
this.#visible = true;
clearTimeout(this.#hideTimeout);
this.#text.textContent = message;
this.#hideTimeout = setTimeout(() => {
this.clear();
}, 2000);
}
}
#update(loaded, max) {
@ -653,6 +661,7 @@ async function addSeparators() {
const gallerySendImage = (_images) => [currentImage]; // invoked by gradio button
async function getHash(str) {
galleryProgressBar.error('File hash error');
try {
let hex = '';
const strBuf = new TextEncoder().encode(str);