loras
This commit is contained in:
parent
7b1cd4f267
commit
4b98823f3b
2 changed files with 33 additions and 1 deletions
|
@ -147,6 +147,8 @@
|
|||
value="-1"
|
||||
step="1" />
|
||||
<br />
|
||||
<label>Lora:</label>
|
||||
<div id="lora-ac-select"></div>
|
||||
<input type="checkbox" id="cbxHRFix" onchange="changeHiResFix()" />
|
||||
<label for="cbxHRFix">Apply Txt2Img HRfix</label>
|
||||
<br />
|
||||
|
|
32
js/index.js
32
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 = " <lora:" + value + ":1>";
|
||||
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";
|
||||
|
||||
|
|
Loading…
Reference in a new issue