134 Commits
Author SHA1 Message Date
slahiriandClaude Opus 4.5 5bfd23187a feat: add caching to PromptGenerator based on seed and inputs
- 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>
2025-12-31 10:39:04 +05:30
slahiriandClaude Opus 4.5 88bb7ad1e2 feat: add caching to PromptModifier based on seed and inputs
- 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>
2025-12-31 10:35:10 +05:30
slahiriandClaude Opus 4.5 dcfd7fd6c9 feat: add Expand mode to PromptModifier for generating detailed prompts
- 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>
2025-12-31 10:27:12 +05:30
slahiriandClaude Opus 4.5 aac6274fbe fix: remove hard word limits, keep only repetition detection
- 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>
2025-12-31 10:14:46 +05:30
slahiriandClaude Opus 4.5 bd3ceaa1e1 feat: add interrupt handling, increase token limits, add analysis report
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>
2025-12-31 10:12:21 +05:30
slahiriandClaude Opus 4.5 435c2bb24d fix: filter Qwen3 <think> blocks and add seed/dynamic tokens
- 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>
2025-12-31 09:41:36 +05:30
slahiriandClaude Opus 4.5 e2b14e7c13 feat: add seed field and dynamic token calculation
- 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>
2025-12-31 09:37:40 +05:30
slahiriandClaude Opus 4.5 28d74114a6 fix: prevent runaway local LLM generation with repetition penalty and truncation
- 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>
2025-12-31 09:28:35 +05:30
slahiriandClaude Opus 4.5 03fb2b8f4e feat: add release_vram toggle to PromptModifier (default: enabled)
- 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>
2025-12-31 09:20:17 +05:30
slahiriandClaude Opus 4.5 295553e326 feat: add photography templates, effects, and photographer styles to PromptModifier
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>
2025-12-31 09:18:38 +05:30
slahiriandClaude Opus 4.5 426dd358d5 fix: use LLM node temperature in PromptModifier, prompt as input only
- 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>
2025-12-31 09:13:07 +05:30
slahiriandClaude Opus 4.5 5d914f7e01 feat: add SID_LLM_Local_Text node for text-only local models
New node for text-only Qwen models (no vision):
- Qwen2.5 series: 1.5B, 3B, 7B, 14B
- Qwen3 series: 1.7B, 4B, 8B
- Abliterated (uncensored): 7B, 14B

Features:
- VRAM-efficient text-only inference
- 4-bit, 8-bit, FP16 quantization
- Model caching for fast repeated calls
- OpenAI-compatible interface

Updated SID_PromptModifier to support local_text provider.
Ideal for prompt modification workflows without vision.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 08:52:18 +05:30
slahiriandClaude Opus 4.5 0dfd6fd294 feat: add SID_PromptModifier node for semantic prompt modification
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>
2025-12-31 08:44:59 +05:30
slahiriandClaude Opus 4.5 4361a7b403 feat: add Instagram caption generation and yellow node colors
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>
2025-12-31 08:28:43 +05:30
slahiriandClaude Opus 4.5 2fb79e2a15 fix: align detailed mode system prompt with standard/quick modes
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>
2025-12-31 01:53:46 +05:30
slahiriandClaude Opus 4.5 a78ebb3b00 feat: add fashion pose detection with body/face angle analysis
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>
2025-12-31 01:24:08 +05:30
slahiriandClaude Opus 4.5 274b36a620 fix: improve pose detection with proper keypoint extraction
- 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>
2025-12-31 01:15:14 +05:30
slahiriandClaude Opus 4.5 474b02a021 feat: Z-Image/Flux prompts, female anatomy injection, detailed mode for all LLMs
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>
2025-12-31 01:10:10 +05:30
slahiriandClaude Opus 4.5 031f316b4b fix: remove hardcoded limits and add max_injected_tags parameter
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>
2025-12-31 00:37:10 +05:30
slahiriandClaude Opus 4.5 0012ad531b feat: v4.2.1 - Modular prompt generator with enhanced LLM modes
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>
2025-12-31 00:23:50 +05:30
slahiriandClaude Opus 4.5 44714971b8 Add sample workflow JSON and link in README
- 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>
v4.2.0
2025-12-11 18:36:41 +05:30
slahiriandClaude Opus 4.5 94b16f5b91 Simplify README for novice users, move details to Technical_Details.md
- 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>
2025-12-11 18:34:50 +05:30
slahiriandClaude Opus 4.5 14efea3ac0 Update README with workflow screenshot and node table
- 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>
2025-12-11 18:31:18 +05:30
slahiriandClaude Opus 4.5 8e6918a7a7 Update README with node screenshots and remove old sample workflows
- Add assets/ folder with node screenshots (LLM Local, LLM API, Prompt Generator)
- Update README header with SID LLM Local node image
- Add all 3 node images side-by-side in Nodes section
- Remove old sample workflow files (will be replaced)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 17:42:40 +05:30
slahiriandClaude Opus 4.5 97002ca490 Disable dynamic Ollama/LM Studio model detection
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>
2025-12-11 15:55:19 +05:30
slahiriandClaude Opus 4.5 92dc8c0d35 Update OpenRouter to current free vision models (Dec 2025)
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>
2025-12-11 15:53:50 +05:30
slahiriandClaude Opus 4.5 fa058f2cf8 Remove decommissioned Groq Llama 3.2 vision preview models
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>
2025-12-11 15:50:39 +05:30
slahiriandClaude Opus 4.5 222a56e3c8 Filter all providers to vision-only models
- 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>
2025-12-11 15:46:08 +05:30
slahiriandClaude Opus 4.5 f12ae6b549 Remove hardcoded model lists for local providers
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>
2025-12-11 15:39:56 +05:30
slahiriandClaude Opus 4.5 0db3908f37 Update all LLM provider models to December 2025
Anthropic:
- Add Claude Opus 4.5, Sonnet 4.5, Haiku 4.5 (latest)
- Add Claude Opus 4.1, Sonnet 4, Opus 4
- Keep Claude 3.5 models as legacy

