mirror of
https://github.com/easydiffusion/easydiffusion.git
synced 2024-11-22 00:03:20 +01:00
Use ES5 style trailing commas, to avoid unnecessary lines during code diffs
This commit is contained in:
parent
3000e53cc0
commit
469585ddda
@ -52,7 +52,7 @@ const SETTINGS_IDS_LIST = [
|
||||
"auto_scroll",
|
||||
"zip_toggle",
|
||||
"tree_toggle",
|
||||
"json_toggle"
|
||||
"json_toggle",
|
||||
]
|
||||
|
||||
const IGNORE_BY_DEFAULT = ["prompt"]
|
||||
@ -62,7 +62,7 @@ const SETTINGS_SECTIONS = [
|
||||
{ id: "editor-inputs", name: "Prompt" },
|
||||
{ id: "editor-settings", name: "Image Settings" },
|
||||
{ id: "system-settings", name: "System Settings" },
|
||||
{ id: "container", name: "Other" }
|
||||
{ id: "container", name: "Other" },
|
||||
]
|
||||
|
||||
async function initSettings() {
|
||||
@ -81,7 +81,7 @@ async function initSettings() {
|
||||
label: getSettingLabel(element),
|
||||
default: getSetting(element),
|
||||
value: getSetting(element),
|
||||
ignore: IGNORE_BY_DEFAULT.includes(id)
|
||||
ignore: IGNORE_BY_DEFAULT.includes(id),
|
||||
}
|
||||
element.addEventListener("input", settingChangeHandler)
|
||||
element.addEventListener("change", settingChangeHandler)
|
||||
@ -139,7 +139,7 @@ function saveSettings() {
|
||||
return {
|
||||
key: setting.key,
|
||||
value: setting.value,
|
||||
ignore: setting.ignore
|
||||
ignore: setting.ignore,
|
||||
}
|
||||
})
|
||||
localStorage.setItem(SETTINGS_KEY, JSON.stringify(saved_settings))
|
||||
@ -265,7 +265,7 @@ function tryLoadOldSettings() {
|
||||
// load v1 auto-save.js settings
|
||||
var old_map = {
|
||||
guidance_scale_slider: "guidance_scale",
|
||||
prompt_strength_slider: "prompt_strength"
|
||||
prompt_strength_slider: "prompt_strength",
|
||||
}
|
||||
var settings_key_v1 = "user_settings"
|
||||
var saved_settings_text = localStorage.getItem(settings_key_v1)
|
||||
@ -300,7 +300,7 @@ function tryLoadOldSettings() {
|
||||
showOnlyFilteredImage: "show_only_filtered_image",
|
||||
streamImageProgress: "stream_image_progress",
|
||||
outputFormat: "output_format",
|
||||
autoSaveSettings: "auto_save_settings"
|
||||
autoSaveSettings: "auto_save_settings",
|
||||
}
|
||||
Object.keys(individual_settings_map).forEach((localStorageKey) => {
|
||||
var localStorageValue = localStorage.getItem(localStorageKey)
|
||||
|
@ -44,7 +44,7 @@ const TASK_MAPPING = {
|
||||
promptField.value = prompt
|
||||
},
|
||||
readUI: () => promptField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
negative_prompt: {
|
||||
name: "Negative Prompt",
|
||||
@ -52,7 +52,7 @@ const TASK_MAPPING = {
|
||||
negativePromptField.value = negative_prompt
|
||||
},
|
||||
readUI: () => negativePromptField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
active_tags: {
|
||||
name: "Image Modifiers",
|
||||
@ -60,7 +60,7 @@ const TASK_MAPPING = {
|
||||
refreshModifiersState(active_tags)
|
||||
},
|
||||
readUI: () => activeTags.map((x) => x.name),
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
inactive_tags: {
|
||||
name: "Inactive Image Modifiers",
|
||||
@ -68,7 +68,7 @@ const TASK_MAPPING = {
|
||||
refreshInactiveTags(inactive_tags)
|
||||
},
|
||||
readUI: () => activeTags.filter((tag) => tag.inactive === true).map((x) => x.name),
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
width: {
|
||||
name: "Width",
|
||||
@ -80,7 +80,7 @@ const TASK_MAPPING = {
|
||||
}
|
||||
},
|
||||
readUI: () => parseInt(widthField.value),
|
||||
parse: (val) => parseInt(val)
|
||||
parse: (val) => parseInt(val),
|
||||
},
|
||||
height: {
|
||||
name: "Height",
|
||||
@ -92,7 +92,7 @@ const TASK_MAPPING = {
|
||||
}
|
||||
},
|
||||
readUI: () => parseInt(heightField.value),
|
||||
parse: (val) => parseInt(val)
|
||||
parse: (val) => parseInt(val),
|
||||
},
|
||||
seed: {
|
||||
name: "Seed",
|
||||
@ -109,7 +109,7 @@ const TASK_MAPPING = {
|
||||
seedField.value = seed
|
||||
},
|
||||
readUI: () => parseInt(seedField.value), // just return the value the user is seeing in the UI
|
||||
parse: (val) => parseInt(val)
|
||||
parse: (val) => parseInt(val),
|
||||
},
|
||||
num_inference_steps: {
|
||||
name: "Steps",
|
||||
@ -117,7 +117,7 @@ const TASK_MAPPING = {
|
||||
numInferenceStepsField.value = num_inference_steps
|
||||
},
|
||||
readUI: () => parseInt(numInferenceStepsField.value),
|
||||
parse: (val) => parseInt(val)
|
||||
parse: (val) => parseInt(val),
|
||||
},
|
||||
guidance_scale: {
|
||||
name: "Guidance Scale",
|
||||
@ -126,7 +126,7 @@ const TASK_MAPPING = {
|
||||
updateGuidanceScaleSlider()
|
||||
},
|
||||
readUI: () => parseFloat(guidanceScaleField.value),
|
||||
parse: (val) => parseFloat(val)
|
||||
parse: (val) => parseFloat(val),
|
||||
},
|
||||
prompt_strength: {
|
||||
name: "Prompt Strength",
|
||||
@ -135,7 +135,7 @@ const TASK_MAPPING = {
|
||||
updatePromptStrengthSlider()
|
||||
},
|
||||
readUI: () => parseFloat(promptStrengthField.value),
|
||||
parse: (val) => parseFloat(val)
|
||||
parse: (val) => parseFloat(val),
|
||||
},
|
||||
|
||||
init_image: {
|
||||
@ -144,7 +144,7 @@ const TASK_MAPPING = {
|
||||
initImagePreview.src = init_image
|
||||
},
|
||||
readUI: () => initImagePreview.src,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
mask: {
|
||||
name: "Mask",
|
||||
@ -156,7 +156,7 @@ const TASK_MAPPING = {
|
||||
maskSetting.checked = Boolean(mask)
|
||||
},
|
||||
readUI: () => (maskSetting.checked ? imageInpainter.getImg() : undefined),
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
preserve_init_image_color_profile: {
|
||||
name: "Preserve Color Profile",
|
||||
@ -164,7 +164,7 @@ const TASK_MAPPING = {
|
||||
applyColorCorrectionField.checked = parseBoolean(preserve_init_image_color_profile)
|
||||
},
|
||||
readUI: () => applyColorCorrectionField.checked,
|
||||
parse: (val) => parseBoolean(val)
|
||||
parse: (val) => parseBoolean(val),
|
||||
},
|
||||
|
||||
use_face_correction: {
|
||||
@ -186,7 +186,7 @@ const TASK_MAPPING = {
|
||||
//useFaceCorrectionField.checked = parseBoolean(use_face_correction)
|
||||
},
|
||||
readUI: () => (useFaceCorrectionField.checked ? gfpganModelField.value : undefined),
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
use_upscale: {
|
||||
name: "Use Upscaling",
|
||||
@ -207,7 +207,7 @@ const TASK_MAPPING = {
|
||||
}
|
||||
},
|
||||
readUI: () => (useUpscalingField.checked ? upscaleModelField.value : undefined),
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
upscale_amount: {
|
||||
name: "Upscale By",
|
||||
@ -215,7 +215,7 @@ const TASK_MAPPING = {
|
||||
upscaleAmountField.value = upscale_amount
|
||||
},
|
||||
readUI: () => upscaleAmountField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
sampler_name: {
|
||||
name: "Sampler",
|
||||
@ -223,7 +223,7 @@ const TASK_MAPPING = {
|
||||
samplerField.value = sampler_name
|
||||
},
|
||||
readUI: () => samplerField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
use_stable_diffusion_model: {
|
||||
name: "Stable Diffusion model",
|
||||
@ -238,7 +238,7 @@ const TASK_MAPPING = {
|
||||
}
|
||||
},
|
||||
readUI: () => stableDiffusionModelField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
use_vae_model: {
|
||||
name: "VAE model",
|
||||
@ -254,7 +254,7 @@ const TASK_MAPPING = {
|
||||
vaeModelField.value = use_vae_model
|
||||
},
|
||||
readUI: () => vaeModelField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
use_lora_model: {
|
||||
name: "LoRA model",
|
||||
@ -272,7 +272,7 @@ const TASK_MAPPING = {
|
||||
loraModelField.value = use_lora_model
|
||||
},
|
||||
readUI: () => loraModelField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
lora_alpha: {
|
||||
name: "LoRA Strength",
|
||||
@ -281,7 +281,7 @@ const TASK_MAPPING = {
|
||||
updateLoraAlphaSlider()
|
||||
},
|
||||
readUI: () => parseFloat(loraAlphaField.value),
|
||||
parse: (val) => parseFloat(val)
|
||||
parse: (val) => parseFloat(val),
|
||||
},
|
||||
use_hypernetwork_model: {
|
||||
name: "Hypernetwork model",
|
||||
@ -302,7 +302,7 @@ const TASK_MAPPING = {
|
||||
hypernetworkModelField.dispatchEvent(new Event("change"))
|
||||
},
|
||||
readUI: () => hypernetworkModelField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
hypernetwork_strength: {
|
||||
name: "Hypernetwork Strength",
|
||||
@ -311,7 +311,7 @@ const TASK_MAPPING = {
|
||||
updateHypernetworkStrengthSlider()
|
||||
},
|
||||
readUI: () => parseFloat(hypernetworkStrengthField.value),
|
||||
parse: (val) => parseFloat(val)
|
||||
parse: (val) => parseFloat(val),
|
||||
},
|
||||
|
||||
num_outputs: {
|
||||
@ -320,7 +320,7 @@ const TASK_MAPPING = {
|
||||
numOutputsParallelField.value = num_outputs
|
||||
},
|
||||
readUI: () => parseInt(numOutputsParallelField.value),
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
|
||||
use_cpu: {
|
||||
@ -329,7 +329,7 @@ const TASK_MAPPING = {
|
||||
useCPUField.checked = use_cpu
|
||||
},
|
||||
readUI: () => useCPUField.checked,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
|
||||
stream_image_progress: {
|
||||
@ -338,7 +338,7 @@ const TASK_MAPPING = {
|
||||
streamImageProgressField.checked = parseInt(numOutputsTotalField.value) > 50 ? false : stream_image_progress
|
||||
},
|
||||
readUI: () => streamImageProgressField.checked,
|
||||
parse: (val) => Boolean(val)
|
||||
parse: (val) => Boolean(val),
|
||||
},
|
||||
show_only_filtered_image: {
|
||||
name: "Show only the corrected/upscaled image",
|
||||
@ -346,7 +346,7 @@ const TASK_MAPPING = {
|
||||
showOnlyFilteredImageField.checked = show_only_filtered_image
|
||||
},
|
||||
readUI: () => showOnlyFilteredImageField.checked,
|
||||
parse: (val) => Boolean(val)
|
||||
parse: (val) => Boolean(val),
|
||||
},
|
||||
output_format: {
|
||||
name: "Output Format",
|
||||
@ -354,7 +354,7 @@ const TASK_MAPPING = {
|
||||
outputFormatField.value = output_format
|
||||
},
|
||||
readUI: () => outputFormatField.value,
|
||||
parse: (val) => val
|
||||
parse: (val) => val,
|
||||
},
|
||||
save_to_disk_path: {
|
||||
name: "Save to disk path",
|
||||
@ -363,8 +363,8 @@ const TASK_MAPPING = {
|
||||
diskPathField.value = save_to_disk_path
|
||||
},
|
||||
readUI: () => diskPathField.value,
|
||||
parse: (val) => val
|
||||
}
|
||||
parse: (val) => val,
|
||||
},
|
||||
}
|
||||
|
||||
function restoreTaskToUI(task, fieldsToSkip) {
|
||||
@ -445,7 +445,7 @@ function readUI() {
|
||||
return {
|
||||
numOutputsTotal: parseInt(numOutputsTotalField.value),
|
||||
seed: TASK_MAPPING["seed"].readUI(),
|
||||
reqBody: reqBody
|
||||
reqBody: reqBody,
|
||||
}
|
||||
}
|
||||
function getModelPath(filename, extensions) {
|
||||
@ -485,7 +485,7 @@ const TASK_TEXT_MAPPING = {
|
||||
negative_prompt: "Negative Prompt",
|
||||
use_stable_diffusion_model: "Stable Diffusion model",
|
||||
use_hypernetwork_model: "Hypernetwork model",
|
||||
hypernetwork_strength: "Hypernetwork Strength"
|
||||
hypernetwork_strength: "Hypernetwork Strength",
|
||||
}
|
||||
function parseTaskFromText(str) {
|
||||
const taskReqBody = {}
|
||||
|
@ -32,8 +32,8 @@
|
||||
this.#fetchOptions = Object.assign(
|
||||
{
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
},
|
||||
options
|
||||
)
|
||||
@ -197,7 +197,7 @@
|
||||
EVENT_TASK_END,
|
||||
EVENT_TASK_ERROR,
|
||||
|
||||
EVENT_UNEXPECTED_RESPONSE
|
||||
EVENT_UNEXPECTED_RESPONSE,
|
||||
]
|
||||
Object.freeze(EVENTS_TYPES)
|
||||
const eventSource = new GenericEventSource(EVENTS_TYPES)
|
||||
@ -211,7 +211,7 @@
|
||||
loadingModel: "LoadingModel",
|
||||
online: "Online",
|
||||
rendering: "Rendering",
|
||||
unavailable: "Unavailable"
|
||||
unavailable: "Unavailable",
|
||||
}
|
||||
Object.freeze(ServerStates)
|
||||
|
||||
@ -332,7 +332,7 @@
|
||||
processing: "processing",
|
||||
stopped: "stopped",
|
||||
completed: "completed",
|
||||
failed: "failed"
|
||||
failed: "failed",
|
||||
}
|
||||
Object.freeze(TaskStatus)
|
||||
|
||||
@ -340,7 +340,7 @@
|
||||
TaskStatus.init,
|
||||
TaskStatus.pending,
|
||||
TaskStatus.waiting,
|
||||
TaskStatus.processing
|
||||
TaskStatus.processing,
|
||||
//Don't add status that are final.
|
||||
]
|
||||
|
||||
@ -466,10 +466,10 @@
|
||||
res = await fetch(url, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(this._reqBody),
|
||||
signal: abortSignal
|
||||
signal: abortSignal,
|
||||
})
|
||||
// status_code 503, already a task running.
|
||||
} while (res.status === 503 && (await asyncDelay(RETRY_DELAY_IF_SERVER_IS_BUSY)))
|
||||
@ -758,7 +758,7 @@
|
||||
stream_image_progress: "boolean",
|
||||
show_only_filtered_image: "boolean",
|
||||
output_format: "string",
|
||||
output_quality: "number"
|
||||
output_quality: "number",
|
||||
}
|
||||
const TASK_DEFAULTS = {
|
||||
sampler_name: "plms",
|
||||
@ -774,7 +774,7 @@
|
||||
block_nsfw: false,
|
||||
output_format: "png",
|
||||
output_quality: 75,
|
||||
output_lossless: false
|
||||
output_lossless: false,
|
||||
}
|
||||
const TASK_OPTIONAL = {
|
||||
device: "string",
|
||||
@ -786,7 +786,7 @@
|
||||
use_vae_model: "string",
|
||||
use_hypernetwork_model: "string",
|
||||
hypernetwork_strength: "number",
|
||||
output_lossless: "boolean"
|
||||
output_lossless: "boolean",
|
||||
}
|
||||
|
||||
// Higer values will result in...
|
||||
@ -941,7 +941,7 @@
|
||||
callback: function() {
|
||||
return progressCallback?.call(this, {})
|
||||
},
|
||||
status: TaskStatus.processing
|
||||
status: TaskStatus.processing,
|
||||
})
|
||||
} catch (e) {
|
||||
this.abort(err)
|
||||
@ -1086,9 +1086,9 @@
|
||||
let systemInfo = {
|
||||
devices: {
|
||||
all: {},
|
||||
active: {}
|
||||
active: {},
|
||||
},
|
||||
hosts: []
|
||||
hosts: [],
|
||||
}
|
||||
try {
|
||||
const res = await fetch("/get/system_info")
|
||||
@ -1117,7 +1117,7 @@
|
||||
async function getModels() {
|
||||
let models = {
|
||||
"stable-diffusion": [],
|
||||
vae: []
|
||||
vae: [],
|
||||
}
|
||||
try {
|
||||
const res = await fetch("/get/models")
|
||||
@ -1147,7 +1147,7 @@
|
||||
const inputPendingOptions = {
|
||||
// Report mouse/pointer move events when queue is empty.
|
||||
// Delay idle after mouse moves stops.
|
||||
includeContinuous: Boolean(task_queue.size <= 0 && concurrent_generators.size <= 0)
|
||||
includeContinuous: Boolean(task_queue.size <= 0 && concurrent_generators.size <= 0),
|
||||
}
|
||||
if (navigator.scheduling.isInputPending(inputPendingOptions)) {
|
||||
// Browser/User still active.
|
||||
@ -1217,7 +1217,7 @@
|
||||
eventSource.fireEvent(EVENT_TASK_ERROR, {
|
||||
task,
|
||||
generator,
|
||||
reason: cTsk?.promise?.rejectReason || task.exception
|
||||
reason: cTsk?.promise?.rejectReason || task.exception,
|
||||
})
|
||||
task_queue.delete(task)
|
||||
continue
|
||||
@ -1313,21 +1313,21 @@
|
||||
|
||||
render: (...args) => RenderTask.run(...args),
|
||||
filter: (...args) => FilterTask.run(...args),
|
||||
waitUntil
|
||||
waitUntil,
|
||||
}
|
||||
|
||||
Object.defineProperties(SD, {
|
||||
serverState: {
|
||||
configurable: false,
|
||||
get: () => serverState
|
||||
get: () => serverState,
|
||||
},
|
||||
isAvailable: {
|
||||
configurable: false,
|
||||
get: () => isServerAvailable()
|
||||
get: () => isServerAvailable(),
|
||||
},
|
||||
serverCapacity: {
|
||||
configurable: false,
|
||||
get: () => getServerCapacity()
|
||||
get: () => getServerCapacity(),
|
||||
},
|
||||
sessionId: {
|
||||
configurable: false,
|
||||
@ -1337,21 +1337,21 @@
|
||||
throw new Error("Can't set sessionId to undefined.")
|
||||
}
|
||||
sessionId = val
|
||||
}
|
||||
},
|
||||
},
|
||||
MAX_SEED_VALUE: {
|
||||
configurable: false,
|
||||
get: () => MAX_SEED_VALUE
|
||||
get: () => MAX_SEED_VALUE,
|
||||
},
|
||||
activeTasks: {
|
||||
configurable: false,
|
||||
get: () => task_queue
|
||||
}
|
||||
get: () => task_queue,
|
||||
},
|
||||
})
|
||||
Object.defineProperties(getGlobal(), {
|
||||
SD: {
|
||||
configurable: false,
|
||||
get: () => SD
|
||||
get: () => SD,
|
||||
},
|
||||
sessionId: {
|
||||
//TODO Remove in the future in favor of SD.sessionId
|
||||
@ -1365,7 +1365,7 @@
|
||||
console.warn("Deprecated window.sessionId has been replaced with SD.sessionId.")
|
||||
console.trace()
|
||||
SD.sessionId = val
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
})
|
||||
})()
|
||||
|
@ -8,15 +8,15 @@ const IMAGE_EDITOR_BUTTONS = [
|
||||
icon: "fa-regular fa-circle-xmark",
|
||||
handler: (editor) => {
|
||||
editor.hide()
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "Save",
|
||||
icon: "fa-solid fa-floppy-disk",
|
||||
handler: (editor) => {
|
||||
editor.saveImage()
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
const defaultToolBegin = (editor, ctx, x, y, is_overlay = false) => {
|
||||
@ -46,7 +46,7 @@ const IMAGE_EDITOR_TOOLS = [
|
||||
cursor: "url(/media/images/fa-pencil.svg) 0 24, pointer",
|
||||
begin: defaultToolBegin,
|
||||
move: defaultToolMove,
|
||||
end: defaultToolEnd
|
||||
end: defaultToolEnd,
|
||||
},
|
||||
{
|
||||
id: "erase",
|
||||
@ -76,7 +76,7 @@ const IMAGE_EDITOR_TOOLS = [
|
||||
},
|
||||
setBrush: (editor, layer) => {
|
||||
layer.ctx.globalCompositeOperation = "destination-out"
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "fill",
|
||||
@ -91,7 +91,7 @@ const IMAGE_EDITOR_TOOLS = [
|
||||
}
|
||||
},
|
||||
move: toolDoNothing,
|
||||
end: toolDoNothing
|
||||
end: toolDoNothing,
|
||||
},
|
||||
{
|
||||
id: "colorpicker",
|
||||
@ -106,14 +106,14 @@ const IMAGE_EDITOR_TOOLS = [
|
||||
editor.custom_color_input.value = rgbToHex({
|
||||
r: drawn_rgb[0] * drawn_opacity + img_rgb[0] * (1 - drawn_opacity),
|
||||
g: drawn_rgb[1] * drawn_opacity + img_rgb[1] * (1 - drawn_opacity),
|
||||
b: drawn_rgb[2] * drawn_opacity + img_rgb[2] * (1 - drawn_opacity)
|
||||
b: drawn_rgb[2] * drawn_opacity + img_rgb[2] * (1 - drawn_opacity),
|
||||
})
|
||||
editor.custom_color_input.dispatchEvent(new Event("change"))
|
||||
}
|
||||
},
|
||||
move: toolDoNothing,
|
||||
end: toolDoNothing
|
||||
}
|
||||
end: toolDoNothing,
|
||||
},
|
||||
]
|
||||
|
||||
const IMAGE_EDITOR_ACTIONS = [
|
||||
@ -151,7 +151,7 @@ const IMAGE_EDITOR_ACTIONS = [
|
||||
|
||||
el.click()
|
||||
},
|
||||
trackHistory: true
|
||||
trackHistory: true,
|
||||
},
|
||||
{
|
||||
id: "fill_all",
|
||||
@ -163,7 +163,7 @@ const IMAGE_EDITOR_ACTIONS = [
|
||||
editor.ctx_current.fill()
|
||||
editor.setBrush()
|
||||
},
|
||||
trackHistory: true
|
||||
trackHistory: true,
|
||||
},
|
||||
{
|
||||
id: "clear",
|
||||
@ -173,7 +173,7 @@ const IMAGE_EDITOR_ACTIONS = [
|
||||
editor.ctx_current.clearRect(0, 0, editor.width, editor.height)
|
||||
imageEditor.setImage(null, editor.width, editor.height) // properly reset the drawing canvas
|
||||
},
|
||||
trackHistory: true
|
||||
trackHistory: true,
|
||||
},
|
||||
{
|
||||
id: "undo",
|
||||
@ -182,7 +182,7 @@ const IMAGE_EDITOR_ACTIONS = [
|
||||
handler: (editor) => {
|
||||
editor.history.undo()
|
||||
},
|
||||
trackHistory: false
|
||||
trackHistory: false,
|
||||
},
|
||||
{
|
||||
id: "redo",
|
||||
@ -191,8 +191,8 @@ const IMAGE_EDITOR_ACTIONS = [
|
||||
handler: (editor) => {
|
||||
editor.history.redo()
|
||||
},
|
||||
trackHistory: false
|
||||
}
|
||||
trackHistory: false,
|
||||
},
|
||||
]
|
||||
|
||||
var IMAGE_EDITOR_SECTIONS = [
|
||||
@ -210,7 +210,7 @@ var IMAGE_EDITOR_SECTIONS = [
|
||||
sub_element.appendChild(icon)
|
||||
sub_element.append(tool_info.name)
|
||||
element.appendChild(sub_element)
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "color",
|
||||
@ -257,7 +257,7 @@ var IMAGE_EDITOR_SECTIONS = [
|
||||
"#c0c0c0",
|
||||
"#838383",
|
||||
"#525252",
|
||||
"#000000"
|
||||
"#000000",
|
||||
],
|
||||
initElement: (element, option) => {
|
||||
if (option == "custom") {
|
||||
@ -277,7 +277,7 @@ var IMAGE_EDITOR_SECTIONS = [
|
||||
getCustom: (editor) => {
|
||||
var input = editor.popup.querySelector(".image_editor_color input")
|
||||
return input.value
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "brush_size",
|
||||
@ -290,7 +290,7 @@ var IMAGE_EDITOR_SECTIONS = [
|
||||
element.style.height = option + "px"
|
||||
element.style["margin-right"] = "2px"
|
||||
element.style["border-radius"] = (option / 2).toFixed() + "px"
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "opacity",
|
||||
@ -299,7 +299,7 @@ var IMAGE_EDITOR_SECTIONS = [
|
||||
options: [0, 0.2, 0.4, 0.6, 0.8],
|
||||
initElement: (element, option) => {
|
||||
element.style.background = `repeating-conic-gradient(rgba(0, 0, 0, ${option}) 0% 25%, rgba(255, 255, 255, ${option}) 0% 50%) 50% / 10px 10px`
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "sharpness",
|
||||
@ -317,8 +317,8 @@ var IMAGE_EDITOR_SECTIONS = [
|
||||
sub_element.style["border-radius"] = `${size}px`
|
||||
element.style.background = "none"
|
||||
element.appendChild(sub_element)
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
]
|
||||
|
||||
class EditorHistory {
|
||||
@ -343,7 +343,7 @@ class EditorHistory {
|
||||
pushAction(action) {
|
||||
this.push({
|
||||
type: "action",
|
||||
id: action
|
||||
id: action,
|
||||
})
|
||||
}
|
||||
editBegin(x, y) {
|
||||
@ -351,7 +351,7 @@ class EditorHistory {
|
||||
type: "edit",
|
||||
id: this.editor.getOptionValue("tool"),
|
||||
options: Object.assign({}, this.editor.options),
|
||||
points: [{ x: x, y: y }]
|
||||
points: [{ x: x, y: y }],
|
||||
}
|
||||
}
|
||||
editMove(x, y) {
|
||||
@ -441,7 +441,7 @@ class ImageEditor {
|
||||
this.layers[name] = {
|
||||
name: name,
|
||||
canvas: canvas,
|
||||
ctx: canvas.getContext("2d")
|
||||
ctx: canvas.getContext("2d"),
|
||||
}
|
||||
})
|
||||
|
||||
@ -739,7 +739,7 @@ class ImageEditor {
|
||||
touchstart: "mousedown",
|
||||
touchmove: "mousemove",
|
||||
touchend: "mouseup",
|
||||
touchcancel: "mouseup"
|
||||
touchcancel: "mouseup",
|
||||
}
|
||||
if (type in touchmap) {
|
||||
type = touchmap[type]
|
||||
@ -824,7 +824,7 @@ function hexToRgb(hex) {
|
||||
? {
|
||||
r: parseInt(result[1], 16),
|
||||
g: parseInt(result[2], 16),
|
||||
b: parseInt(result[3], 16)
|
||||
b: parseInt(result[3], 16),
|
||||
}
|
||||
: null
|
||||
}
|
||||
@ -842,14 +842,14 @@ function flood_fill(editor, the_canvas_context, x, y, color) {
|
||||
r: pixels.data[linear_cords],
|
||||
g: pixels.data[linear_cords + 1],
|
||||
b: pixels.data[linear_cords + 2],
|
||||
a: pixels.data[linear_cords + 3]
|
||||
a: pixels.data[linear_cords + 3],
|
||||
}
|
||||
|
||||
var opacity = color.a / 255
|
||||
var new_color = {
|
||||
r: parseInt(color.r * opacity + original_color.r * (1 - opacity)),
|
||||
g: parseInt(color.g * opacity + original_color.g * (1 - opacity)),
|
||||
b: parseInt(color.b * opacity + original_color.b * (1 - opacity))
|
||||
b: parseInt(color.b * opacity + original_color.b * (1 - opacity)),
|
||||
}
|
||||
|
||||
if (
|
||||
@ -869,8 +869,8 @@ function flood_fill(editor, the_canvas_context, x, y, color) {
|
||||
while (
|
||||
y-- >= 0 &&
|
||||
pixelCompare(pixels.data[linear_cords], original_color.r) &&
|
||||
pixelCompare(pixels.data[linear_cords + 1], original_color.g) &&
|
||||
pixelCompare(pixels.data[linear_cords + 2], original_color.b)
|
||||
pixelCompare(pixels.data[linear_cords + 1], original_color.g) &&
|
||||
pixelCompare(pixels.data[linear_cords + 2], original_color.b)
|
||||
) {
|
||||
linear_cords -= editor.width * 4
|
||||
}
|
||||
@ -882,8 +882,8 @@ function flood_fill(editor, the_canvas_context, x, y, color) {
|
||||
while (
|
||||
y++ < editor.height &&
|
||||
pixelCompare(pixels.data[linear_cords], original_color.r) &&
|
||||
pixelCompare(pixels.data[linear_cords + 1], original_color.g) &&
|
||||
pixelCompare(pixels.data[linear_cords + 2], original_color.b)
|
||||
pixelCompare(pixels.data[linear_cords + 1], original_color.g) &&
|
||||
pixelCompare(pixels.data[linear_cords + 2], original_color.b)
|
||||
) {
|
||||
pixels.data[linear_cords] = new_color.r
|
||||
pixels.data[linear_cords + 1] = new_color.g
|
||||
|
@ -65,7 +65,7 @@ const imageModal = (function() {
|
||||
|
||||
const state = {
|
||||
previous: undefined,
|
||||
next: undefined
|
||||
next: undefined,
|
||||
}
|
||||
|
||||
const clear = () => {
|
||||
|
@ -106,7 +106,7 @@ function createModifierGroup(modifierGroup, initiallyExpanded, removeBy) {
|
||||
name: modifierName,
|
||||
element: modifierCard.cloneNode(true),
|
||||
originElement: modifierCard,
|
||||
previews: modifierPreviews
|
||||
previews: modifierPreviews,
|
||||
})
|
||||
toggleCardState(trimmedName, true)
|
||||
}
|
||||
@ -198,7 +198,7 @@ function refreshModifiersState(newTags, inactiveTags) {
|
||||
activeTags.push({
|
||||
name: tag,
|
||||
element: imageModifierCard,
|
||||
originElement: modifierCard
|
||||
originElement: modifierCard,
|
||||
})
|
||||
}
|
||||
modifierCard.classList.add(activeCardClass)
|
||||
@ -224,7 +224,7 @@ function refreshModifiersState(newTags, inactiveTags) {
|
||||
activeTags.push({
|
||||
name: tag,
|
||||
element: modifierCard,
|
||||
originElement: undefined // no origin element for missing tags
|
||||
originElement: undefined, // no origin element for missing tags
|
||||
})
|
||||
}
|
||||
})
|
||||
|
@ -15,34 +15,34 @@ const taskConfigSetup = {
|
||||
use_stable_diffusion_model: "Model",
|
||||
use_vae_model: {
|
||||
label: "VAE",
|
||||
visible: ({ reqBody }) => reqBody?.use_vae_model !== undefined && reqBody?.use_vae_model.trim() !== ""
|
||||
visible: ({ reqBody }) => reqBody?.use_vae_model !== undefined && reqBody?.use_vae_model.trim() !== "",
|
||||
},
|
||||
negative_prompt: {
|
||||
label: "Negative Prompt",
|
||||
visible: ({ reqBody }) => reqBody?.negative_prompt !== undefined && reqBody?.negative_prompt.trim() !== ""
|
||||
visible: ({ reqBody }) => reqBody?.negative_prompt !== undefined && reqBody?.negative_prompt.trim() !== "",
|
||||
},
|
||||
prompt_strength: "Prompt Strength",
|
||||
use_face_correction: "Fix Faces",
|
||||
upscale: {
|
||||
value: ({ reqBody }) => `${reqBody?.use_upscale} (${reqBody?.upscale_amount || 4}x)`,
|
||||
label: "Upscale",
|
||||
visible: ({ reqBody }) => !!reqBody?.use_upscale
|
||||
visible: ({ reqBody }) => !!reqBody?.use_upscale,
|
||||
},
|
||||
use_hypernetwork_model: "Hypernetwork",
|
||||
hypernetwork_strength: {
|
||||
label: "Hypernetwork Strength",
|
||||
visible: ({ reqBody }) => !!reqBody?.use_hypernetwork_model
|
||||
visible: ({ reqBody }) => !!reqBody?.use_hypernetwork_model,
|
||||
},
|
||||
use_lora_model: { label: "Lora Model", 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",
|
||||
},
|
||||
pluginTaskConfig: {},
|
||||
getCSSKey: (key) =>
|
||||
key
|
||||
.split("_")
|
||||
.map((s) => s.charAt(0).toUpperCase() + s.slice(1))
|
||||
.join("")
|
||||
.join(""),
|
||||
}
|
||||
|
||||
let imageCounter = 0
|
||||
@ -263,8 +263,8 @@ function shiftOrConfirm(e, prompt, fn) {
|
||||
yes: () => {
|
||||
fn(e)
|
||||
},
|
||||
cancel: () => {}
|
||||
}
|
||||
cancel: () => {},
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
@ -309,7 +309,7 @@ function undoableRemove(element, doubleUndo = false) {
|
||||
parent: element.parentNode,
|
||||
prev: element.previousSibling,
|
||||
next: element.nextSibling,
|
||||
doubleUndo: doubleUndo
|
||||
doubleUndo: doubleUndo,
|
||||
}
|
||||
undoBuffer.push(data)
|
||||
if (undoBuffer.length > UNDO_LIMIT) {
|
||||
@ -448,7 +448,7 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
||||
return {
|
||||
src: img.src,
|
||||
previous: previousImg ? () => imageModalParameter(previousImg) : undefined,
|
||||
next: nextImg ? () => imageModalParameter(nextImg) : undefined
|
||||
next: nextImg ? () => imageModalParameter(nextImg) : undefined,
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,7 +456,7 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
||||
})
|
||||
|
||||
const req = Object.assign({}, reqBody, {
|
||||
seed: result?.seed || reqBody.seed
|
||||
seed: result?.seed || reqBody.seed,
|
||||
})
|
||||
imageElem.setAttribute("data-seed", req.seed)
|
||||
imageElem.setAttribute("data-imagecounter", ++imageCounter)
|
||||
@ -470,20 +470,20 @@ function showImages(reqBody, res, outputContainer, livePreview) {
|
||||
{
|
||||
html: '<i class="fa-solid fa-download"></i> Download Image',
|
||||
on_click: onDownloadImageClick,
|
||||
class: "download-img"
|
||||
class: "download-img",
|
||||
},
|
||||
{
|
||||
html: '<i class="fa-solid fa-download"></i> JSON',
|
||||
on_click: onDownloadJSONClick,
|
||||
class: "download-json"
|
||||
}
|
||||
class: "download-json",
|
||||
},
|
||||
],
|
||||
{ text: "Make Similar Images", on_click: onMakeSimilarClick },
|
||||
{ text: "Draw another 25 steps", on_click: onContinueDrawingClick },
|
||||
[
|
||||
{ text: "Upscale", on_click: onUpscaleClick, filter: (req, img) => !req.use_upscale },
|
||||
{ text: "Fix Faces", on_click: onFixFacesClick, filter: (req, img) => !req.use_face_correction }
|
||||
]
|
||||
{ text: "Fix Faces", on_click: onFixFacesClick, filter: (req, img) => !req.use_face_correction },
|
||||
],
|
||||
]
|
||||
|
||||
// include the plugins
|
||||
@ -583,7 +583,7 @@ function modifyCurrentRequest(...reqDiff) {
|
||||
const newTaskRequest = getCurrentUserRequest()
|
||||
|
||||
newTaskRequest.reqBody = Object.assign(newTaskRequest.reqBody, ...reqDiff, {
|
||||
use_cpu: useCPUField.checked
|
||||
use_cpu: useCPUField.checked,
|
||||
})
|
||||
newTaskRequest.seed = newTaskRequest.reqBody.seed
|
||||
|
||||
@ -597,7 +597,7 @@ function onMakeSimilarClick(req, img) {
|
||||
guidance_scale: 7.5,
|
||||
prompt_strength: 0.7,
|
||||
init_image: img.src,
|
||||
seed: Math.floor(Math.random() * 10000000)
|
||||
seed: Math.floor(Math.random() * 10000000),
|
||||
})
|
||||
|
||||
newTaskRequest.numOutputsTotal = 5
|
||||
@ -613,7 +613,7 @@ function enqueueImageVariationTask(req, img, reqDiff) {
|
||||
|
||||
const newRequestBody = {
|
||||
num_outputs: 1, // this can be user-configurable in the future
|
||||
seed: imageSeed
|
||||
seed: imageSeed,
|
||||
}
|
||||
|
||||
// If the user is editing pictures, stop modifyCurrentRequest from importing
|
||||
@ -634,19 +634,19 @@ function enqueueImageVariationTask(req, img, reqDiff) {
|
||||
|
||||
function onUpscaleClick(req, img) {
|
||||
enqueueImageVariationTask(req, img, {
|
||||
use_upscale: upscaleModelField.value
|
||||
use_upscale: upscaleModelField.value,
|
||||
})
|
||||
}
|
||||
|
||||
function onFixFacesClick(req, img) {
|
||||
enqueueImageVariationTask(req, img, {
|
||||
use_face_correction: gfpganModelField.value
|
||||
use_face_correction: gfpganModelField.value,
|
||||
})
|
||||
}
|
||||
|
||||
function onContinueDrawingClick(req, img) {
|
||||
enqueueImageVariationTask(req, img, {
|
||||
num_inference_steps: parseInt(req.num_inference_steps) + 25
|
||||
num_inference_steps: parseInt(req.num_inference_steps) + 25,
|
||||
})
|
||||
}
|
||||
|
||||
@ -695,7 +695,7 @@ function makeImage() {
|
||||
const taskTemplate = getCurrentUserRequest()
|
||||
const newTaskRequests = getPrompts().map((prompt) =>
|
||||
Object.assign({}, taskTemplate, {
|
||||
reqBody: Object.assign({ prompt: prompt }, taskTemplate.reqBody)
|
||||
reqBody: Object.assign({ prompt: prompt }, taskTemplate.reqBody),
|
||||
})
|
||||
)
|
||||
newTaskRequests.forEach(createTask)
|
||||
@ -876,7 +876,7 @@ function onTaskCompleted(task, reqBody, instance, outputContainer, stepUpdate) {
|
||||
1. If you have set an initial image, please try reducing its dimension to ${MAX_INIT_IMAGE_DIMENSION}x${MAX_INIT_IMAGE_DIMENSION} or smaller.<br/>
|
||||
2. Try picking a lower level in the '<em>GPU Memory Usage</em>' setting (in the '<em>Settings</em>' tab).<br/>
|
||||
3. Try generating a smaller image.<br/>`
|
||||
} else if (msg.toLowerCase().includes('DefaultCPUAllocator: not enough memory')) {
|
||||
} else if (msg.toLowerCase().includes("DefaultCPUAllocator: not enough memory")) {
|
||||
msg += `<br/><br/>
|
||||
Reason: Your computer is running out of system RAM!
|
||||
<br/>
|
||||
@ -1232,8 +1232,8 @@ function getCurrentUserRequest() {
|
||||
metadata_output_format: metadataOutputFormatField.value,
|
||||
original_prompt: promptField.value,
|
||||
active_tags: activeTags.map((x) => x.name),
|
||||
inactive_tags: activeTags.filter((tag) => tag.inactive === true).map((x) => x.name)
|
||||
}
|
||||
inactive_tags: activeTags.filter((tag) => tag.inactive === true).map((x) => x.name),
|
||||
},
|
||||
}
|
||||
if (IMAGE_REGEX.test(initImagePreview.src)) {
|
||||
newTask.reqBody.init_image = initImagePreview.src
|
||||
@ -1870,7 +1870,7 @@ function linkTabContents(tab) {
|
||||
tabElements.push({
|
||||
name: name,
|
||||
tab: tab,
|
||||
content: content
|
||||
content: content,
|
||||
})
|
||||
|
||||
tab.addEventListener("click", (event) => selectTab(tab.id))
|
||||
|
@ -8,7 +8,7 @@ var ParameterType = {
|
||||
select: "select",
|
||||
select_multiple: "select_multiple",
|
||||
slider: "slider",
|
||||
custom: "custom"
|
||||
custom: "custom",
|
||||
}
|
||||
|
||||
/**
|
||||
@ -36,10 +36,10 @@ var PARAMETERS = [
|
||||
// Note: options expanded dynamically
|
||||
{
|
||||
value: "theme-default",
|
||||
label: "Default"
|
||||
}
|
||||
label: "Default",
|
||||
},
|
||||
],
|
||||
icon: "fa-palette"
|
||||
icon: "fa-palette",
|
||||
},
|
||||
{
|
||||
id: "save_to_disk",
|
||||
@ -47,7 +47,7 @@ var PARAMETERS = [
|
||||
label: "Auto-Save Images",
|
||||
note: "automatically saves images to the specified location",
|
||||
icon: "fa-download",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "diskPath",
|
||||
@ -55,7 +55,7 @@ var PARAMETERS = [
|
||||
label: "Save Location",
|
||||
render: (parameter) => {
|
||||
return `<input id="${parameter.id}" name="${parameter.id}" size="30" disabled>`
|
||||
}
|
||||
},
|
||||
},
|
||||
{
|
||||
id: "metadata_output_format",
|
||||
@ -66,29 +66,29 @@ var PARAMETERS = [
|
||||
options: [
|
||||
{
|
||||
value: "none",
|
||||
label: "none"
|
||||
label: "none",
|
||||
},
|
||||
{
|
||||
value: "txt",
|
||||
label: "txt"
|
||||
label: "txt",
|
||||
},
|
||||
{
|
||||
value: "json",
|
||||
label: "json"
|
||||
label: "json",
|
||||
},
|
||||
{
|
||||
value: "embed",
|
||||
label: "embed"
|
||||
label: "embed",
|
||||
},
|
||||
{
|
||||
value: "embed,txt",
|
||||
label: "embed & txt"
|
||||
label: "embed & txt",
|
||||
},
|
||||
{
|
||||
value: "embed,json",
|
||||
label: "embed & json"
|
||||
}
|
||||
]
|
||||
label: "embed & json",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "block_nsfw",
|
||||
@ -96,7 +96,7 @@ var PARAMETERS = [
|
||||
label: "Block NSFW images",
|
||||
note: "blurs out NSFW images",
|
||||
icon: "fa-land-mine-on",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "sound_toggle",
|
||||
@ -104,7 +104,7 @@ var PARAMETERS = [
|
||||
label: "Enable Sound",
|
||||
note: "plays a sound on task completion",
|
||||
icon: "fa-volume-low",
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "process_order_toggle",
|
||||
@ -112,7 +112,7 @@ var PARAMETERS = [
|
||||
label: "Process newest jobs first",
|
||||
note: "reverse the normal processing order",
|
||||
icon: "fa-arrow-down-short-wide",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "ui_open_browser_on_start",
|
||||
@ -121,7 +121,7 @@ var PARAMETERS = [
|
||||
note: "starts the default browser on startup",
|
||||
icon: "fa-window-restore",
|
||||
default: true,
|
||||
saveInAppConfig: true
|
||||
saveInAppConfig: true,
|
||||
},
|
||||
{
|
||||
id: "vram_usage_level",
|
||||
@ -137,8 +137,8 @@ var PARAMETERS = [
|
||||
options: [
|
||||
{ value: "balanced", label: "Balanced" },
|
||||
{ value: "high", label: "High" },
|
||||
{ value: "low", label: "Low" }
|
||||
]
|
||||
{ value: "low", label: "Low" },
|
||||
],
|
||||
},
|
||||
{
|
||||
id: "use_cpu",
|
||||
@ -146,20 +146,20 @@ var PARAMETERS = [
|
||||
label: "Use CPU (not GPU)",
|
||||
note: "warning: this will be *very* slow",
|
||||
icon: "fa-microchip",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "auto_pick_gpus",
|
||||
type: ParameterType.checkbox,
|
||||
label: "Automatically pick the GPUs (experimental)",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "use_gpus",
|
||||
type: ParameterType.select_multiple,
|
||||
label: "GPUs to use (experimental)",
|
||||
note: "to process in parallel",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "auto_save_settings",
|
||||
@ -167,7 +167,7 @@ var PARAMETERS = [
|
||||
label: "Auto-Save Settings",
|
||||
note: "restores settings on browser load",
|
||||
icon: "fa-gear",
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "confirm_dangerous_actions",
|
||||
@ -176,7 +176,7 @@ var PARAMETERS = [
|
||||
note:
|
||||
"Actions that might lead to data loss must either be clicked with the shift key pressed, or confirmed in an 'Are you sure?' dialog",
|
||||
icon: "fa-check-double",
|
||||
default: true
|
||||
default: true,
|
||||
},
|
||||
{
|
||||
id: "listen_to_network",
|
||||
@ -185,7 +185,7 @@ var PARAMETERS = [
|
||||
note: "Other devices on your network can access this web page",
|
||||
icon: "fa-network-wired",
|
||||
default: true,
|
||||
saveInAppConfig: true
|
||||
saveInAppConfig: true,
|
||||
},
|
||||
{
|
||||
id: "listen_port",
|
||||
@ -196,7 +196,7 @@ var PARAMETERS = [
|
||||
render: (parameter) => {
|
||||
return `<input id="${parameter.id}" name="${parameter.id}" size="6" value="9000" onkeypress="preventNonNumericalInput(event)">`
|
||||
},
|
||||
saveInAppConfig: true
|
||||
saveInAppConfig: true,
|
||||
},
|
||||
{
|
||||
id: "use_beta_channel",
|
||||
@ -205,7 +205,7 @@ var PARAMETERS = [
|
||||
note:
|
||||
"Get the latest features immediately (but could be less stable). Please restart the program after changing this.",
|
||||
icon: "fa-fire",
|
||||
default: false
|
||||
default: false,
|
||||
},
|
||||
{
|
||||
id: "test_diffusers",
|
||||
@ -215,8 +215,8 @@ var PARAMETERS = [
|
||||
"<b>Experimental! Can have bugs!</b> Use upcoming features (like LoRA) in our new engine. Please press Save, then restart the program after changing this.",
|
||||
icon: "fa-bolt",
|
||||
default: false,
|
||||
saveInAppConfig: true
|
||||
}
|
||||
saveInAppConfig: true,
|
||||
},
|
||||
]
|
||||
|
||||
function getParameterSettingsEntry(id) {
|
||||
@ -309,7 +309,7 @@ function initParameters(parameters) {
|
||||
[
|
||||
createElement("div", undefined, undefined, icon),
|
||||
createElement("div", undefined, undefined, [labelElement, ...noteElements]),
|
||||
elementWrapper
|
||||
elementWrapper,
|
||||
]
|
||||
)
|
||||
parametersTable.appendChild(newrow)
|
||||
@ -353,9 +353,9 @@ async function changeAppConfig(configDelta) {
|
||||
let res = await fetch("/app_config", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify(configDelta)
|
||||
body: JSON.stringify(configDelta),
|
||||
})
|
||||
res = await res.json()
|
||||
|
||||
@ -607,7 +607,7 @@ saveSettingsBtn.addEventListener("click", function() {
|
||||
|
||||
const updateAppConfigRequest = {
|
||||
render_devices: getCurrentRenderDeviceSelection(),
|
||||
update_branch: updateBranch
|
||||
update_branch: updateBranch,
|
||||
}
|
||||
|
||||
Array.from(parametersTable.children).forEach((parameterRow) => {
|
||||
|
@ -38,7 +38,7 @@ const PLUGINS = {
|
||||
function webp() {
|
||||
return (reqBody) => new SD.RenderTask(reqBody)
|
||||
}
|
||||
)
|
||||
),
|
||||
}
|
||||
PLUGINS.OUTPUTS_FORMATS.register = function(...args) {
|
||||
const service = ServiceContainer.prototype.register.apply(this, args)
|
||||
|
@ -483,7 +483,7 @@ class ModelDropdown {
|
||||
createElement("i", { id: `${this.modelFilter.id}-model-filter-arrow` }, [
|
||||
"model-selector-arrow",
|
||||
"fa-solid",
|
||||
"fa-angle-down"
|
||||
"fa-angle-down",
|
||||
])
|
||||
)
|
||||
this.modelFilter.classList.add("model-selector")
|
||||
@ -547,7 +547,7 @@ class ModelDropdown {
|
||||
model,
|
||||
createElement("li", { "data-path": fullPath }, classes, [
|
||||
createElement("i", undefined, ["fa-regular", "fa-file", "icon"]),
|
||||
model
|
||||
model,
|
||||
])
|
||||
)
|
||||
}
|
||||
@ -596,7 +596,7 @@ class ModelDropdown {
|
||||
|
||||
if (modelTree.length > 0) {
|
||||
const containerListItem = createElement("li", { id: `${this.modelFilter.id}-model-result` }, [
|
||||
"model-result"
|
||||
"model-result",
|
||||
])
|
||||
//console.log(containerListItem)
|
||||
containerListItem.appendChild(this.createModelNodeList(undefined, modelTree, true))
|
||||
|
@ -30,14 +30,14 @@ function initTheme() {
|
||||
THEMES.push({
|
||||
key: theme_key,
|
||||
name: getThemeName(theme_key),
|
||||
rule: rule
|
||||
rule: rule,
|
||||
})
|
||||
}
|
||||
if (selector && selector == ":root") {
|
||||
DEFAULT_THEME = {
|
||||
key: "theme-default",
|
||||
name: "Default",
|
||||
rule: rule
|
||||
rule: rule,
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@ -111,7 +111,7 @@ function tryLoadOldCollapsibles() {
|
||||
const old_map = {
|
||||
advancedPanelOpen: "editor-settings",
|
||||
modifiersPanelOpen: "editor-modifiers",
|
||||
negativePromptPanelOpen: "editor-inputs-prompt"
|
||||
negativePromptPanelOpen: "editor-inputs-prompt",
|
||||
}
|
||||
if (localStorage.getItem(Object.keys(old_map)[0])) {
|
||||
let result = {}
|
||||
@ -195,7 +195,7 @@ function BraceExpander() {
|
||||
? bracePair(tkns, iPosn + 1, n, lst)
|
||||
: {
|
||||
close: iPosn,
|
||||
commas: lst
|
||||
commas: lst,
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ function BraceExpander() {
|
||||
? dctSofar
|
||||
: {
|
||||
fn: and,
|
||||
args: []
|
||||
args: [],
|
||||
},
|
||||
head = tkns[0],
|
||||
tail = head ? tkns.slice(1) : [],
|
||||
@ -217,7 +217,7 @@ function BraceExpander() {
|
||||
return andTree(
|
||||
{
|
||||
fn: and,
|
||||
args: dctParse.args.concat(lstOR ? orTree(dctParse, lstOR[0], dctBrace.commas) : head)
|
||||
args: dctParse.args.concat(lstOR ? orTree(dctParse, lstOR[0], dctBrace.commas) : head),
|
||||
},
|
||||
lstOR ? lstOR[1] : tail
|
||||
)
|
||||
@ -238,7 +238,7 @@ function BraceExpander() {
|
||||
})
|
||||
.map(function(ts) {
|
||||
return ts.length > 1 ? andTree(null, ts)[0] : ts[0]
|
||||
})
|
||||
}),
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,11 +344,11 @@ function PromiseSource() {
|
||||
const srcPromise = new Promise((resolve, reject) => {
|
||||
Object.defineProperties(this, {
|
||||
resolve: { value: resolve, writable: false },
|
||||
reject: { value: reject, writable: false }
|
||||
reject: { value: reject, writable: false },
|
||||
})
|
||||
})
|
||||
Object.defineProperties(this, {
|
||||
promise: { value: makeQuerablePromise(srcPromise), writable: false }
|
||||
promise: { value: makeQuerablePromise(srcPromise), writable: false },
|
||||
})
|
||||
}
|
||||
|
||||
@ -471,20 +471,20 @@ function makeQuerablePromise(promise) {
|
||||
)
|
||||
Object.defineProperties(qurPro, {
|
||||
isResolved: {
|
||||
get: () => isResolved
|
||||
get: () => isResolved,
|
||||
},
|
||||
resolvedValue: {
|
||||
get: () => resolvedValue
|
||||
get: () => resolvedValue,
|
||||
},
|
||||
isPending: {
|
||||
get: () => isPending
|
||||
get: () => isPending,
|
||||
},
|
||||
isRejected: {
|
||||
get: () => isRejected
|
||||
get: () => isRejected,
|
||||
},
|
||||
rejectReason: {
|
||||
get: () => rejectReason
|
||||
}
|
||||
get: () => rejectReason,
|
||||
},
|
||||
})
|
||||
return qurPro
|
||||
}
|
||||
@ -790,9 +790,9 @@ function createTab(request) {
|
||||
createElement("i", { style: "margin-right: 0.25em" }, [
|
||||
"fa-solid",
|
||||
`${request.icon.startsWith("fa-") ? "" : "fa-"}${request.icon}`,
|
||||
"icon"
|
||||
"icon",
|
||||
]),
|
||||
labelElement
|
||||
labelElement,
|
||||
])
|
||||
)
|
||||
|
||||
@ -831,7 +831,7 @@ function createTab(request) {
|
||||
contentElement: wrapper,
|
||||
labelElement,
|
||||
timesOpened,
|
||||
firstOpen: timesOpened === 1
|
||||
firstOpen: timesOpened === 1,
|
||||
},
|
||||
e
|
||||
)
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
observer.observe(document.getElementById("preview"), {
|
||||
childList: true,
|
||||
subtree: true
|
||||
subtree: true,
|
||||
})
|
||||
|
||||
function Autoscroll(target) {
|
||||
|
@ -25,7 +25,7 @@
|
||||
})
|
||||
|
||||
observer.observe(editorModifierTagsList, {
|
||||
childList: true
|
||||
childList: true,
|
||||
})
|
||||
|
||||
let current
|
||||
|
@ -18,7 +18,7 @@
|
||||
})
|
||||
|
||||
observer.observe(editorModifierTagsList, {
|
||||
childList: true
|
||||
childList: true,
|
||||
})
|
||||
|
||||
function ModifierMouseWheel(target) {
|
||||
|
@ -13,19 +13,19 @@
|
||||
customModifiers = customModifiers.filter((m) => m.trim() !== "")
|
||||
customModifiers = customModifiers.map(function(m) {
|
||||
return {
|
||||
modifier: m
|
||||
modifier: m,
|
||||
}
|
||||
})
|
||||
|
||||
let customGroup = {
|
||||
category: "Custom Modifiers",
|
||||
modifiers: customModifiers
|
||||
modifiers: customModifiers,
|
||||
}
|
||||
|
||||
customModifiersGroupElement = createModifierGroup(customGroup, true)
|
||||
|
||||
createCollapsibles(customModifiersGroupElement)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})()
|
||||
|
@ -45,7 +45,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
const queryString = new jasmine.QueryString({
|
||||
getWindowLocation: function() {
|
||||
return window.location
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
const filterSpecs = !!queryString.getParam("spec")
|
||||
@ -53,7 +53,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
const config = {
|
||||
stopOnSpecFailure: queryString.getParam("stopOnSpecFailure"),
|
||||
stopSpecOnExpectationFailure: queryString.getParam("stopSpecOnExpectationFailure"),
|
||||
hideDisabled: queryString.getParam("hideDisabled")
|
||||
hideDisabled: queryString.getParam("hideDisabled"),
|
||||
}
|
||||
|
||||
const random = queryString.getParam("random")
|
||||
@ -89,7 +89,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
return document.createTextNode.apply(document, arguments)
|
||||
},
|
||||
timer: new jasmine.Timer(),
|
||||
filterSpecs: filterSpecs
|
||||
filterSpecs: filterSpecs,
|
||||
})
|
||||
|
||||
/**
|
||||
@ -104,7 +104,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
const specFilter = new jasmine.HtmlSpecFilter({
|
||||
filterString: function() {
|
||||
return queryString.getParam("spec")
|
||||
}
|
||||
},
|
||||
})
|
||||
|
||||
config.specFilter = function(spec) {
|
||||
|
@ -106,7 +106,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom("a", {
|
||||
className: "jasmine-title",
|
||||
href: "http://jasmine.github.io/",
|
||||
target: "_blank"
|
||||
target: "_blank",
|
||||
}),
|
||||
createDom("span", { className: "jasmine-version" }, j$.version)
|
||||
),
|
||||
@ -163,7 +163,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom("li", {
|
||||
className: this.displaySpecInCorrectFormat(result),
|
||||
id: "spec_" + result.id,
|
||||
title: result.fullName
|
||||
title: result.fullName,
|
||||
})
|
||||
)
|
||||
|
||||
@ -246,7 +246,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
"a",
|
||||
{
|
||||
title: "randomized with seed " + order.seed,
|
||||
href: seedHref(order.seed)
|
||||
href: seedHref(order.seed),
|
||||
},
|
||||
order.seed
|
||||
)
|
||||
@ -428,7 +428,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom(
|
||||
"li",
|
||||
{
|
||||
className: "jasmine-suite-detail jasmine-" + resultNode.result.status
|
||||
className: "jasmine-suite-detail jasmine-" + resultNode.result.status,
|
||||
},
|
||||
createDom("a", { href: specHref(resultNode.result) }, resultNode.result.description)
|
||||
)
|
||||
@ -454,7 +454,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
"li",
|
||||
{
|
||||
className: "jasmine-" + resultNode.result.status,
|
||||
id: "spec-" + resultNode.result.id
|
||||
id: "spec-" + resultNode.result.id,
|
||||
},
|
||||
createDom("a", { href: specHref(resultNode.result) }, specDescription)
|
||||
)
|
||||
@ -477,7 +477,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom("input", {
|
||||
className: "jasmine-fail-fast",
|
||||
id: "jasmine-fail-fast",
|
||||
type: "checkbox"
|
||||
type: "checkbox",
|
||||
}),
|
||||
createDom(
|
||||
"label",
|
||||
@ -491,7 +491,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom("input", {
|
||||
className: "jasmine-throw",
|
||||
id: "jasmine-throw-failures",
|
||||
type: "checkbox"
|
||||
type: "checkbox",
|
||||
}),
|
||||
createDom(
|
||||
"label",
|
||||
@ -505,7 +505,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom("input", {
|
||||
className: "jasmine-random",
|
||||
id: "jasmine-random-order",
|
||||
type: "checkbox"
|
||||
type: "checkbox",
|
||||
}),
|
||||
createDom(
|
||||
"label",
|
||||
@ -519,7 +519,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
createDom("input", {
|
||||
className: "jasmine-disabled",
|
||||
id: "jasmine-hide-disabled",
|
||||
type: "checkbox"
|
||||
type: "checkbox",
|
||||
}),
|
||||
createDom(
|
||||
"label",
|
||||
@ -608,7 +608,7 @@ jasmineRequire.HtmlReporter = function(j$) {
|
||||
message: warning,
|
||||
stack: result.deprecationWarnings[i].stack,
|
||||
runnableName: result.fullName,
|
||||
runnableType: runnableType
|
||||
runnableType: runnableType,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -9,11 +9,11 @@ beforeEach(function() {
|
||||
return {
|
||||
compare: function(actual, expected) {
|
||||
return {
|
||||
pass: expected.includes(actual)
|
||||
pass: expected.includes(actual),
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})
|
||||
describe("stable-diffusion-ui", function() {
|
||||
@ -116,7 +116,7 @@ describe("stable-diffusion-ui", function() {
|
||||
value["foo"] = "bar"
|
||||
}
|
||||
return { value, done }
|
||||
}
|
||||
},
|
||||
})
|
||||
const gen2 = SD.Task.asGenerator({
|
||||
generator: gen1,
|
||||
@ -128,7 +128,7 @@ describe("stable-diffusion-ui", function() {
|
||||
value.test = 2 * value.test
|
||||
}
|
||||
return { value, done }
|
||||
}
|
||||
},
|
||||
})
|
||||
expect(await SD.Task.enqueue(gen2)).toEqual({ test: 32, foo: "bar" })
|
||||
})
|
||||
@ -153,7 +153,7 @@ describe("stable-diffusion-ui", function() {
|
||||
expect(typeof missing).toBe("undefined")
|
||||
return { foo: "bar" }
|
||||
},
|
||||
dependencies: ["ctx", "missing", "one", "foo"]
|
||||
dependencies: ["ctx", "missing", "one", "foo"],
|
||||
}
|
||||
)
|
||||
const fooObj = cont.get("foo")
|
||||
@ -180,7 +180,7 @@ describe("stable-diffusion-ui", function() {
|
||||
let res = await fetch("/render", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({
|
||||
prompt: "a photograph of an astronaut riding a horse",
|
||||
@ -199,8 +199,8 @@ describe("stable-diffusion-ui", function() {
|
||||
show_only_filtered_image: true,
|
||||
output_format: "jpeg",
|
||||
|
||||
session_id: JASMINE_SESSION_ID
|
||||
})
|
||||
session_id: JASMINE_SESSION_ID,
|
||||
}),
|
||||
})
|
||||
expect(res.ok).toBeTruthy()
|
||||
const renderRequest = await res.json()
|
||||
@ -283,7 +283,7 @@ describe("stable-diffusion-ui", function() {
|
||||
show_only_filtered_image: false,
|
||||
//"use_face_correction": 'GFPGANv1.3',
|
||||
use_upscale: "RealESRGAN_x4plus",
|
||||
session_id: JASMINE_SESSION_ID
|
||||
session_id: JASMINE_SESSION_ID,
|
||||
},
|
||||
function(event) {
|
||||
console.log(this, event)
|
||||
@ -314,7 +314,7 @@ describe("stable-diffusion-ui", function() {
|
||||
height: 128,
|
||||
seed: SD.MAX_SEED_VALUE,
|
||||
num_inference_steps: 10,
|
||||
session_id: JASMINE_SESSION_ID
|
||||
session_id: JASMINE_SESSION_ID,
|
||||
})
|
||||
expect(renderTask.status).toBe(SD.TaskStatus.init)
|
||||
|
||||
@ -326,7 +326,7 @@ describe("stable-diffusion-ui", function() {
|
||||
|
||||
await renderTask.waitUntil({
|
||||
state: SD.TaskStatus.processing,
|
||||
callback: () => console.log("Waiting for render task to start...")
|
||||
callback: () => console.log("Waiting for render task to start..."),
|
||||
})
|
||||
expect(renderTask.status).toBe(SD.TaskStatus.processing)
|
||||
|
||||
@ -362,7 +362,7 @@ describe("stable-diffusion-ui", function() {
|
||||
show_only_filtered_image: false,
|
||||
//"use_face_correction": 'GFPGANv1.3',
|
||||
use_upscale: "RealESRGAN_x4plus",
|
||||
session_id: JASMINE_SESSION_ID
|
||||
session_id: JASMINE_SESSION_ID,
|
||||
})
|
||||
await renderTask.enqueue(function(event) {
|
||||
console.log(this, event)
|
||||
|
@ -424,7 +424,7 @@
|
||||
let res = await fetch("/model/merge", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify(request)
|
||||
body: JSON.stringify(request),
|
||||
})
|
||||
const data = await res.json()
|
||||
addLogMessage(JSON.stringify(data))
|
||||
@ -445,6 +445,6 @@
|
||||
hypernetworkModelField.innerHTML = ""
|
||||
await getModels()
|
||||
})
|
||||
}
|
||||
},
|
||||
})
|
||||
})()
|
||||
|
@ -21,7 +21,7 @@
|
||||
})
|
||||
|
||||
observer.observe(editorModifierTagsList, {
|
||||
childList: true
|
||||
childList: true,
|
||||
})
|
||||
|
||||
function ModifierToggle() {
|
||||
|
@ -48,6 +48,6 @@
|
||||
|
||||
return marked.parse(releaseNotes)
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
})()
|
||||
|
@ -16,7 +16,7 @@
|
||||
stopSpecOnExpectationFailure: "true",
|
||||
stopOnSpecFailure: "false",
|
||||
random: "false",
|
||||
hideDisabled: "false"
|
||||
hideDisabled: "false",
|
||||
}
|
||||
const optStr = Object.entries(options)
|
||||
.map(([key, val]) => `${key}=${val}`)
|
||||
|
Loading…
Reference in New Issue
Block a user