mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-04-10 04:42:14 -03:00
fix(trigger-words): propagate LORA_STACK updates through combiners (#881)
This commit is contained in:
@@ -9,7 +9,7 @@ import type { LoraPoolConfig, RandomizerConfig, CyclerConfig } from './composabl
|
||||
import {
|
||||
setupModeChangeHandler,
|
||||
createModeChangeCallback,
|
||||
LORA_PROVIDER_NODE_TYPES
|
||||
LORA_CHAIN_NODE_TYPES
|
||||
} from './mode-change-handler'
|
||||
|
||||
const LORA_POOL_WIDGET_MIN_WIDTH = 500
|
||||
@@ -755,8 +755,8 @@ app.registerExtension({
|
||||
}
|
||||
}
|
||||
|
||||
// Register mode change handlers for LoRA provider nodes
|
||||
if (LORA_PROVIDER_NODE_TYPES.includes(comfyClass)) {
|
||||
// Register mode change handlers for LORA_STACK chain nodes
|
||||
if (LORA_CHAIN_NODE_TYPES.includes(comfyClass)) {
|
||||
const originalOnNodeCreated = nodeType.prototype.onNodeCreated
|
||||
|
||||
nodeType.prototype.onNodeCreated = function () {
|
||||
|
||||
@@ -18,7 +18,22 @@ export const LORA_PROVIDER_NODE_TYPES = [
|
||||
"Lora Cycler (LoraManager)",
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Nodes that do not own LoRA state themselves, but merge or forward LORA_STACK
|
||||
* inputs so downstream trigger-word updates must traverse through them.
|
||||
*/
|
||||
export const LORA_STACK_AGGREGATOR_NODE_TYPES = [
|
||||
"Lora Stack Combiner (LoraManager)",
|
||||
] as const;
|
||||
|
||||
export const LORA_CHAIN_NODE_TYPES = [
|
||||
...LORA_PROVIDER_NODE_TYPES,
|
||||
...LORA_STACK_AGGREGATOR_NODE_TYPES,
|
||||
] as const;
|
||||
|
||||
export type LoraProviderNodeType = typeof LORA_PROVIDER_NODE_TYPES[number];
|
||||
export type LoraStackAggregatorNodeType = typeof LORA_STACK_AGGREGATOR_NODE_TYPES[number];
|
||||
export type LoraChainNodeType = typeof LORA_CHAIN_NODE_TYPES[number];
|
||||
|
||||
/**
|
||||
* Check if a node class is a LoRA provider node.
|
||||
@@ -27,6 +42,16 @@ export function isLoraProviderNode(comfyClass: string): comfyClass is LoraProvid
|
||||
return LORA_PROVIDER_NODE_TYPES.includes(comfyClass as LoraProviderNodeType);
|
||||
}
|
||||
|
||||
export function isLoraStackAggregatorNode(
|
||||
comfyClass: string
|
||||
): comfyClass is LoraStackAggregatorNodeType {
|
||||
return LORA_STACK_AGGREGATOR_NODE_TYPES.includes(comfyClass as LoraStackAggregatorNodeType);
|
||||
}
|
||||
|
||||
export function isLoraChainNode(comfyClass: string): comfyClass is LoraChainNodeType {
|
||||
return LORA_CHAIN_NODE_TYPES.includes(comfyClass as LoraChainNodeType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Extract active LoRA filenames from a node based on its type.
|
||||
*
|
||||
@@ -40,6 +65,10 @@ export function getActiveLorasFromNodeByType(node: any): Set<string> {
|
||||
return extractFromCyclerConfig(node);
|
||||
}
|
||||
|
||||
if (isLoraStackAggregatorNode(comfyClass)) {
|
||||
return new Set<string>();
|
||||
}
|
||||
|
||||
// Default: use lorasWidget (works for Stacker and Randomizer)
|
||||
return extractFromLorasWidget(node);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user