From bd547dd5322f241986d4b3cee009957d405c7723 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Tue, 9 Sep 2025 09:29:17 -0700 Subject: [PATCH 1/3] refactor(prompt_manager): optimize input change tracking --- prompt_manager.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/prompt_manager.py b/prompt_manager.py index 676661c..636dd41 100644 --- a/prompt_manager.py +++ b/prompt_manager.py @@ -485,11 +485,24 @@ class PromptManager(ComfyNodeABC): self.cleanup_gallery_system() @classmethod - def IS_CHANGED(cls, **kwargs): + def IS_CHANGED(cls, text="", category="", tags="", search_text="", + prepend_text="", append_text="", **kwargs): """ ComfyUI method to determine if node needs re-execution. + This method now properly tracks input changes to avoid unnecessary + re-execution while still ensuring prompts are saved when inputs change. + Returns: - NaN to force re-execution, ensuring prompts are always saved to database + A hash of the input values that changes when any input changes """ - return float("NaN") # Always execute + # Create a hash of all the text inputs that affect the output + # This ensures the node only re-executes when inputs actually change + import hashlib + + # Combine all text inputs that affect the conditioning output + combined = f"{text}|{category}|{tags}|{prepend_text}|{append_text}" + + # Return a hash that will change when inputs change + # Note: We don't include search_text as it doesn't affect the output conditioning + return hashlib.sha256(combined.encode()).hexdigest() From d91c92c08bc6859e71478a59479c2c44ac4fe0a1 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Tue, 9 Sep 2025 09:29:25 -0700 Subject: [PATCH 2/3] refactor: Optimize IS_CHANGED method logic --- prompt_manager_text.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/prompt_manager_text.py b/prompt_manager_text.py index ae31a4e..12ddb25 100644 --- a/prompt_manager_text.py +++ b/prompt_manager_text.py @@ -456,11 +456,24 @@ class PromptManagerText(ComfyNodeABC): self.cleanup_gallery_system() @classmethod - def IS_CHANGED(cls, **kwargs): + def IS_CHANGED(cls, text="", category="", tags="", search_text="", + prepend_text="", append_text="", **kwargs): """ ComfyUI method to determine if node needs re-execution. + This method now properly tracks input changes to avoid unnecessary + re-execution while still ensuring prompts are saved when inputs change. + Returns: - NaN to force re-execution, ensuring prompts are always saved to database + A hash of the input values that changes when any input changes """ - return float("NaN") # Always execute + # Create a hash of all the text inputs that affect the output + # This ensures the node only re-executes when inputs actually change + import hashlib + + # Combine all text inputs that affect the output + combined = f"{text}|{category}|{tags}|{prepend_text}|{append_text}" + + # Return a hash that will change when inputs change + # Note: We don't include search_text as it doesn't affect the output + return hashlib.sha256(combined.encode()).hexdigest() From e0e61ad6186eab4b9bd8ad6e9a96af6461f941e6 Mon Sep 17 00:00:00 2001 From: Vito Sansevero Date: Tue, 9 Sep 2025 09:30:09 -0700 Subject: [PATCH 3/3] chore: bump version to 3.0.21 in pyproject.toml --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index c4d4566..a48b0cb 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "promptmanager" description = "A powerful ComfyUI custom node that extends the standard text encoder with persistent prompt storage, advanced search capabilities, and an automatic image gallery system using SQLite." -version = "3.0.20" +version = "3.0.21" license = {file = "LICENSE"} dependencies = ["# Core dependencies for PromptManager", "# Note: Most dependencies are already included with ComfyUI", "# Already included with Python standard library:", "# - sqlite3", "# - hashlib", "# - json", "# - datetime", "# - os", "# - typing", "# - threading", "# - uuid", "# Required for gallery functionality:", "watchdog>=2.1.0 # For file system monitoring", "Pillow>=8.0.0 # For image metadata extraction (usually included with ComfyUI)", "# Optional dependencies for enhanced search functionality:", "# fuzzywuzzy[speedup]>=0.18.0 # For fuzzy string matching (optional)", "# sqlalchemy>=1.4.0 # For advanced ORM features (optional)", "# Development dependencies (optional):", "# pytest>=6.0.0 # For running tests", "# black>=22.0.0 # For code formatting", "# flake8>=4.0.0 # For linting", "# mypy>=0.910 # For type checking"]