the refresh button will refresh the sd tab
parent
b59191b8e4
commit
85766d3a63
1
index.js
1
index.js
|
|
@ -2654,6 +2654,7 @@ document
|
||||||
.getElementById('btnRefreshModels')
|
.getElementById('btnRefreshModels')
|
||||||
.addEventListener('click', async (e) => {
|
.addEventListener('click', async (e) => {
|
||||||
await refreshUI()
|
await refreshUI()
|
||||||
|
await sd_tab.refreshSDTab()
|
||||||
tempDisableElement(e.target, 3000)
|
tempDisableElement(e.target, 3000)
|
||||||
})
|
})
|
||||||
//REFACTOR: move to events.js
|
//REFACTOR: move to events.js
|
||||||
|
|
|
||||||
|
|
@ -154,21 +154,28 @@ function getLoraModelPrompt(lora_model_name) {
|
||||||
return `<lora:${lora_model_name}:1>`
|
return `<lora:${lora_model_name}:1>`
|
||||||
}
|
}
|
||||||
async function populateLoraModelMenu() {
|
async function populateLoraModelMenu() {
|
||||||
const lora_models_json = await sdapi.requestLoraModels()
|
try {
|
||||||
const lora_models_names = Object.keys(lora_models_json)
|
const lora_models_json = await sdapi.requestLoraModels()
|
||||||
html_manip.populateMenu(
|
const lora_models_names = Object.keys(lora_models_json)
|
||||||
'mLoraModelMenu',
|
|
||||||
'mLoraModelItemClass',
|
document.getElementById('mLoraModelMenu').innerHTML = ''
|
||||||
lora_models_names,
|
|
||||||
(item, item_html_element) => {
|
html_manip.populateMenu(
|
||||||
item_html_element.innerHTML = item
|
'mLoraModelMenu',
|
||||||
item_html_element.onclick = () => {
|
'mLoraModelItemClass',
|
||||||
const lora_prompt = getLoraModelPrompt(item)
|
lora_models_names,
|
||||||
const prompt = html_manip.getPrompt()
|
(item, item_html_element) => {
|
||||||
html_manip.autoFillInPrompt(`${prompt} ${lora_prompt}`)
|
item_html_element.innerHTML = item
|
||||||
|
item_html_element.onclick = () => {
|
||||||
|
const lora_prompt = getLoraModelPrompt(item)
|
||||||
|
const prompt = html_manip.getPrompt()
|
||||||
|
html_manip.autoFillInPrompt(`${prompt} ${lora_prompt}`)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
)
|
||||||
)
|
} catch (e) {
|
||||||
|
console.warn('populateLoraModelMenu error: ', e)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function initInitMaskElement() {
|
function initInitMaskElement() {
|
||||||
//make init mask image use the thumbnail class with buttons
|
//make init mask image use the thumbnail class with buttons
|
||||||
|
|
@ -199,6 +206,9 @@ function initInitMaskElement() {
|
||||||
populateLoraModelMenu() // no need for await
|
populateLoraModelMenu() // no need for await
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function refreshSDTab() {
|
||||||
|
populateLoraModelMenu()
|
||||||
|
}
|
||||||
document.getElementById('hrScaleSlider').addEventListener('input', (evt) => {
|
document.getElementById('hrScaleSlider').addEventListener('input', (evt) => {
|
||||||
const sd_value = getHrScaleSliderSDValue()
|
const sd_value = getHrScaleSliderSDValue()
|
||||||
setHrScaleSliderSDValue(sd_value.toFixed(2))
|
setHrScaleSliderSDValue(sd_value.toFixed(2))
|
||||||
|
|
@ -273,4 +283,5 @@ module.exports = {
|
||||||
populateLoraModelMenu,
|
populateLoraModelMenu,
|
||||||
getImageCfgScaleSDValue,
|
getImageCfgScaleSDValue,
|
||||||
setImageCfgScaleSDValue,
|
setImageCfgScaleSDValue,
|
||||||
|
refreshSDTab,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue