mirror of
https://github.com/willmiao/ComfyUI-Lora-Manager.git
synced 2026-03-21 21:22:11 -03:00
refactor: Extract isNodeEnabled helper to eliminate mode check duplication
Consolidate node enabled state checks into isNodeEnabled() helper function to improve code clarity and maintainability. Follows DRY principle.
This commit is contained in:
@@ -457,6 +457,14 @@ function getWidgetNames(node) {
|
||||
return [];
|
||||
}
|
||||
|
||||
function isNodeEnabled(node) {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
// ComfyUI node mode: 0 = Normal/Enabled, others = Always/Never/OnEvent
|
||||
return node.mode === undefined || node.mode === 0;
|
||||
}
|
||||
|
||||
function isAbsolutePath(path) {
|
||||
if (typeof path !== 'string') {
|
||||
return false;
|
||||
@@ -507,10 +515,7 @@ export async function sendLoraToWorkflow(loraSyntax, replaceMode = false, syntax
|
||||
}
|
||||
|
||||
const loraNodes = filterRegistryNodes(registry.nodes, (node) => {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
if (node.mode !== undefined && node.mode !== 0) {
|
||||
if (!isNodeEnabled(node)) {
|
||||
return false;
|
||||
}
|
||||
if (node.capabilities && typeof node.capabilities === 'object') {
|
||||
@@ -572,10 +577,7 @@ export async function sendModelPathToWorkflow(modelPath, options) {
|
||||
}
|
||||
|
||||
const targetNodes = filterRegistryNodes(registry.nodes, (node) => {
|
||||
if (!node) {
|
||||
return false;
|
||||
}
|
||||
if (node.mode !== undefined && node.mode !== 0) {
|
||||
if (!isNodeEnabled(node)) {
|
||||
return false;
|
||||
}
|
||||
const widgetNames = getWidgetNames(node);
|
||||
|
||||
Reference in New Issue
Block a user