fix: use relative import for style_presets in StyleApplier

The absolute `from style_presets import StylePreset` failed at INPUT_TYPES()
evaluation because ComfyUI's loader does not reliably place the custom-node
directory on sys.path. Switch to `from ..style_presets import StylePreset`
with an absolute fallback for test/script-execution contexts, matching the
dual-mode try/except pattern already used in __init__.py.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
limbicnation
2026-05-01 04:19:16 +02:00
co-authored by Claude Opus 4.7
parent 50807f2d1a
commit 2fea087592
+8 -2
View File
@@ -25,7 +25,10 @@ class StyleApplierNode:
@classmethod
def INPUT_TYPES(cls):
"""Define input parameters for the node."""
from style_presets import StylePreset
try:
from ..style_presets import StylePreset
except ImportError:
from style_presets import StylePreset
return {
"required": {
@@ -66,7 +69,10 @@ class StyleApplierNode:
include_technical: bool = True,
) -> tuple[str, str]:
"""Apply style keywords to a prompt."""
from style_presets import StylePreset
try:
from ..style_presets import StylePreset
except ImportError:
from style_presets import StylePreset
# Normalize inputs
prompt = prompt.strip() if prompt else ""