diff --git a/ui/media/js/dnd.js b/ui/media/js/dnd.js index 0a547e55..5cb517fe 100644 --- a/ui/media/js/dnd.js +++ b/ui/media/js/dnd.js @@ -312,16 +312,18 @@ const TASK_MAPPING = { control_alpha: { name: "ControlNet Strength", setUI: (control_alpha) => { + control_alpha = control_alpha || 1.0 controlAlphaField.value = control_alpha updateControlAlphaSlider() }, readUI: () => parseFloat(controlAlphaField.value), - parse: (val) => parseFloat(val), + parse: (val) => val === null ? 1.0 : parseFloat(val), }, use_lora_model: { name: "LoRA model", setUI: (use_lora_model) => { let modelPaths = [] + use_lora_model = use_lora_model === null ? "" : use_lora_model use_lora_model = Array.isArray(use_lora_model) ? use_lora_model : [use_lora_model] use_lora_model.forEach((m) => { if (m.includes("models\\lora\\")) { @@ -538,6 +540,11 @@ function restoreTaskToUI(task, fieldsToSkip) { // listen for inpainter loading event, which happens AFTER the main image loads (which reloads the inpai controlImagePreview.src = task.reqBody.control_image } + + if ("use_controlnet_model" in task.reqBody && task.reqBody.use_controlnet_model && !("control_alpha" in task.reqBody)) { + controlAlphaField.value = 1.0 + updateControlAlphaSlider() + } } function readUI() { const reqBody = {}