From 420b7e50c2cb2d87f34071c543fac06ce13c09bc Mon Sep 17 00:00:00 2001 From: Dariusz L Date: Sun, 7 Jun 2026 17:52:28 +0200 Subject: [PATCH] feat: plumb lora strength and active flags through workflow analysis for accurate model resolution --- __init__.py | 3 ++ core/workflow_analyzer.py | 41 ++++++++++++++--------- web/resolver/views/tabs_loaded_methods.js | 14 ++------ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/__init__.py b/__init__.py index e44661e..1808f50 100644 --- a/__init__.py +++ b/__init__.py @@ -629,6 +629,9 @@ class ModelResolverExtension: strength = 1.0 break + if ref.get("strength") is not None: + strength = ref.get("strength") + # For text-based lora loaders (LoraLoaderV2, LoraManager), get strength from ref if ref.get("is_lora_v2"): strength = ref.get("strength") diff --git a/core/workflow_analyzer.py b/core/workflow_analyzer.py index 61f387a..c795d36 100644 --- a/core/workflow_analyzer.py +++ b/core/workflow_analyzer.py @@ -393,21 +393,32 @@ def get_node_model_info( full_path = None exists = False - model_refs.append( - { - "node_id": node_id, - "node_type": node_type, - "widget_index": idx, - "original_path": value_str, - "node_title": node_title, - "category": category, - "full_path": full_path, - "exists": exists, - "is_urn": False, - "connected": is_active, - "nested_key": nested_key, # Track nested key for updates - } - ) + ref = { + "node_id": node_id, + "node_type": node_type, + "widget_index": idx, + "original_path": value_str, + "node_title": node_title, + "category": category, + "full_path": full_path, + "exists": exists, + "is_urn": False, + "connected": is_active, + "nested_key": nested_key, # Track nested key for updates + } + + if nested_key == "lora": + strength = value.get("strength") + if strength is not None: + try: + ref["strength"] = float(strength) + except (TypeError, ValueError): + pass + + if isinstance(value.get("on"), bool): + ref["active"] = value.get("on") + + model_refs.append(ref) continue value_str = str(value).strip() diff --git a/web/resolver/views/tabs_loaded_methods.js b/web/resolver/views/tabs_loaded_methods.js index b5f1c12..3f6f88e 100644 --- a/web/resolver/views/tabs_loaded_methods.js +++ b/web/resolver/views/tabs_loaded_methods.js @@ -129,17 +129,9 @@ export const tabsLoadedMethods = { byCategory[cat] = { active: [], inactive: [] }; } - // Determine if model is active or inactive - // For LoraLoaderV2/LoraManager: check model.active field - // For other nodes: check model.connected field (false means not connected or bypassed) - let isActive = true; - if (model.is_lora_v2) { - // For text-based lora loaders, check both active flag AND connected status - isActive = model.active !== false && model.connected !== false; - } else { - // For regular nodes, check connected status - isActive = model.connected !== false; - } + // Some loaders expose per-model enablement, e.g. LoraManager's + // active flag and rgthree Power Lora Loader's on flag. + const isActive = model.active !== false && model.connected !== false; if (isActive) { byCategory[cat].active.push(model);