DJZ-ENH-system
will be added to DJZ-Nodes, provided separately here
DJZ_ENH - Enhanced Prompt Management System for ComfyUI
A powerful ComfyUI custom node package for managing and utilizing advanced system prompts with multi-shot enhancement capabilities, designed specifically for Vision Language Models (VLMs) and dynamic prompt workflows.
Features
- Dynamic System Prompt Loading: Browse and load system prompts from organized markdown files
- Multi-Prompt JSON Extraction: Parse and extract multiple enhanced prompts from structured JSON responses
- Vision Language Model Integration: Optimized templates for VLMs like Qwen2.5VL
- LoRA-Aware Prompting: Enhanced accuracy through trained caption knowledge integration
- Template-Based Enhancement: Consistent multi-angle prompt generation with cinematic perspectives
Installation
-
Navigate to your ComfyUI custom nodes directory:
cd ComfyUI/custom_nodes/ -
Clone or download this repository:
git clone https://github.com/MushroomFleet/DJZ-ENH-system -
Restart ComfyUI
Core Components
1. ZenkaiENH Node (ZenkaiENH.py)
Purpose: Dynamically loads system prompts from the ENH-store/ directory
Features:
- Automatic detection of
.mdfiles in ENH-store folder - Dropdown selection interface for easy prompt switching
- Real-time file change detection
- UTF-8 encoding support
- Automatic folder creation
Inputs:
enh_file: Dropdown list of available.mdprompt files
Outputs:
STRING: Complete content of the selected prompt file
Usage:
- Place your system prompt
.mdfiles in theENH-store/folder - Connect the ZenkaiENH node to your Ollama/API nodes
- Select desired prompt from dropdown
- System prompt is automatically loaded and sent to output
2. ENH_JSON Node (ENH_JSON.py)
Purpose: Extracts multiple prompts from JSON-formatted LLM responses
Features:
- Robust JSON parsing with markdown code block handling
- Multiple format support (direct keys, array format, object format)
- Automatic fallback to safe default prompts
- Enhanced error handling and logging
- Trailing comma and quote cleanup
Inputs:
json_text: Multi-line string containing JSON response from LLM
Outputs:
output1: First extracted prompt (Standard Shot)output2: Second extracted prompt (Closeup Shot)output3: Third extracted prompt (Wide Shot)output4: Fourth extracted prompt (Action Shot)
Supported JSON Formats:
// Format 1: Direct keys
{
"prompt1": "description here",
"prompt2": "description here",
"prompt3": "description here",
"prompt4": "description here"
}
// Format 2: Array format
{
"prompts": ["desc1", "desc2", "desc3", "desc4"]
}
// Format 3: Object array format
{
"prompts": [
{"prompt": "desc1"},
{"prompt": "desc2"},
{"prompt": "desc3"},
{"prompt": "desc4"}
]
}
3. ENH-store Templates
The ENH-store/ directory contains system prompt templates designed for specific enhancement workflows.
Example: t2i_ENH-vision-4shot.md
Purpose: Multi-angle image prompt enhancement for VLMs
Key Features:
- Vision analysis protocol for image inputs
- Four distinct camera perspectives (Standard, Closeup, Wide, Action)
- Consistency rules across all generated prompts
- Professional photography and cinematography terminology
- 80-100 word target length per prompt
Shot Types Generated:
- Standard Shot: Medium shot, balanced composition
- Closeup Shot: Portrait perspective, detailed features
- Wide Shot: Environmental context, establishing shot
- Action Shot: Dynamic movement, dramatic angles
Workflow Integration
Basic Workflow Setup
-
Load System Prompt:
- Add
ZenkaiENHnode - Select desired enhancement template
- Connect output to your LLM node (Ollama/API)
- Add
-
Process User Input:
- Send user prompt + optional image to LLM
- LLM processes using loaded system prompt
- LLM returns JSON with 4 enhanced prompts
-
Extract Multiple Prompts:
- Add
ENH_JSONnode - Connect LLM JSON output to
json_textinput - Use the 4 outputs for different image generations
- Add
Advanced Multi-Shot Workflow
[User Input] → [ZenkaiENH] → [LLM Node] → [ENH_JSON] → [4x Image Generation]
↓ ↓ ↓
[System Prompt] [JSON Response] [4 Enhanced Prompts]
Benefits:
- Consistent subject details across all variations
- Professional cinematic perspectives
- Enhanced composition and framing
- Reduced prompt engineering time
Creating Custom Templates
Template Structure
- Header Section: Clear description of template purpose
- Input/Output Specification: Expected inputs and JSON format
- Processing Rules: Enhancement guidelines and consistency requirements
- Technical Specifications: Quality descriptors, style guidelines
- Example Output: Sample JSON structure
Template Guidelines
- Use markdown format (
.mdfiles) - Place files in
ENH-store/directory - Include clear JSON output format specifications
- Define consistency rules for multi-prompt generation
- Specify target word counts and quality standards
LoRA Integration
For LoRA-aware prompting:
- Include LoRA caption knowledge in system prompt
- Reference trained descriptions for alignment
- Leverage vision analysis for consistency
- Maintain coherency across prompt variations
Best Practices
System Prompt Design
- Keep JSON output rules clearly defined
- Maintain flexibility for different input types
- Include fallback behaviors for edge cases
- Test with various VLM models
Workflow Optimization
- Use consistent naming conventions for prompt files
- Organize templates by use case (t2i, style, character, etc.)
- Test multi-prompt outputs for consistency
- Monitor LLM token usage
Quality Control
- Verify JSON output format compliance
- Check prompt consistency across all outputs
- Validate enhancement quality improvements
- Test with different image inputs
Troubleshooting
Common Issues
No .md files found:
- Ensure files are placed in
ENH-store/directory - Check file extensions are
.md - Restart ComfyUI after adding files
JSON parsing errors:
- Check LLM output format matches expected JSON
- Verify no markdown code blocks in JSON
- Ensure proper JSON syntax (no trailing commas)
Inconsistent prompts:
- Review system prompt consistency rules
- Check if VLM is following template guidelines
- Adjust temperature/generation parameters
Empty outputs:
- Verify JSON contains required keys
- Check fallback prompt functionality
- Review LLM response completeness
Technical Requirements
- ComfyUI: Latest version recommended
- Python: 3.8+ with UTF-8 support
- VLM Support: Qwen2.5VL, GPT-4V, or similar vision models
- Memory: Sufficient for multi-prompt processing
Contributing
- Create new templates in
ENH-store/directory - Follow existing template structure and naming conventions
- Test with multiple VLM models
- Document specific use cases and requirements
License
[Add your license information here]
Changelog
v1.0.0 - Initial Release
- ZenkaiENH system prompt loader
- ENH_JSON multi-prompt extractor
- t2i_ENH-vision-4shot template
- Basic workflow integration
- LoRA-aware prompting foundation
This system transforms single prompts into professional, multi-perspective image generation workflows while maintaining consistency and quality across all outputs.
Support This Project
If you found this useful, please star the repo — it helps others discover it!