mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-25 15:15:44 -03:00
Fix TriggerWord Toggle not updating when all LoRAs are disabled
This commit is contained in:
@@ -114,6 +114,12 @@ app.registerExtension({
|
|||||||
const result = addLorasWidget(node, "loras", {
|
const result = addLorasWidget(node, "loras", {
|
||||||
defaultVal: mergedLoras // Pass object directly
|
defaultVal: mergedLoras // Pass object directly
|
||||||
}, (value) => {
|
}, (value) => {
|
||||||
|
// Collect all active loras from this node and its input chain
|
||||||
|
const allActiveLoraNames = collectActiveLorasFromChain(node);
|
||||||
|
|
||||||
|
// Update trigger words for connected toggle nodes with the aggregated lora names
|
||||||
|
updateConnectedTriggerWords(node, allActiveLoraNames);
|
||||||
|
|
||||||
// Prevent recursive calls
|
// Prevent recursive calls
|
||||||
if (isUpdating) return;
|
if (isUpdating) return;
|
||||||
isUpdating = true;
|
isUpdating = true;
|
||||||
@@ -132,12 +138,6 @@ app.registerExtension({
|
|||||||
newText = newText.replace(/\s+/g, ' ').trim();
|
newText = newText.replace(/\s+/g, ' ').trim();
|
||||||
|
|
||||||
inputWidget.value = newText;
|
inputWidget.value = newText;
|
||||||
|
|
||||||
// Collect all active loras from this node and its input chain
|
|
||||||
const allActiveLoraNames = collectActiveLorasFromChain(node);
|
|
||||||
|
|
||||||
// Update trigger words for connected toggle nodes with the aggregated lora names
|
|
||||||
updateConnectedTriggerWords(node, allActiveLoraNames);
|
|
||||||
} finally {
|
} finally {
|
||||||
isUpdating = false;
|
isUpdating = false;
|
||||||
}
|
}
|
||||||
@@ -156,12 +156,6 @@ app.registerExtension({
|
|||||||
const mergedLoras = mergeLoras(value, currentLoras);
|
const mergedLoras = mergeLoras(value, currentLoras);
|
||||||
|
|
||||||
node.lorasWidget.value = mergedLoras;
|
node.lorasWidget.value = mergedLoras;
|
||||||
|
|
||||||
// Collect all active loras from this node and its input chain
|
|
||||||
const allActiveLoraNames = collectActiveLorasFromChain(node);
|
|
||||||
|
|
||||||
// Update trigger words for connected toggle nodes with the aggregated lora names
|
|
||||||
updateConnectedTriggerWords(node, allActiveLoraNames);
|
|
||||||
} finally {
|
} finally {
|
||||||
isUpdating = false;
|
isUpdating = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ export function collectActiveLorasFromChain(node, visited = new Set()) {
|
|||||||
// Update trigger words for connected toggle nodes
|
// Update trigger words for connected toggle nodes
|
||||||
export function updateConnectedTriggerWords(node, loraNames) {
|
export function updateConnectedTriggerWords(node, loraNames) {
|
||||||
const connectedNodeIds = getConnectedTriggerToggleNodes(node);
|
const connectedNodeIds = getConnectedTriggerToggleNodes(node);
|
||||||
if (connectedNodeIds.length > 0 && loraNames.size > 0) {
|
if (connectedNodeIds.length > 0) {
|
||||||
fetch("/loramanager/get_trigger_words", {
|
fetch("/loramanager/get_trigger_words", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: { "Content-Type": "application/json" },
|
headers: { "Content-Type": "application/json" },
|
||||||
|
|||||||
Reference in New Issue
Block a user