diff --git a/py/nodes/lora_loader.py b/py/nodes/lora_loader.py index 8a34f379..60c91472 100644 --- a/py/nodes/lora_loader.py +++ b/py/nodes/lora_loader.py @@ -53,8 +53,6 @@ class LoraManagerLoader: """Loads multiple LoRAs based on the kwargs input.""" loaded_loras = [] all_trigger_words = [] - - print(f"kwargs: {kwargs}") if 'loras' in kwargs: for lora in kwargs['loras']: diff --git a/py/nodes/trigger_word_toggle.py b/py/nodes/trigger_word_toggle.py index cddb660f..3067d261 100644 --- a/py/nodes/trigger_word_toggle.py +++ b/py/nodes/trigger_word_toggle.py @@ -29,8 +29,6 @@ class TriggerWordToggle: "id": id, "message": trigger_words }) - - print(f"kwargs: {kwargs}") filtered_triggers = trigger_words diff --git a/web/comfyui/lora_loader.js b/web/comfyui/lora_loader.js index 58743edd..383b84d9 100644 --- a/web/comfyui/lora_loader.js +++ b/web/comfyui/lora_loader.js @@ -73,15 +73,7 @@ app.registerExtension({ node.lorasWidget.value = mergedLoras; // node.graph.setDirtyCanvas(true, true); }; - - console.log("node: ", node); }); } }, - - async nodeRemoved(node) { - if (node.comfyClass === "Lora Loader (LoraManager)") { - // TODO: Remove widget from node - } - }, }); \ No newline at end of file diff --git a/web/comfyui/loras_widget.js b/web/comfyui/loras_widget.js index 4743bf93..d2c72f93 100644 --- a/web/comfyui/loras_widget.js +++ b/web/comfyui/loras_widget.js @@ -15,7 +15,7 @@ export function addLorasWidget(node, name, opts, callback) { }); // Initialize default value - const defaultValue = opts?.defaultVal || ""; + const defaultValue = opts?.defaultVal || []; // Parse LoRA entries from value const parseLoraValue = (value) => { @@ -247,7 +247,11 @@ export function addLorasWidget(node, name, opts, callback) { textAlign: "center", padding: "20px 0", color: "rgba(226, 232, 240, 0.8)", - fontStyle: "italic" + fontStyle: "italic", + userSelect: "none", // Add this line to prevent text selection + WebkitUserSelect: "none", // For Safari support + MozUserSelect: "none", // For Firefox support + msUserSelect: "none", // For IE/Edge support }); container.appendChild(emptyMessage); return; @@ -283,6 +287,10 @@ export function addLorasWidget(node, name, opts, callback) { color: "rgba(226, 232, 240, 0.8)", fontSize: "13px", marginLeft: "8px", + userSelect: "none", // Add this line to prevent text selection + WebkitUserSelect: "none", // For Safari support + MozUserSelect: "none", // For Firefox support + msUserSelect: "none", // For IE/Edge support }); const toggleContainer = document.createElement("div"); @@ -299,7 +307,11 @@ export function addLorasWidget(node, name, opts, callback) { Object.assign(strengthLabel.style, { color: "rgba(226, 232, 240, 0.8)", fontSize: "13px", - marginRight: "8px" + marginRight: "8px", + userSelect: "none", // Add this line to prevent text selection + WebkitUserSelect: "none", // For Safari support + MozUserSelect: "none", // For Firefox support + msUserSelect: "none", // For IE/Edge support }); header.appendChild(toggleContainer); @@ -350,6 +362,10 @@ export function addLorasWidget(node, name, opts, callback) { color: active ? "rgba(226, 232, 240, 0.9)" : "rgba(226, 232, 240, 0.6)", fontSize: "13px", cursor: "pointer", // Add pointer cursor to indicate hoverable area + userSelect: "none", // Add this line to prevent text selection + WebkitUserSelect: "none", // For Safari support + MozUserSelect: "none", // For Firefox support + msUserSelect: "none", // For IE/Edge support }); // Move preview tooltip events to nameEl instead of loraEl @@ -530,18 +546,17 @@ export function addLorasWidget(node, name, opts, callback) { }, }); - // Initialize widget value using options methods - widget.options.setValue(defaultValue); + widget.value = defaultValue; widget.callback = callback; - // widget.computeSize = (width) => { - // // console.log("loras_widget computeSize called: ", width, height); - // return [400, 200]; - // }; - - // Render initial state - renderLoras(widgetValue, widget); + widget.serializeValue = () => { + // Add dummy items to avoid the 2-element serialization issue, a bug in comfyui + return [...widgetValue, + { name: "__dummy_item1__", strength: 0, active: false, _isDummy: true }, + { name: "__dummy_item2__", strength: 0, active: false, _isDummy: true } + ]; + } widget.onRemove = () => { container.remove(); diff --git a/web/comfyui/tags_widget.js b/web/comfyui/tags_widget.js index 9fad322c..75dba7d1 100644 --- a/web/comfyui/tags_widget.js +++ b/web/comfyui/tags_widget.js @@ -126,5 +126,13 @@ export function addTagsWidget(node, name, opts, callback) { widget.callback = callback; + widget.serializeValue = () => { + // Add dummy items to avoid the 2-element serialization issue, a bug in comfyui + return [...widgetValue, + { text: "__dummy_item__", active: false, _isDummy: true }, + { text: "__dummy_item__", active: false, _isDummy: true } + ]; + }; + return { minWidth: 300, minHeight: 150, widget }; }