the refresh button will refresh the sd tab

pull/194/head
Abdullah Alfaraj 2023-04-14 02:05:16 +03:00
parent b59191b8e4
commit 85766d3a63
2 changed files with 26 additions and 14 deletions

View File

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

View File

@ -154,8 +154,12 @@ function getLoraModelPrompt(lora_model_name) {
return `<lora:${lora_model_name}:1>` return `<lora:${lora_model_name}:1>`
} }
async function populateLoraModelMenu() { async function populateLoraModelMenu() {
try {
const lora_models_json = await sdapi.requestLoraModels() const lora_models_json = await sdapi.requestLoraModels()
const lora_models_names = Object.keys(lora_models_json) const lora_models_names = Object.keys(lora_models_json)
document.getElementById('mLoraModelMenu').innerHTML = ''
html_manip.populateMenu( html_manip.populateMenu(
'mLoraModelMenu', 'mLoraModelMenu',
'mLoraModelItemClass', 'mLoraModelItemClass',
@ -169,6 +173,9 @@ async function populateLoraModelMenu() {
} }
} }
) )
} 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,
} }