Files
slahiri-ComfyUI-AI-Photogra…/__init__.py
T
slahiriandClaude 788798df95 v3.0.1 - Critical bug fixes and improvements
FIXES:
1. Color Style Not Applied (CRITICAL BUG FIX)
   - Completely rewrote color style enforcement mechanism
   - Added explicit comma-separated term mappings for each color style
   - Implemented ⚠️ CRITICAL warnings with MANDATORY requirements
   - Added contradictory term exclusions (B&W forbids "color", Color forbids "monochrome")
   - Color terms now MUST appear first in prompt sequence
   - Example: "Black and White" → "black and white photography, monochrome, grayscale, B&W, no color"

2. Model Input Connection Support
   - Added force_input=False to target_model parameter
   - Can now connect model name from model loader nodes
   - Maintains ability to type model name manually
   - Updated tooltip to clarify dual functionality

3. Enhanced Model Detection Patterns
   - SDXL: +9 patterns (pony, animagine, realvis xl, zavychroma, duchaiten, dreamshaper xl, crystal clear, hellonijicute, counterfeit xl)
   - SD 1.5: +7 patterns (deliberate, epicrealism, cyberrealistic, majicmix, chilloutmix, revanimated, absolutereality, analog madness, perfect world)
   - More comprehensive automatic model type detection

CLARIFICATIONS:
- Model Research Methodology
  * Updated docstring to clarify using pattern matching (not live web search)
  * Added note about future CivitAI/HuggingFace API integration
  * Changed research_source from "inference" to "pattern_matching"
  * Explained that real-time API calls require external dependencies

Technical Details:
- Color style system now provides exact comma-separated terms to use
- Enforcement changed from "include as PRIMARY term" to "Start with EXACT terms: X, Y, Z"
- Added explicit prohibition against contradictory terms
- Model detection now covers 30+ popular model names across all types

Why These Fixes:
User reported color style (B&W) not being applied even when selected. Root cause was insufficient enforcement in system prompt. New approach uses explicit term lists and critical warnings to Claude, ensuring compliance.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-18 21:24:10 +05:30

91 lines
2.7 KiB
Python

"""
ComfyUI-AI-Photography-Toolkit
A collection of AI-powered photography and image generation tools for ComfyUI.
All nodes are prefixed with SID_ for easy identification.
Author: Siddhartha Lahiri
Version: 3.0.1
"""
__version__ = "3.0.1"
import os
import sys
import subprocess
import importlib.util
# Auto-install dependencies
def install_dependencies():
"""
Automatically install required dependencies if not already installed.
"""
dependencies = {
"anthropic": "anthropic>=0.39.0",
}
python_exe = sys.executable
for package_name, package_spec in dependencies.items():
# Check if package is already installed
if importlib.util.find_spec(package_name) is None:
print(f"\n{'='*60}")
print(f"Installing {package_name} for SID Photography Toolkit...")
print(f"{'='*60}")
try:
subprocess.check_call(
[python_exe, "-m", "pip", "install", package_spec],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
print(f"{package_name} installed successfully!")
except subprocess.CalledProcessError as e:
print(f"ERROR: Failed to install {package_name}")
print(f"Please manually install: pip install {package_spec}")
print(f"Error: {e}")
print(f"{'='*60}\n")
# Install dependencies on module load
install_dependencies()
from typing_extensions import override
from comfy_api.latest import ComfyExtension, io
# Import all node classes
from .sid_ai_prompt_generator import SID_AIPromptGenerator
class SIDPhotographyToolkitExtension(ComfyExtension):
"""
Extension class for SID Photography Toolkit.
Registers all SID_ prefixed nodes with ComfyUI.
"""
@override
async def get_node_list(self) -> list[type[io.ComfyNode]]:
"""
Return list of all nodes in this extension.
Add new nodes here as they are created.
"""
return [
SID_AIPromptGenerator,
# Future nodes will be added here
# SID_ImageAnalyzer,
# SID_StyleTransfer,
# etc.
]
async def comfy_entrypoint() -> SIDPhotographyToolkitExtension:
"""
ComfyUI calls this function to load the extension and its nodes.
This is the entry point for the custom node package.
"""
print("\n" + "="*60)
print(f"Loading SID Photography Toolkit v{__version__} for ComfyUI")
print("="*60)
print("Nodes loaded:")
print(" - SID_AIPromptGenerator: AI-powered prompt generation from images")
print("="*60 + "\n")
return SIDPhotographyToolkitExtension()