- Add class-level cache dictionary to store prompt/caption results
- Add _build_cache_key() method that hashes image data + all parameters
- Use sampled pixels for efficient image hashing of large images
- Return cached results when seed and all inputs match
- Print cache hit/miss messages for debugging
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add class-level cache dictionary for prompt/caption results
- Build cache key from all inputs (prompt, seed, mode, instructions, presets, model)
- Return cached results immediately if cache hit (no LLM call)
- Store results in cache after generation
- Changing seed will bypass cache and regenerate
- Same seed + same inputs = instant cached result
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add "Expand" as new processing mode option (before Single Pass, Section by Section)
- Create _expand_prompt method that generates detailed prompts from basic text
- Expansion follows Z-Image structure: subject, clothing, pose, environment, lighting, camera
- Photography templates, effects, and styles are incorporated during expansion
- After expansion, any section instructions are applied as modifications
- Useful for creating detailed prompts without a source image
Usage: Set processing_mode to "Expand", enter basic text like "woman in red dress, beach sunset"
The LLM will generate a comprehensive 200-400 word detailed prompt.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove hard word count limits (was 800 words) from all local clients
- Truncation now only occurs for actual repetition patterns
- Increase min tokens to 1500 and default max to 6000 for prompt modification
- Add token calculation logging for debugging
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Interrupt Handling:
- Add check_interrupt() using ComfyUI's throw_exception_if_processing_interrupted
- Nodes now properly stop when user clicks cancel button
Token/Word Limits (prevent truncation):
- Increase word limits from 400-500 to 800 words in all local clients
- Increase token buffer from 30% to 50% in PromptModifier
- Increase min tokens from 500 to 800 for prompt modification
- Increase default max_tokens from 2000 to 4000
PromptModifier Analysis Report:
- Add console report comparing original vs modified prompts
- Show word count changes and semantic differences
- Verify if requested modifications were applied
PromptGenerator:
- Remove prompt_metadata from outputs (was 3rd output)
- Save metadata to logs/prompt_generator/ folder
- Add logs/ to .gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Filter out <think>...</think> reasoning blocks from Qwen3 output
- Handle incomplete think blocks (model didn't close tag)
- Add seed field to SID_PromptGenerator and SID_PromptModifier
- Add dynamic max_tokens calculation based on input size + 30%
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add seed input to SID_PromptGenerator and SID_PromptModifier
for reproducibility (change seed to force re-generation)
- Add dynamic max_tokens calculation in PromptModifier:
- Estimates tokens from input prompt length
- Adds 30% buffer for modifications
- Clamps between 500 and model's max_tokens
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add repetition_penalty (1.2-1.3) and top_p params to all local model clients
- Add _truncate_runaway() to detect and cut off repetitive output:
- Character repetition (10+ same chars)
- Phrase repetition (5+ consecutive n-grams)
- Hard word limit safety net (400-500 words)
- Pass repetition_penalty/top_p from extra_params in all mode files
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added release_vram boolean toggle (default True)
- Clears GPU memory and runs garbage collection after execution
- Frees VRAM for subsequent nodes in workflow
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New dropdown options:
- Photography Templates (16): Studio Portrait, Fashion Editorial, Boudoir, Cinematic, etc.
- Photography Effects (18): Film Grain, Bokeh, Teal and Orange, Black and White, etc.
- Photographer Styles (20): Annie Leibovitz, Peter Lindbergh, Helmut Newton, etc.
Presets are integrated naturally with section modifications.
Single Pass applies all at once, Section by Section applies presets first then sections.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Removed temperature parameter from SID_PromptModifier
- Now uses temperature from connected LLM node (llm_model.temperature)
- Changed prompt input to forceInput (connection only, no text box)
- Added .cache/ and .claude/ to .gitignore
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New node that modifies prompts based on Z-Image structure:
- Takes input prompt and LLM model
- 6 section instruction inputs: subject, clothing, pose, environment, lighting, camera
- Two processing modes: Single Pass (faster) and Section by Section (precise)
- Temperature control for LLM creativity
- Optional Instagram caption generation (3 styles)
- Text-only LLM calls (no image required)
Phase 1 implementation using LLM API.
Phase 2 will add SID_LLM_Local_Text support.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Caption Generation:
- Added generate_caption toggle to SID_PromptGenerator
- New caption output with 3 styles: Poetic, Technical, Personal
- Each style includes caption, description, and hashtags
- Uses same LLM as prompt generation
Node Colors:
- Added web/js/sid_node_colors.js for yellow node theming
- All SID_ nodes now display with standard ComfyUI yellow swatch
- Added WEB_DIRECTORY export to load JS extensions
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changed final instruction from "Be comprehensive and precise" to
"Write as a single flowing paragraph. Be precise and literal."
for consistency across all modes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fashion poses detected:
- Contrapposto (S-curve)
- Hand on hip
- Power pose (wide stance)
- Crossed legs
- Walking/runway
- Over shoulder look
- Leaning
- Arms crossed
- Weight shift
- Hands behind back
Body/face orientation:
- Facing camera vs side vs angled (3/4 view)
- Body turn direction (left/right)
- Face turn direction (looking left/right)
- Back to camera detection
Integration:
- Fashion poses extracted from DWPose keypoints
- Pose info injected into LLM prompts
- Detailed pose output in runner console
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Fix DWPose/OpenPose to extract actual keypoints instead of just "detected: True"
- Improve pose analysis with better standing/sitting/lying/kneeling detection
- Add arm position detection (raised, extended, neutral)
- Add hand near face detection
- Track visible body parts (shoulders, hips, knees, ankles)
- Better pose type confidence scoring
- Enhanced pose output in runner with detailed keypoint info
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Update system prompts for Z-Image/Flux with concrete visual descriptions
- Add CRITICAL RULES to exclude poetic/philosophical/abstract language
- Add female anatomy tags injection for women subjects (NudeNet workaround)
- Remove reasoning requirement from detailed mode - works on all LLMs now
- Detailed mode uses extended thinking only when available (Anthropic API)
- Fix Decisions attribute names (wildlife_type, weather_condition, landmark_name)
- Fix get_tag_enhancement/get_clothing_prompt function signatures
- Fix NudeNet detection display (class/score vs label/confidence keys)
- Add local model support to detailed mode
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Changes:
- Use llm_model.max_tokens instead of hardcoded 8000/4000 in detailed.py
- Add max_injected_tags node input (default 30, range 5-100)
- Remove enhancement limits (was [:3] per section, [:5] clothing)
- Remove Extreme mode from analysis_mode options
- Pass tag_threshold and max_injected_tags through entire pipeline
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major Features:
- New modular prompt generator architecture (core/prompt_generator/)
- 15+ taggers/analyzers: WD14, PixAI, JoyTag, NudeNet, Places365, etc.
- Decision engine for intelligent prompt construction
- Template-based prompt building with dynamic sections
Standard Mode Enhancements:
- Tag injection for unmapped high-confidence tags
- Scene-specific prompts (20 scene groups from Places365)
- Animal-specific prompts (20+ animal types)
- Clothing-specific prompts (30+ clothing types)
- Tag-driven detail enhancements (40+ tag mappings)
- Semantic inclusion analysis using sentence-transformers
Detailed Mode (API with reasoning):
- 3-pass LLM generation with full enhancements
- Falls back to Standard mode for local models
- Comprehensive metadata with pass-by-pass details
Removed:
- Extreme mode (consolidated into Detailed mode)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add sample_workflow.json with complete Z-Image Turbo workflow
- Includes SID_LLM_Local, SID_LLM_API, and SID_ZImagePromptGenerator
- Link to download from README
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- README now focused on quick start and basic usage
- Technical_Details.md contains provider configs, settings, migration guide
- Link to Technical_Details.md for advanced users
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add full workflow screenshot as main header image
- Reorganize nodes section into table with screenshots and descriptions
- Each node now shows: name, screenshot, and detailed description
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Removed automatic model querying for local providers.
Users should now use the custom_model field to manually
specify their model name. This avoids issues with:
- Slow startup when Ollama/LM Studio isn't running
- Listing non-vision models that won't work for image analysis
- Users can now specify exactly which model they want
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Fetched from /v1/models API - the free Llama 3.2 vision models
are no longer available. Updated to current free vision models:
- nvidia/nemotron-nano-12b-v2-vl:free (new default)
- google/gemini-2.0-flash-exp:free
- google/gemma-3-27b-it:free
- google/gemma-3-12b-it:free
- amazon/nova-2-lite-v1:free
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Groq has decommissioned llama-3.2-11b-vision-preview and
llama-3.2-90b-vision-preview. Only Llama 4 multimodal models
remain available for vision tasks on Groq.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Remove text-only models from all providers (toolkit is for image analysis)
- Remove DeepSeek entirely (no vision models available)
- Remove Cerebras entirely (no vision models available)
- Update Anthropic, OpenAI, Gemini, Grok, Mistral to vision-only
- Update Groq, Together AI, OpenRouter, Fireworks, HuggingFace to vision-only
- Update documentation to reflect vision-only focus
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Ollama and LM Studio now:
- Use dynamic model detection from their APIs
- No fallback model lists (users specify via custom_model field)
- Simpler configuration that doesn't go stale
Users should use the custom_model text field to specify their
model name, or the dropdown will show auto-detected models
when the local server is running.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
For LM Studio, Ollama, and custom OpenAI-compatible endpoints,
automatically append /v1 to the URL if missing. This prevents
the common "Unexpected endpoint or method" error when users
enter URLs like "http://127.0.0.1:1234" instead of the required
"http://127.0.0.1:1234/v1".
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Models with "/" in their name (e.g., meta-llama/Llama-Vision-Free) are
now grouped by prefix, making the dropdown easier to navigate. Models
without "/" appear first, followed by grouped models sorted by prefix.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Added validation for OpenAI-style API responses in _call_llm and
_analyze_component methods. LM Studio sometimes returns empty/null
choices array which caused 'NoneType is not subscriptable' crash.
Now provides clear error messages:
- "LLM returned None response - check if model is loaded"
- "LLM returned invalid response format"
- "LLM returned empty choices array"
- "LLM returned empty message content - model may have failed to generate"
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Local vision models (QwenVL, Phi-3.5, etc.) output chain-of-thought
mixed with results when reasoning is enabled, breaking JSON parsing
for agentic mode. Single-shot prompts work much better.
Changes:
- Removed enable_reasoning toggle from SID_LLM_Local UI
- Hardcoded reasoning_enabled = False
- Local models now always use single-shot pipeline
Cloud APIs (Anthropic, OpenAI, Gemini) still support reasoning mode.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Updated framing component (components.toml) with comprehensive analysis:
- Body visibility tracking (head to feet, top to bottom)
- Frame cutoff detection (where body is cropped)
- Subject distance/scale (fills frame / medium / far)
- Rule of thirds positioning (horizontal + vertical)
- Enhanced JSON output schema for agentic mode
- Updated single-shot prompts (prompts.toml) for all tiers:
- Advanced tier: detailed/extreme with FRAMING & VISIBILITY section
- Standard tier: framing info in detailed/extreme modes
- Basic tier: updated detailed/extreme with body visibility and positioning
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Updated Detailed and Extreme mode prompts (all tiers) to include:
Body Positioning (each limb independently):
- Left/right shoulder position and angle
- Left/right arm position, bend, hand placement
- Left/right leg position if visible
- Weight distribution
Light & Shadow Analysis:
- Face: highlight areas (forehead, cheekbones), shadow areas (under eyes, jawline)
- Chest/torso: where light and shadow fall
- Arms: light and shadow placement
- Overall direction, key/fill ratio, rim lighting, shadow color temp
This ensures single-shot mode captures the same detail as agentic mode
with the new body_positioning and light_shadow_body components.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root cause: Global CUDA settings were interfering with ComfyUI's diffusion:
1. cudnn.benchmark=True causes re-benchmarking when input sizes change
between local model inference and KSampler, adding significant overhead
2. TF32 settings may affect precision of subsequent operations
These optimizations were designed for single-use scenarios, not shared
environments like ComfyUI where multiple nodes use different operations.
Solution: Remove all global CUDA modifications. ComfyUI manages its own
CUDA state optimally. Our cleanup method still ensures proper state
restoration after inference.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
New components for detailed prompt detection:
1. body_positioning - Detailed limb analysis:
- Left/right shoulder position, angle, visibility
- Left/right arm position, bend angle, hand placement
- Left/right leg position, bend, weight distribution
- All limbs analyzed independently
2. light_shadow_body - Light and shadow on body parts:
- Face: highlights (forehead, cheekbones), shadows (under eyes, jawline)
- Chest/torso: highlight and shadow areas
- Arms/hands: light and shadow placement
- Overall: main direction, key/fill ratio, rim lighting, shadow color temp
Added to "detailed" and "extreme" analysis modes.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Root cause: setup_cuda_optimizations() was calling torch.set_grad_enabled(False)
globally at module load, which disabled gradient computation for ALL nodes in
ComfyUI, breaking VAE decode and other nodes that need gradients.
Changes:
- Remove the global torch.set_grad_enabled(False) call
- Enhanced _cleanup_after_generation() to:
- Restore gradient computation with torch.set_grad_enabled(True)
- Force garbage collection after CUDA cleanup
- Ensure clean GPU state for subsequent nodes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add _cleanup_after_generation() method that:
- Calls torch.cuda.synchronize() to ensure all CUDA operations complete
- Calls torch.cuda.empty_cache() to free GPU memory
This prevents ComfyUI's subsequent nodes (like VAE decode) from getting
stuck due to pending CUDA operations or fragmented GPU memory.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add prompt_length dropdown (Short/Medium/Long/Free) to control output length
- Default to "Free" (no constraint) for maximum flexibility
- Updated prompts.toml with Z-Image best practices:
- Structured format: composition → subject → clothing → lighting
- Geometric face angles (front view, 45°, profile)
- Specific lighting keywords (soft diffused daylight, rim lighting)
- Cleanup constraints at end (no text, no watermark)
- Added get_length_constraint() to config_loader.py
- Length constraints applied to both single-shot and agentic pipelines
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Moondream2: Disable bitsandbytes quantization (vision encoder has dtype
mismatch with Half/Float in layer_norm). Always use BF16/FP16 instead.
- Florence-2: Use num_beams=1 for greedy decoding (beam search has cache
compatibility issues with newer transformers causing NoneType errors)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Phi-3.5 Vision marked as fastest local model
- Updated recommendation to note QwenVL for quality, Phi for speed
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
QwenVL currently produces the best quality prompts among local models.
Updated table and added recommendation note.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Florence-2: Cast input tensors to model dtype (fixes BFloat16 mismatch)
- Moondream2: Use HF repo with force_download on cache corruption retry
- DynamicCache: Clear sys.modules cache to prevent stale imports
- Cache clearing: Also remove transformers_modules Python module entries
Fixes:
- RuntimeError: Input type (float) and bias type (struct c10::BFloat16)
- FileNotFoundError: .../transformers_modules/Moondream2/layers.py
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The compatibility shim now handles both old and new transformers versions:
- Try get_seq_length() method first (newer transformers)
- Fall back to key_cache attribute access (older transformers)
- Return 0 if neither method is available
This fixes AttributeError: 'DynamicCache' object has no attribute 'key_cache'
when using Phi-3.5-Vision with newer transformers versions.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add documentation that local models perform better with reasoning disabled
(single-shot mode) since they struggle with structured JSON output required
for agentic analysis.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>