diff --git a/index.html b/index.html index befc9bc..f12323c 100644 --- a/index.html +++ b/index.html @@ -147,6 +147,8 @@ value="-1" step="1" />
+ +

diff --git a/js/index.js b/js/index.js index 6de13b1..1f75638 100644 --- a/js/index.js +++ b/js/index.js @@ -426,7 +426,7 @@ async function testHostConnection() { controlNetModelAutoComplete, controlNetModuleAutoComplete ); - // getLoras(); + getLoras(); // getTIEmbeddings(); // getHypernets(); firstTimeOnline = false; @@ -652,6 +652,18 @@ modelAutoComplete.onchange.on(({value}) => { ).style.backgroundColor = "#fcc"; }); +let loraAutoComplete = createAutoComplete( + "LoRa", + document.getElementById("lora-ac-select") +); +loraAutoComplete.onchange.on(({value}) => { + // add selected lora to the end of the prompt + let passVal = " "; + let promptInput = document.getElementById("prompt"); + promptInput.value += passVal; + let promptThing = prompt; +}); + const samplerAutoComplete = createAutoComplete( "Sampler", document.getElementById("sampler-ac-select") @@ -1180,6 +1192,24 @@ async function getModels(refresh = false) { } } +async function getLoras() { + var url = document.getElementById("host").value + "/sdapi/v1/loras"; + let opt = null; + + try { + const response = await fetch(url); + const data = await response.json(); + + loraAutoComplete.options = data.map((lora) => ({ + name: lora.name, + value: lora.name, + })); + } catch (e) { + console.warn("[index] Failed to fetch loras"); + console.warn(e); + } +} + async function getConfig() { var url = document.getElementById("host").value + "/sdapi/v1/options";