fix(trigger-words): propagate LORA_STACK updates through combiners (#881)

This commit is contained in:
Will Miao
2026-04-03 15:01:02 +08:00
parent 30db8c3d1d
commit 4f599aeced
6 changed files with 278 additions and 36 deletions

View File

@@ -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);
}