Update __init__.py

Prevented comfy from caching results on dynamic prompts (only generate new random selections when the inputs change)
This commit is contained in:
Igal Ogonov
2026-10-21 14:45:22 +03:00
committed by GitHub
parent 4d66da840f
commit ed0a74e408
+20
View File
@@ -36,6 +36,16 @@ class SimpleStringRepository(io.ComfyNode):
],
)
@classmethod
def fingerprint_inputs(cls, **kwargs):
# Force re-execution when any random selector is set to -1 (auto-random)
for i in range(1, 6):
r = kwargs.get(f"random{i}", -1)
t = kwargs.get(f"target{i}", 0)
if t and r == -1:
return float("nan") # always re-run
return None # normal caching
@classmethod
def execute(cls, string, delimiter, target1, strength1, random1,
target2, strength2, random2, target3, strength3, random3,
@@ -121,6 +131,16 @@ class SimpleStringRepositoryCompact(io.ComfyNode):
],
)
@classmethod
def fingerprint_inputs(cls, **kwargs):
# Force re-execution when any random selector is set to -1 (auto-random)
for i in range(1, 6):
r = kwargs.get(f"random{i}", -1)
t = kwargs.get(f"target{i}", 0)
if t and r == -1:
return float("nan") # always re-run
return None # normal caching
@classmethod
def execute(cls, string, delimiter, target1, target2, target3, target4, target5):
raw = [target1, target2, target3, target4, target5]