|
|
@ -49,6 +49,7 @@ const taskConfigSetup = {
|
|
|
|
use_lora_model: { label: "Lora Model", visible: ({ reqBody }) => !!reqBody?.use_lora_model },
|
|
|
|
use_lora_model: { label: "Lora Model", visible: ({ reqBody }) => !!reqBody?.use_lora_model },
|
|
|
|
lora_alpha: { label: "Lora Strength", visible: ({ reqBody }) => !!reqBody?.use_lora_model },
|
|
|
|
lora_alpha: { label: "Lora Strength", visible: ({ reqBody }) => !!reqBody?.use_lora_model },
|
|
|
|
preserve_init_image_color_profile: "Preserve Color Profile",
|
|
|
|
preserve_init_image_color_profile: "Preserve Color Profile",
|
|
|
|
|
|
|
|
strict_mask_border: "Strict Mask Border",
|
|
|
|
},
|
|
|
|
},
|
|
|
|
pluginTaskConfig: {},
|
|
|
|
pluginTaskConfig: {},
|
|
|
|
getCSSKey: (key) =>
|
|
|
|
getCSSKey: (key) =>
|
|
|
@ -93,7 +94,9 @@ let initImageSizeBox = document.querySelector("#init_image_size_box")
|
|
|
|
let maskImageSelector = document.querySelector("#mask")
|
|
|
|
let maskImageSelector = document.querySelector("#mask")
|
|
|
|
let maskImagePreview = document.querySelector("#mask_preview")
|
|
|
|
let maskImagePreview = document.querySelector("#mask_preview")
|
|
|
|
let applyColorCorrectionField = document.querySelector("#apply_color_correction")
|
|
|
|
let applyColorCorrectionField = document.querySelector("#apply_color_correction")
|
|
|
|
|
|
|
|
let strictMaskBorderField = document.querySelector("#strict_mask_border")
|
|
|
|
let colorCorrectionSetting = document.querySelector("#apply_color_correction_setting")
|
|
|
|
let colorCorrectionSetting = document.querySelector("#apply_color_correction_setting")
|
|
|
|
|
|
|
|
let strictMaskBorderSetting = document.querySelector("#strict_mask_border_setting")
|
|
|
|
let promptStrengthSlider = document.querySelector("#prompt_strength_slider")
|
|
|
|
let promptStrengthSlider = document.querySelector("#prompt_strength_slider")
|
|
|
|
let promptStrengthField = document.querySelector("#prompt_strength")
|
|
|
|
let promptStrengthField = document.querySelector("#prompt_strength")
|
|
|
|
let samplerField = document.querySelector("#sampler_name")
|
|
|
|
let samplerField = document.querySelector("#sampler_name")
|
|
|
@ -1386,6 +1389,7 @@ function getCurrentUserRequest() {
|
|
|
|
// }
|
|
|
|
// }
|
|
|
|
if (maskSetting.checked) {
|
|
|
|
if (maskSetting.checked) {
|
|
|
|
newTask.reqBody.mask = imageInpainter.getImg()
|
|
|
|
newTask.reqBody.mask = imageInpainter.getImg()
|
|
|
|
|
|
|
|
newTask.reqBody.strict_mask_border = strictMaskBorderField.checked
|
|
|
|
}
|
|
|
|
}
|
|
|
|
newTask.reqBody.preserve_init_image_color_profile = applyColorCorrectionField.checked
|
|
|
|
newTask.reqBody.preserve_init_image_color_profile = applyColorCorrectionField.checked
|
|
|
|
if (!testDiffusers.checked) {
|
|
|
|
if (!testDiffusers.checked) {
|
|
|
@ -2091,6 +2095,7 @@ function img2imgLoad() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
initImagePreviewContainer.classList.add("has-image")
|
|
|
|
initImagePreviewContainer.classList.add("has-image")
|
|
|
|
colorCorrectionSetting.style.display = ""
|
|
|
|
colorCorrectionSetting.style.display = ""
|
|
|
|
|
|
|
|
strictMaskBorderSetting.style.display = maskSetting.checked ? "" : "none"
|
|
|
|
|
|
|
|
|
|
|
|
initImageSizeBox.textContent = initImagePreview.naturalWidth + " x " + initImagePreview.naturalHeight
|
|
|
|
initImageSizeBox.textContent = initImagePreview.naturalWidth + " x " + initImagePreview.naturalHeight
|
|
|
|
imageEditor.setImage(this.src, initImagePreview.naturalWidth, initImagePreview.naturalHeight)
|
|
|
|
imageEditor.setImage(this.src, initImagePreview.naturalWidth, initImagePreview.naturalHeight)
|
|
|
@ -2108,6 +2113,7 @@ function img2imgUnload() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
initImagePreviewContainer.classList.remove("has-image")
|
|
|
|
initImagePreviewContainer.classList.remove("has-image")
|
|
|
|
colorCorrectionSetting.style.display = "none"
|
|
|
|
colorCorrectionSetting.style.display = "none"
|
|
|
|
|
|
|
|
strictMaskBorderSetting.style.display = "none"
|
|
|
|
imageEditor.setImage(null, parseInt(widthField.value), parseInt(heightField.value))
|
|
|
|
imageEditor.setImage(null, parseInt(widthField.value), parseInt(heightField.value))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
initImagePreview.addEventListener("load", img2imgLoad)
|
|
|
|
initImagePreview.addEventListener("load", img2imgLoad)
|
|
|
@ -2116,6 +2122,9 @@ initImageClearBtn.addEventListener("click", img2imgUnload)
|
|
|
|
maskSetting.addEventListener("click", function() {
|
|
|
|
maskSetting.addEventListener("click", function() {
|
|
|
|
onDimensionChange()
|
|
|
|
onDimensionChange()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
maskSetting.addEventListener("change", function() {
|
|
|
|
|
|
|
|
strictMaskBorderSetting.style.display = this.checked ? "" : "none"
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
|
|
promptsFromFileBtn.addEventListener("click", function() {
|
|
|
|
promptsFromFileBtn.addEventListener("click", function() {
|
|
|
|
promptsFromFileSelector.click()
|
|
|
|
promptsFromFileSelector.click()
|
|
|
@ -2583,12 +2592,14 @@ createLoraEntries()
|
|
|
|
////////////////////////////// Image Size Widget //////////////////////////////////////////
|
|
|
|
////////////////////////////// Image Size Widget //////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
function roundToMultiple(number, n) {
|
|
|
|
function roundToMultiple(number, n) {
|
|
|
|
if (n=="") { n=1 }
|
|
|
|
if (n == "") {
|
|
|
|
return Math.round(number / n) * n;
|
|
|
|
n = 1
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return Math.round(number / n) * n
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function addImageSizeOption(size) {
|
|
|
|
function addImageSizeOption(size) {
|
|
|
|
let sizes = Object.values(widthField.options).map(o => o.value)
|
|
|
|
let sizes = Object.values(widthField.options).map((o) => o.value)
|
|
|
|
if (!sizes.includes(String(size))) {
|
|
|
|
if (!sizes.includes(String(size))) {
|
|
|
|
sizes.push(String(size))
|
|
|
|
sizes.push(String(size))
|
|
|
|
sizes.sort((a, b) => Number(a) - Number(b))
|
|
|
|
sizes.sort((a, b) => Number(a) - Number(b))
|
|
|
@ -2600,7 +2611,6 @@ function addImageSizeOption(size) {
|
|
|
|
widthField.add(option, sizes.indexOf(String(size)))
|
|
|
|
widthField.add(option, sizes.indexOf(String(size)))
|
|
|
|
heightField.add(option.cloneNode(true), sizes.indexOf(String(size)))
|
|
|
|
heightField.add(option.cloneNode(true), sizes.indexOf(String(size)))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function setImageWidthHeight(w, h) {
|
|
|
|
function setImageWidthHeight(w, h) {
|
|
|
@ -2628,10 +2638,11 @@ function enlargeImageSize(factor) {
|
|
|
|
|
|
|
|
|
|
|
|
let recentResolutionsValues = []
|
|
|
|
let recentResolutionsValues = []
|
|
|
|
|
|
|
|
|
|
|
|
;(function() { ///// Init resolutions dropdown
|
|
|
|
;(function() {
|
|
|
|
|
|
|
|
///// Init resolutions dropdown
|
|
|
|
function makeResolutionButtons() {
|
|
|
|
function makeResolutionButtons() {
|
|
|
|
recentResolutionList.innerHTML = ""
|
|
|
|
recentResolutionList.innerHTML = ""
|
|
|
|
recentResolutionsValues.forEach( el => {
|
|
|
|
recentResolutionsValues.forEach((el) => {
|
|
|
|
let button = document.createElement("button")
|
|
|
|
let button = document.createElement("button")
|
|
|
|
button.classList.add("tertiaryButton")
|
|
|
|
button.classList.add("tertiaryButton")
|
|
|
|
button.style.width = "8em"
|
|
|
|
button.style.width = "8em"
|
|
|
@ -2682,7 +2693,7 @@ let recentResolutionsValues = []
|
|
|
|
let w = widthField.value
|
|
|
|
let w = widthField.value
|
|
|
|
let h = heightField.value
|
|
|
|
let h = heightField.value
|
|
|
|
|
|
|
|
|
|
|
|
recentResolutionsValues = recentResolutionsValues.filter(el => (el.w!=w || el.h!=h))
|
|
|
|
recentResolutionsValues = recentResolutionsValues.filter((el) => el.w != w || el.h != h)
|
|
|
|
recentResolutionsValues.unshift({ w: w, h: h })
|
|
|
|
recentResolutionsValues.unshift({ w: w, h: h })
|
|
|
|
recentResolutionsValues = recentResolutionsValues.slice(0, 8)
|
|
|
|
recentResolutionsValues = recentResolutionsValues.slice(0, 8)
|
|
|
|
|
|
|
|
|
|
|
@ -2707,7 +2718,7 @@ let recentResolutionsValues = []
|
|
|
|
}
|
|
|
|
}
|
|
|
|
makeResolutionButtons()
|
|
|
|
makeResolutionButtons()
|
|
|
|
|
|
|
|
|
|
|
|
recentResolutionsValues.forEach( val => {
|
|
|
|
recentResolutionsValues.forEach((val) => {
|
|
|
|
addImageSizeOption(val.w)
|
|
|
|
addImageSizeOption(val.w)
|
|
|
|
addImageSizeOption(val.h)
|
|
|
|
addImageSizeOption(val.h)
|
|
|
|
})
|
|
|
|
})
|
|
|
@ -2746,4 +2757,3 @@ let recentResolutionsValues = []
|
|
|
|
heightField.value = temp
|
|
|
|
heightField.value = temp
|
|
|
|
})
|
|
|
|
})
|
|
|
|
})()
|
|
|
|
})()
|
|
|
|
|
|
|
|
|
|
|
|