Merge pull request #1137 from cmdr2/beta

Beta
This commit is contained in:
cmdr2 2023-04-08 20:16:31 +05:30 committed by GitHub
commit ae470e35c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 43 additions and 37 deletions

View File

@ -95,7 +95,7 @@ if "%ERRORLEVEL%" EQU "0" (
set PYTHONNOUSERSITE=1
set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages
call python -m pip install --upgrade sdkit==1.0.64 -q || (
call python -m pip install --upgrade sdkit==1.0.65 -q || (
echo "Error updating sdkit"
)
)
@ -106,7 +106,7 @@ if "%ERRORLEVEL%" EQU "0" (
set PYTHONNOUSERSITE=1
set PYTHONPATH=%INSTALL_ENV_DIR%\lib\site-packages
call python -m pip install sdkit==1.0.64 || (
call python -m pip install sdkit==1.0.65 || (
echo "Error installing sdkit. Sorry about that, please try to:" & echo " 1. Run this installer again." & echo " 2. If that doesn't fix it, please try the common troubleshooting steps at https://github.com/cmdr2/stable-diffusion-ui/wiki/Troubleshooting" & echo " 3. If those steps don't help, please copy *all* the error messages in this window, and ask the community at https://discord.com/invite/u9yhsFmEkB" & echo " 4. If that doesn't solve the problem, please file an issue at https://github.com/cmdr2/stable-diffusion-ui/issues" & echo "Thanks!"
pause
exit /b

View File

@ -103,7 +103,7 @@ if python ../scripts/check_modules.py sdkit sdkit.models ldm transformers numpy
export PYTHONNOUSERSITE=1
export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages"
python -m pip install --upgrade sdkit==1.0.64 -q
python -m pip install --upgrade sdkit==1.0.65 -q
fi
else
echo "Installing sdkit: https://pypi.org/project/sdkit/"
@ -111,7 +111,7 @@ else
export PYTHONNOUSERSITE=1
export PYTHONPATH="$INSTALL_ENV_DIR/lib/python3.8/site-packages"
if python -m pip install sdkit==1.0.64 ; then
if python -m pip install sdkit==1.0.65 ; then
echo "Installed."
else
fail "sdkit install failed"

View File

@ -608,7 +608,7 @@ document.addEventListener('paste', async (event) => {
}
const paste = (event.clipboardData || window.clipboardData).getData('text')
const selection = window.getSelection()
if (selection.toString().trim().length <= 0 && await parseContent(paste)) {
if (paste != "" && selection.toString().trim().length <= 0 && await parseContent(paste)) {
event.preventDefault()
return
}

View File

@ -3,7 +3,7 @@
* @readonly
* @enum {string}
*/
var ParameterType = {
var ParameterType = {
checkbox: "checkbox",
select: "select",
select_multiple: "select_multiple",
@ -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,37 +390,6 @@ async function getAppConfig() {
document.querySelector("#lora_alpha_container").style.display = (testDiffusers.checked && loraModelField.value !== "" ? '' : 'none')
}
Array.from(parametersTable.children).forEach(parameterRow => {
if (parameterRow.dataset.settingId in config && parameterRow.dataset.saveInAppConfig === 'true') {
const configValue = config[parameterRow.dataset.settingId]
const parameterElement = document.getElementById(parameterRow.dataset.settingId) ||
parameterRow.querySelector('input') || parameterRow.querySelector('select')
switch (parameterElement?.tagName) {
case 'INPUT':
if (parameterElement.type === 'checkbox') {
parameterElement.checked = configValue
} else {
parameterElement.value = configValue
}
parameterElement.dispatchEvent(new Event('change'))
break
case 'SELECT':
if (Array.isArray(configValue)) {
Array.from(parameterElement.options).forEach(option => {
if (configValue.includes(option.value || option.text)) {
option.selected = true
}
})
} else {
parameterElement.value = configValue
}
parameterElement.dispatchEvent(new Event('change'))
break
}
}
})
console.log('get config status response', config)
return config
@ -427,6 +400,39 @@ async function getAppConfig() {
}
}
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]
const parameterElement = document.getElementById(parameterRow.dataset.settingId) ||
parameterRow.querySelector('input') || parameterRow.querySelector('select')
switch (parameterElement?.tagName) {
case 'INPUT':
if (parameterElement.type === 'checkbox') {
parameterElement.checked = configValue
} else {
parameterElement.value = configValue
}
parameterElement.dispatchEvent(new Event('change'))
break
case 'SELECT':
if (Array.isArray(configValue)) {
Array.from(parameterElement.options).forEach(option => {
if (configValue.includes(option.value || option.text)) {
option.selected = true
}
})
} else {
parameterElement.value = configValue
}
parameterElement.dispatchEvent(new Event('change'))
break
}
}
})
}
saveToDiskField.addEventListener('change', function(e) {
diskPathField.disabled = !this.checked
metadataOutputFormatField.disabled = !this.checked