Files
DemonGatanjieu-Anomalous_Mo…/web/modules/ui_lora_node_choice.js
T
DemonGatanjieuandClaude Opus 5.5 06461c4f9a Combos put LoRAs in rgthree's Power Lora Loader or Easy-Use's LoRA stack
Stacking many LoRAs made a long chain of Load LoRA nodes. A default combo now says which LoRA
node it is laid out with (data.loraNode: ComfyUI's own chain, rgthree's Power Lora Loader, or
Easy-Use's LoRA stack + Apply LoraStack), chosen under New or in its editor; the third-party ones
are offered only when installed, and a missing one falls back to ComfyUI's own and says so.

Save as combo lost a Power Lora Loader's rows (object values were not stored): they are kept as
the node's rows, made again before the slots are filled, each row's LoRA a slot.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-13 21:36:08 +08:00

37 lines
1.7 KiB
JavaScript

/**
* The default combo's LoRA node (放到画布时 LoRA 用哪种节点), under its LoRA heading: ComfyUI's
* own or an installed third-party one (lora_nodes.js), as a row of small buttons. A node this
* ComfyUI lacks shows only while the combo still uses it, marked. Hidden when there is no choice.
*/
import { translate as t } from './locales.js';
import { LORA_NODES, isInstalled, loraNodeKind } from './lora_nodes.js';
/** `onChange()` saves the combo after `data.loraNode` changed. */
export function createLoraNodeChoice(data, onChange) {
const current = loraNodeKind(data.loraNode);
const kinds = LORA_NODES.filter(kind => isInstalled(kind) || kind === current);
const row = document.createElement('div');
row.className = 'anomalous-nb-lora-node';
row.hidden = kinds.length < 2;
const label = document.createElement('span');
label.textContent = t('comboLoraNodeLabel');
row.append(label);
for (const kind of kinds) {
const item = document.createElement('button');
item.type = 'button';
item.className = 'anomalous-nb-lora-node-option';
item.textContent = isInstalled(kind) ? t(kind.labelKey) : `${t(kind.labelKey)}${t('comboLoraNodeMissingMark')}`;
item.title = t(kind.hintKey);
item.setAttribute('aria-pressed', String(kind === current));
item.onclick = () => {
if (loraNodeKind(data.loraNode) === kind) return;
data.loraNode = kind.id;
row.querySelectorAll('.anomalous-nb-lora-node-option').forEach(other => other.setAttribute('aria-pressed', String(other === item)));
onChange();
};
row.append(item);
}
return row;
}