OpenAI:
- Add GPT-4.1, GPT-4.1-mini, GPT-4.1-nano (latest)
- Keep GPT-4o, GPT-4o-mini (vision capable)
- Add o3, o3-mini, o4-mini reasoning models
- Remove deprecated o1 models, change default to gpt-4.1

Google Gemini (already updated):
- Gemini 2.5 flash/pro/flash-lite (stable)
- Gemini 2.0 flash/flash-lite
- Gemini 3 pro preview

xAI Grok:
- Add Grok 4.1-fast, Grok 4-fast, Grok 4 (latest)
- Keep Grok 3, Grok 3-mini
- Keep Grok 2-vision for image analysis

Mistral AI:
- Add Mistral Medium 2508, Small 2506
- Add Devstral small for coding

Groq:
- Add Llama 4 Scout and Maverick (multimodal)
- Update default to Llama 4 Scout

Together AI:
- Add Llama 4 Maverick and Scout
- Add Qwen2.5-VL-72B vision model
- Add DeepSeek R1 and V3
- Add free tier models

Fireworks AI:
- Add Llama 4 Maverick and Scout
- Add Qwen2.5-VL-32B vision model
- Update default to Llama 4 Maverick

Also updated is_likely_vision_model() to detect Llama 4 and
GPT-4.1 as vision-capable models.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 15:38:29 +05:30
slahiriandClaude Opus 4.5 16f658471d Update Gemini models to current stable versions
- Remove deprecated preview models (gemini-2.5-pro-preview-06-05,
  gemini-2.5-flash-preview-05-20)
- Remove retired Gemini 1.5 models (deprecated April 2025)
- Add stable Gemini 2.5 models (gemini-2.5-flash, gemini-2.5-pro,
  gemini-2.5-flash-lite)
- Add Gemini 3 preview model
- Change default from gemini-2.0-flash to gemini-2.5-flash

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 15:28:35 +05:30
slahiriandClaude Opus 4.5 a85f5de879 Use default URLs for Ollama and LM Studio when not provided
- LM Studio defaults to http://localhost:1234/v1
- Ollama defaults to http://localhost:11434/v1

This allows users to leave the api_url field empty for local providers,
making setup simpler.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 14:31:05 +05:30
slahiriandClaude Opus 4.5 4e784a4f4e Auto-correct local provider URLs missing /v1 suffix
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>
2025-12-11 14:22:57 +05:30
slahiriandClaude Opus 4.5 ddd9dd7d4d Organize model dropdown with folder-like grouping
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>
2025-12-11 14:19:41 +05:30
slahiriandClaude Opus 4.5 79e23da929 Fix LM Studio empty response crash
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>
2025-12-11 14:12:15 +05:30
slahiriandClaude Opus 4.5 416340c714 Permanently disable reasoning for local models
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>
2025-12-11 13:54:49 +05:30
slahiriandClaude Opus 4.5 7097781aa5 Add local test scripts to gitignore
- test_*.py
- compare_results.py
- download_test_images.py
- nul (Windows artifact)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-11 13:48:00 +05:30
slahiriandClaude Opus 4.5 bc17135b39 Enhance framing analysis with body visibility and rule of thirds
- 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>
2025-12-11 13:31:54 +05:30
slahiriandClaude Opus 4.5 23e603541a Add body positioning and light/shadow to single-shot prompts
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>
2025-12-11 13:24:55 +05:30
slahiriandClaude Opus 4.5 0915918e81 Fix KSampler slowdown by removing global CUDA optimizations
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>
2025-12-11 13:22:02 +05:30
slahiriandClaude Opus 4.5 4955931316 Add body positioning and light/shadow analysis components
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>
2025-12-11 13:05:23 +05:30
slahiriandClaude Opus 4.5 e5d648469b Fix VAE hang: remove global torch.set_grad_enabled(False)
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>
2025-12-11 13:01:09 +05:30
slahiriandClaude Opus 4.5 1f1e273119 Fix VAE decode hang by adding GPU cleanup after local model generation
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>
2025-12-11 12:54:47 +05:30
slahiriandClaude Opus 4.5 737b8dddc5 Add prompt_length dropdown and Z-Image prompting best practices
- 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>
2025-12-11 09:20:30 +05:30
slahiriandClaude Opus 4.5 c5c316dd9e Fix Moondream2 quantization and Florence-2 beam search errors
- 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>
2025-12-11 08:56:54 +05:30
slahiriandClaude Opus 4.5 c93f043a00 Add Phi-3.5 Vision speed note to README
- 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>
2025-12-11 08:52:04 +05:30
slahiriandClaude Opus 4.5 6f74249807 Add QwenVL recommendation to README
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>
2025-12-11 08:44:13 +05:30
slahiriandClaude Opus 4.5 1472f08b56 Fix local model errors: Florence-2 dtype, Moondream2 cache, DynamicCache
- 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>
2025-12-11 08:42:03 +05:30
slahiriandClaude Opus 4.5 731e6a3b84 Fix DynamicCache compatibility for transformers 4.49+
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>
2025-12-11 08:38:20 +05:30
slahiriandClaude Opus 4.5 555237e3a3 Update README with local model performance note
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>
2025-12-11 08:35:17 +05:30