style: wrap long lines in node modules
Split tooltip, description and docstring strings that exceed 88 columns using implicit concatenation; string values are unchanged. Drop the unused typing imports from prompt_search_list and mark the deliberately late node imports in __init__ with noqa: E402.
This commit is contained in:
+5
-4
@@ -5,7 +5,8 @@ gallery system.
|
||||
|
||||
This module provides two main node types:
|
||||
- PromptManager: CLIP encoding node that outputs CONDITIONING
|
||||
- PromptManagerText: Text-only node that outputs STRING with prepend/append functionality
|
||||
- PromptManagerText: Text-only node that outputs STRING with prepend/append
|
||||
functionality
|
||||
|
||||
Both nodes share the same database backend for persistent prompt storage and include
|
||||
an automatic image gallery system that monitors ComfyUI output directories and links
|
||||
@@ -37,9 +38,9 @@ def get_version():
|
||||
return "unknown"
|
||||
|
||||
|
||||
from .prompt_manager import PromptManager
|
||||
from .prompt_manager_text import PromptManagerText
|
||||
from .prompt_search_list import PromptSearchList
|
||||
from .prompt_manager import PromptManager # noqa: E402
|
||||
from .prompt_manager_text import PromptManagerText # noqa: E402
|
||||
from .prompt_search_list import PromptSearchList # noqa: E402
|
||||
|
||||
NODE_CLASS_MAPPINGS = {
|
||||
"PromptManager": PromptManager,
|
||||
|
||||
+34
-12
@@ -51,7 +51,9 @@ class PromptManager(PromptManagerBase, ComfyNodeABC):
|
||||
{
|
||||
"multiline": True,
|
||||
"dynamicPrompts": True,
|
||||
"tooltip": "The text prompt to be encoded and saved to database.",
|
||||
"tooltip": (
|
||||
"The text prompt to be encoded and saved to database."
|
||||
),
|
||||
},
|
||||
),
|
||||
"clip": (
|
||||
@@ -64,33 +66,48 @@ class PromptManager(PromptManagerBase, ComfyNodeABC):
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Optional category for organizing prompts (e.g., 'landscapes', 'portraits')",
|
||||
"tooltip": (
|
||||
"Optional category for organizing prompts "
|
||||
"(e.g., 'landscapes', 'portraits')"
|
||||
),
|
||||
},
|
||||
),
|
||||
"tags": (
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Comma-separated tags for the prompt (e.g., 'anime, detailed, sunset')",
|
||||
"tooltip": (
|
||||
"Comma-separated tags for the prompt "
|
||||
"(e.g., 'anime, detailed, sunset')"
|
||||
),
|
||||
},
|
||||
),
|
||||
"search_text": (
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": 'Search past prompts by text; add tag:name (or tag:"two words") to filter by tag',
|
||||
"tooltip": (
|
||||
"Search past prompts by text; add tag:name "
|
||||
'(or tag:"two words") to filter by tag'
|
||||
),
|
||||
},
|
||||
),
|
||||
"prepend_text": (
|
||||
IO.STRING,
|
||||
{
|
||||
"tooltip": "Text to prepend to the main prompt (connected STRING nodes will be added before the main text)"
|
||||
"tooltip": (
|
||||
"Text to prepend to the main prompt (connected STRING "
|
||||
"nodes will be added before the main text)"
|
||||
)
|
||||
},
|
||||
),
|
||||
"append_text": (
|
||||
IO.STRING,
|
||||
{
|
||||
"tooltip": "Text to append to the main prompt (connected STRING nodes will be added after the main text)"
|
||||
"tooltip": (
|
||||
"Text to append to the main prompt (connected STRING "
|
||||
"nodes will be added after the main text)"
|
||||
)
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -104,15 +121,18 @@ class PromptManager(PromptManagerBase, ComfyNodeABC):
|
||||
|
||||
RETURN_TYPES = (IO.CONDITIONING, IO.STRING)
|
||||
OUTPUT_TOOLTIPS = (
|
||||
"A conditioning containing the embedded text used to guide the diffusion model.",
|
||||
"The final combined text string (with prepend/append applied) that was encoded.",
|
||||
"A conditioning containing the embedded text used to guide the diffusion "
|
||||
"model.",
|
||||
"The final combined text string (with prepend/append applied) that was "
|
||||
"encoded.",
|
||||
)
|
||||
FUNCTION = "encode_prompt"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = "🫶 ComfyAssets/🧠 Prompts"
|
||||
DESCRIPTION = (
|
||||
"Encodes a text prompt using a CLIP model into an embedding that can be used to guide "
|
||||
"the diffusion model towards generating specific images. Additionally saves all prompts "
|
||||
"Encodes a text prompt using a CLIP model into an embedding that can be used "
|
||||
"to guide the diffusion model towards generating specific images. "
|
||||
"Additionally saves all prompts "
|
||||
"to a local SQLite database with optional metadata for search and retrieval."
|
||||
)
|
||||
|
||||
@@ -141,7 +161,8 @@ class PromptManager(PromptManagerBase, ComfyNodeABC):
|
||||
append_text: Text to append to the main prompt
|
||||
|
||||
Returns:
|
||||
Tuple containing the conditioning for the diffusion model and the final text string
|
||||
Tuple containing the conditioning for the diffusion model and the final
|
||||
text string
|
||||
|
||||
Raises:
|
||||
RuntimeError: If clip input is invalid
|
||||
@@ -162,7 +183,8 @@ class PromptManager(PromptManagerBase, ComfyNodeABC):
|
||||
# Use the combined text for encoding
|
||||
encoding_text = final_text
|
||||
|
||||
# For database storage, save the original main text with metadata about prepend/append
|
||||
# For database storage, save the original main text with metadata
|
||||
# about prepend/append
|
||||
storage_text = text
|
||||
|
||||
# Validate CLIP model
|
||||
|
||||
+31
-11
@@ -53,7 +53,9 @@ class PromptManagerText(PromptManagerBase, ComfyNodeABC):
|
||||
{
|
||||
"multiline": True,
|
||||
"dynamicPrompts": True,
|
||||
"tooltip": "The text prompt to be processed and saved to database.",
|
||||
"tooltip": (
|
||||
"The text prompt to be processed and saved to database."
|
||||
),
|
||||
},
|
||||
)
|
||||
},
|
||||
@@ -62,35 +64,50 @@ class PromptManagerText(PromptManagerBase, ComfyNodeABC):
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Optional category for organizing prompts (e.g., 'landscapes', 'portraits')",
|
||||
"tooltip": (
|
||||
"Optional category for organizing prompts "
|
||||
"(e.g., 'landscapes', 'portraits')"
|
||||
),
|
||||
},
|
||||
),
|
||||
"tags": (
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Comma-separated tags for the prompt (e.g., 'anime, detailed, sunset')",
|
||||
"tooltip": (
|
||||
"Comma-separated tags for the prompt "
|
||||
"(e.g., 'anime, detailed, sunset')"
|
||||
),
|
||||
},
|
||||
),
|
||||
"search_text": (
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": 'Search past prompts by text; add tag:name (or tag:"two words") to filter by tag',
|
||||
"tooltip": (
|
||||
"Search past prompts by text; add tag:name "
|
||||
'(or tag:"two words") to filter by tag'
|
||||
),
|
||||
},
|
||||
),
|
||||
"prepend_text": (
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Text to prepend to the main prompt (connected STRING nodes will be added before the main text)",
|
||||
"tooltip": (
|
||||
"Text to prepend to the main prompt (connected STRING "
|
||||
"nodes will be added before the main text)"
|
||||
),
|
||||
},
|
||||
),
|
||||
"append_text": (
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Text to append to the main prompt (connected STRING nodes will be added after the main text)",
|
||||
"tooltip": (
|
||||
"Text to append to the main prompt (connected STRING "
|
||||
"nodes will be added after the main text)"
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
@@ -104,15 +121,17 @@ class PromptManagerText(PromptManagerBase, ComfyNodeABC):
|
||||
|
||||
RETURN_TYPES = (IO.STRING,)
|
||||
OUTPUT_TOOLTIPS = (
|
||||
"The final combined text string (with prepend/append applied) ready for use in other nodes.",
|
||||
"The final combined text string (with prepend/append applied) ready for use "
|
||||
"in other nodes.",
|
||||
)
|
||||
FUNCTION = "process_text"
|
||||
OUTPUT_NODE = True
|
||||
CATEGORY = "🫶 ComfyAssets/🧠 Prompts"
|
||||
DESCRIPTION = (
|
||||
"Processes and manages text prompts with database storage and search capabilities. "
|
||||
"Outputs a plain STRING that can be used with any node that accepts text input. "
|
||||
"Includes all PromptManager features: categorization, tagging, search, and prepend/append functionality."
|
||||
"Processes and manages text prompts with database storage and search "
|
||||
"capabilities. Outputs a plain STRING that can be used with any node that "
|
||||
"accepts text input. Includes all PromptManager features: categorization, "
|
||||
"tagging, search, and prepend/append functionality."
|
||||
)
|
||||
|
||||
def process_text(
|
||||
@@ -153,7 +172,8 @@ class PromptManagerText(PromptManagerBase, ComfyNodeABC):
|
||||
# Inject LoRA trigger words if integration is enabled
|
||||
final_text = self._inject_lora_trigger_words(final_text)
|
||||
|
||||
# For database storage, save the original main text with metadata about prepend/append
|
||||
# For database storage, save the original main text with metadata
|
||||
# about prepend/append
|
||||
storage_text = text
|
||||
|
||||
# Save prompt to database and set execution context for gallery tracking
|
||||
|
||||
@@ -6,7 +6,6 @@ OUTPUT_IS_LIST=True, allowing direct connection to nodes that accept list inputs
|
||||
"""
|
||||
|
||||
import re
|
||||
from typing import Any, Dict, List, Tuple
|
||||
|
||||
try:
|
||||
from .utils.logging_config import get_logger
|
||||
@@ -80,7 +79,9 @@ class PromptSearchList(ComfyNodeABC):
|
||||
IO.STRING,
|
||||
{
|
||||
"default": "",
|
||||
"tooltip": "Comma-separated list of tags to filter by (partial match)",
|
||||
"tooltip": (
|
||||
"Comma-separated list of tags to filter by (partial match)"
|
||||
),
|
||||
},
|
||||
),
|
||||
"min_rating": (
|
||||
@@ -105,7 +106,10 @@ class PromptSearchList(ComfyNodeABC):
|
||||
"BOOLEAN",
|
||||
{
|
||||
"default": True,
|
||||
"tooltip": "Skip prompts containing Clip_1/Clip_2/etc. multi-part markers",
|
||||
"tooltip": (
|
||||
"Skip prompts containing Clip_1/Clip_2/etc. "
|
||||
"multi-part markers"
|
||||
),
|
||||
},
|
||||
),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user