From 1556f8d7924e6de04a8d8da465e9ba1a4fac9589 Mon Sep 17 00:00:00 2001 From: tim h Date: Sat, 14 Jan 2023 16:33:39 -0600 Subject: [PATCH] fixes issue 167? --- index.html | 1 + js/index.js | 24 +++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/index.html b/index.html index f87960c..56ed091 100644 --- a/index.html +++ b/index.html @@ -83,6 +83,7 @@ Stable Diffusion settings
+
diff --git a/js/index.js b/js/index.js index 87a8929..41c98bc 100644 --- a/js/index.js +++ b/js/index.js @@ -589,7 +589,7 @@ const makeSlider = ( }); }; -const modelAutoComplete = createAutoComplete( +let modelAutoComplete = createAutoComplete( "Model", document.getElementById("models-ac-select") ); @@ -956,6 +956,28 @@ async function getUpscalers() { */ } +async function refreshModels() { + var original = document.getElementById("models-ac-select"); + var newdiv = document.createElement("div"); + newdiv.id = "models-ac-select"; + original.replaceWith(newdiv); + modelAutoComplete = createAutoComplete( + "Model", + document.getElementById("models-ac-select") + ); + modelAutoComplete.onchange.on(({value}) => { + if (value.toLowerCase().includes("inpainting")) + document.querySelector( + "#models-ac-select input.autocomplete-text" + ).style.backgroundColor = "#cfc"; + else + document.querySelector( + "#models-ac-select input.autocomplete-text" + ).style.backgroundColor = "#fcc"; + }); + getModels(); +} + async function getModels() { const url = document.getElementById("host").value + "/sdapi/v1/sd-models"; let opt = null;