mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2025-08-16 02:59:06 +02:00
First working version of dynamic backends, with Forge and ed_diffusers (v3) and ed_classic (v2). Does not auto-install Forge yet
This commit is contained in:
@ -249,14 +249,19 @@ var PARAMETERS = [
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "use_v3_engine",
|
||||
type: ParameterType.checkbox,
|
||||
label: "Use the new v3 engine (diffusers)",
|
||||
id: "backend",
|
||||
type: ParameterType.select,
|
||||
label: "Engine to use",
|
||||
note:
|
||||
"Use our new v3 engine, with additional features like LoRA, ControlNet, SDXL, Embeddings, Tiling and lots more! Please press Save, then restart the program after changing this.",
|
||||
icon: "fa-bolt",
|
||||
default: true,
|
||||
"Use our new v3.5 engine (Forge), with additional features like Flux, SD3, Lycoris and lots more! Please press Save, then restart the program after changing this.",
|
||||
icon: "fa-robot",
|
||||
saveInAppConfig: true,
|
||||
default: "ed_diffusers",
|
||||
options: [
|
||||
{ value: "webui", label: "v3.5 (latest)" },
|
||||
{ value: "ed_diffusers", label: "v3.0" },
|
||||
{ value: "ed_classic", label: "v2.0" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "cloudflare",
|
||||
@ -432,6 +437,7 @@ let useBetaChannelField = document.querySelector("#use_beta_channel")
|
||||
let uiOpenBrowserOnStartField = document.querySelector("#ui_open_browser_on_start")
|
||||
let confirmDangerousActionsField = document.querySelector("#confirm_dangerous_actions")
|
||||
let testDiffusers = document.querySelector("#use_v3_engine")
|
||||
let backendEngine = document.querySelector("#backend")
|
||||
let profileNameField = document.querySelector("#profileName")
|
||||
let modelsDirField = document.querySelector("#models_dir")
|
||||
|
||||
@ -454,6 +460,23 @@ async function changeAppConfig(configDelta) {
|
||||
}
|
||||
}
|
||||
|
||||
function getDefaultDisplay(element) {
|
||||
const tag = element.tagName.toLowerCase();
|
||||
const defaultDisplays = {
|
||||
div: 'block',
|
||||
span: 'inline',
|
||||
p: 'block',
|
||||
tr: 'table-row',
|
||||
table: 'table',
|
||||
li: 'list-item',
|
||||
ul: 'block',
|
||||
ol: 'block',
|
||||
button: 'inline',
|
||||
// Add more if needed
|
||||
};
|
||||
return defaultDisplays[tag] || 'block'; // Default to 'block' if not listed
|
||||
}
|
||||
|
||||
async function getAppConfig() {
|
||||
try {
|
||||
let res = await fetch("/get/app_config")
|
||||
@ -478,14 +501,16 @@ async function getAppConfig() {
|
||||
modelsDirField.value = config.models_dir
|
||||
|
||||
let testDiffusersEnabled = true
|
||||
if (config.use_v3_engine === false) {
|
||||
if (config.backend === "ed_classic") {
|
||||
testDiffusersEnabled = false
|
||||
}
|
||||
testDiffusers.checked = testDiffusersEnabled
|
||||
backendEngine.value = config.backend
|
||||
document.querySelector("#test_diffusers").checked = testDiffusers.checked // don't break plugins
|
||||
document.querySelector("#use_v3_engine").checked = testDiffusers.checked // don't break plugins
|
||||
|
||||
if (config.config_on_startup) {
|
||||
if (config.config_on_startup?.use_v3_engine) {
|
||||
if (config.config_on_startup?.backend !== "ed_classic") {
|
||||
document.body.classList.add("diffusers-enabled-on-startup")
|
||||
document.body.classList.remove("diffusers-disabled-on-startup")
|
||||
} else {
|
||||
@ -494,37 +519,27 @@ async function getAppConfig() {
|
||||
}
|
||||
}
|
||||
|
||||
if (!testDiffusersEnabled) {
|
||||
document.querySelector("#lora_model_container").style.display = "none"
|
||||
document.querySelector("#tiling_container").style.display = "none"
|
||||
document.querySelector("#controlnet_model_container").style.display = "none"
|
||||
document.querySelector("#hypernetwork_model_container").style.display = ""
|
||||
document.querySelector("#hypernetwork_strength_container").style.display = ""
|
||||
document.querySelector("#negative-embeddings-button").style.display = "none"
|
||||
|
||||
document.querySelectorAll("#sampler_name option.diffusers-only").forEach((option) => {
|
||||
option.style.display = "none"
|
||||
})
|
||||
if (config.backend === "ed_classic") {
|
||||
IMAGE_STEP_SIZE = 64
|
||||
customWidthField.step = IMAGE_STEP_SIZE
|
||||
customHeightField.step = IMAGE_STEP_SIZE
|
||||
} else {
|
||||
document.querySelector("#lora_model_container").style.display = ""
|
||||
document.querySelector("#tiling_container").style.display = ""
|
||||
document.querySelector("#controlnet_model_container").style.display = ""
|
||||
document.querySelector("#hypernetwork_model_container").style.display = "none"
|
||||
document.querySelector("#hypernetwork_strength_container").style.display = "none"
|
||||
|
||||
document.querySelectorAll("#sampler_name option.k_diffusion-only").forEach((option) => {
|
||||
option.style.display = "none"
|
||||
})
|
||||
document.querySelector("#clip_skip_config").classList.remove("displayNone")
|
||||
document.querySelector("#embeddings-button").classList.remove("displayNone")
|
||||
IMAGE_STEP_SIZE = 8
|
||||
customWidthField.step = IMAGE_STEP_SIZE
|
||||
customHeightField.step = IMAGE_STEP_SIZE
|
||||
}
|
||||
|
||||
customWidthField.step = IMAGE_STEP_SIZE
|
||||
customHeightField.step = IMAGE_STEP_SIZE
|
||||
|
||||
const currentBackendKey = "backend_" + config.backend
|
||||
|
||||
document.querySelectorAll('.gated-feature').forEach((element) => {
|
||||
const featureKeys = element.getAttribute('data-feature-keys').split(' ')
|
||||
|
||||
if (featureKeys.includes(currentBackendKey)) {
|
||||
element.style.display = getDefaultDisplay(element)
|
||||
} else {
|
||||
element.style.display = 'none'
|
||||
}
|
||||
});
|
||||
|
||||
if (config.force_save_metadata) {
|
||||
metadataOutputFormatField.value = config.force_save_metadata
|
||||
}
|
||||
@ -749,6 +764,11 @@ async function getSystemInfo() {
|
||||
metadataOutputFormatField.disabled = !saveToDiskField.checked
|
||||
}
|
||||
setDiskPath(res["default_output_dir"], force)
|
||||
|
||||
// backend info
|
||||
if (res["backend_url"]) {
|
||||
document.querySelector("#backend-url").setAttribute("href", res["backend_url"])
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("error fetching devices", e)
|
||||
}
|
||||
|
Reference in New Issue
Block a user