From ba4893d821b089831588b9f599431826504ceea8 Mon Sep 17 00:00:00 2001 From: tim h Date: Sat, 22 Jul 2023 10:43:31 -0500 Subject: [PATCH] model selector update for upcoming webUI 1.5 --- index.html | 6 +++--- js/index.js | 12 +++++++++++- js/ui/tool/dream.js | 9 +++------ 3 files changed, 17 insertions(+), 10 deletions(-) diff --git a/index.html b/index.html index 9f5dd21..893a8ee 100644 --- a/index.html +++ b/index.html @@ -316,7 +316,7 @@ Alpha release v0.0.16.4 - v20230722.001 + v20230722.002
- + - + diff --git a/js/index.js b/js/index.js index 7af7016..02078ad 100644 --- a/js/index.js +++ b/js/index.js @@ -1172,7 +1172,17 @@ async function getModels(refresh = false) { ); const optData = await optResponse.json(); - const model = optData.sd_model_checkpoint; + var model = optData.sd_model_checkpoint; + // 20230722 - sigh so this key is now removed https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/66c5f1bb1556a2d86d9f11aeb92f83d4a09832cc + // no idea why but time to deal with it + if (model === undefined) { + const modelHash = optData.sd_checkpoint_hash; + const hashMap = data.map((option) => ({ + hash: option.sha256, + title: option.title, + })); + model = hashMap.find((option) => option.hash === modelHash).title; + } console.log("Current model: " + model); if (modelAutoComplete.value !== model) modelAutoComplete.value = model; } catch (e) { diff --git a/js/ui/tool/dream.js b/js/ui/tool/dream.js index a591791..524f336 100644 --- a/js/ui/tool/dream.js +++ b/js/ui/tool/dream.js @@ -62,12 +62,9 @@ const _monitorProgress = (bb, oncheck = null) => { } const timeSpent = performance.now() - init; - setTimeout( - () => { - if (running) _checkProgress(); - }, - Math.max(0, minDelay - timeSpent) - ); + setTimeout(() => { + if (running) _checkProgress(); + }, Math.max(0, minDelay - timeSpent)); }; _checkProgress();