fix: restore IS_CHANGED to enable proper branch execution
Fixes #94 The removal of IS_CHANGED in PR #91 caused ComfyUI to always re-execute the entire graph instead of only changed branches. IS_CHANGED returns a hash of text inputs (text, prepend_text, append_text) - when unchanged, ComfyUI skips re-execution.
This commit is contained in:
+16
-3
@@ -492,6 +492,19 @@ class PromptManager(ComfyNodeABC):
|
||||
"""
|
||||
self.cleanup_gallery_system()
|
||||
|
||||
# NOTE: IS_CHANGED intentionally removed to match CLIPTextEncode behavior
|
||||
# ComfyUI's default caching (based on input values) should handle cache invalidation
|
||||
# The previous IS_CHANGED implementation was causing input/cache mismatch issues
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, clip, text="", category="", tags="", search_text="",
|
||||
prepend_text="", append_text="", **kwargs):
|
||||
"""
|
||||
ComfyUI method to determine if node needs re-execution.
|
||||
|
||||
Returns a hash of input values that affect the conditioning output.
|
||||
This enables proper branch execution - only re-execute when inputs change.
|
||||
"""
|
||||
import hashlib
|
||||
|
||||
# Combine all text inputs that affect the conditioning output
|
||||
# Note: search_text doesn't affect output, so it's excluded
|
||||
combined = f"{text}|{prepend_text}|{append_text}"
|
||||
|
||||
return hashlib.sha256(combined.encode()).hexdigest()
|
||||
|
||||
+16
-3
@@ -456,6 +456,19 @@ class PromptManagerText(ComfyNodeABC):
|
||||
"""
|
||||
self.cleanup_gallery_system()
|
||||
|
||||
# NOTE: IS_CHANGED intentionally removed to match CLIPTextEncode behavior
|
||||
# ComfyUI's default caching (based on input values) should handle cache invalidation
|
||||
# The previous IS_CHANGED implementation was causing input/cache mismatch issues
|
||||
@classmethod
|
||||
def IS_CHANGED(cls, text="", category="", tags="", search_text="",
|
||||
prepend_text="", append_text="", **kwargs):
|
||||
"""
|
||||
ComfyUI method to determine if node needs re-execution.
|
||||
|
||||
Returns a hash of input values that affect the text output.
|
||||
This enables proper branch execution - only re-execute when inputs change.
|
||||
"""
|
||||
import hashlib
|
||||
|
||||
# Combine all text inputs that affect the output
|
||||
# Note: search_text doesn't affect output, so it's excluded
|
||||
combined = f"{text}|{prepend_text}|{append_text}"
|
||||
|
||||
return hashlib.sha256(combined.encode()).hexdigest()
|
||||
|
||||
Reference in New Issue
Block a user