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;