fixes issue 167?

This commit is contained in:
tim h 2023-01-14 16:33:39 -06:00
parent 87cc1d8fa9
commit 1556f8d792
2 changed files with 24 additions and 1 deletions

View file

@ -83,6 +83,7 @@
Stable Diffusion settings
</button>
<div class="content">
<button id="refreshModelsBtn" onclick="refreshModels()">🔄</button>
<label>Model:</label>
<div id="models-ac-select"></div>
<label>Sampler:</label>

View file

@ -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;