Hotfix - apply the config overrides to the Settings UI *after* the default config-apply function, not before it

This commit is contained in:
cmdr2 2023-04-08 20:13:44 +05:30
parent 4c7b4c7592
commit 0f4b62cb97

View File

@ -362,6 +362,9 @@ async function getAppConfig() {
let res = await fetch('/get/app_config')
const config = await res.json()
applySettingsFromConfig(config)
// custom overrides
if (config.update_branch === 'beta') {
useBetaChannelField.checked = true
document.querySelector("#updateBranchLabel").innerText = "(beta)"
@ -378,6 +381,7 @@ async function getAppConfig() {
listenPortField.value = config.net.listen_port
}
if (config.test_diffusers === undefined || config.update_branch === 'main') {
testDiffusers.checked = false
document.querySelector("#lora_model_container").style.display = 'none'
document.querySelector("#lora_alpha_container").style.display = 'none'
} else {
@ -386,6 +390,17 @@ async function getAppConfig() {
document.querySelector("#lora_alpha_container").style.display = (testDiffusers.checked && loraModelField.value !== "" ? '' : 'none')
}
console.log('get config status response', config)
return config
} catch (e) {
console.log('get config status error', e)
return {}
}
}
function applySettingsFromConfig(config) {
Array.from(parametersTable.children).forEach(parameterRow => {
if (parameterRow.dataset.settingId in config && parameterRow.dataset.saveInAppConfig === 'true') {
const configValue = config[parameterRow.dataset.settingId]
@ -416,15 +431,6 @@ async function getAppConfig() {
}
}
})
console.log('get config status response', config)
return config
} catch (e) {
console.log('get config status error', e)
return {}
}
}
saveToDiskField.addEventListener('change', function(e) {