Co-authored-by: xiangyuT <109123695+xiangyuT@users.noreply.github.com>
Example Workflows
This directory contains example workflows demonstrating the usage of ComfyUI-PromptEnhance nodes.
Available Workflows
1. SDXL Prompt Enhance Workflow (sdxl_prompt_enhance_workflow.json)
A complete SDXL workflow that demonstrates how to use the Prompt Enhance Advanced node to enhance prompts before generating images.
Features:
- Uses the
PromptEnhanceAdvancednode to enhance simple prompts into detailed visual descriptions - Displays both the enhanced and original prompts for comparison using
ShowTextnodes - Complete SDXL image generation pipeline
- Generates 1024x1024 images using SDXL base model
Workflow Components:
-
Prompt Enhancement Section:
- Original Prompt Input: A primitive string node where you enter your simple prompt
- Prompt Enhance Advanced (LLM): The main enhancement node that calls an LLM API to enhance your prompt
- Enhanced Prompt Preview: Shows the enhanced prompt generated by the LLM (for debugging/demonstration)
- Original Prompt Reference: Shows the original prompt for comparison
-
Image Generation Section (SDXL):
- CheckpointLoaderSimple: Loads the SDXL base model (
sd_xl_base_1.0.safetensors) - CLIPTextEncode (Positive): Encodes the enhanced prompt for image generation
- CLIPTextEncode (Negative): Encodes negative prompt to avoid unwanted features
- EmptyLatentImage: Creates a 1024x1024 latent image
- KSampler: Generates the image using the enhanced prompt
- VAEDecode: Decodes the latent image to pixels
- SaveImage: Saves the generated image
- CheckpointLoaderSimple: Loads the SDXL base model (
How to Use:
-
Prerequisites:
- Ensure you have SDXL base model installed in your ComfyUI models directory
- Get an API key from DeepSeek (or another OpenAI-compatible API provider)
-
Load the Workflow:
- In ComfyUI, click "Load" and select
sdxl_prompt_enhance_workflow.json
- In ComfyUI, click "Load" and select
-
Configure the Prompt Enhance Node:
- Locate the "Prompt Enhance Advanced (LLM)" node
- Replace
your-api-key-herewith your actual API key - (Optional) Modify the
api_endpointif using a different provider - (Optional) Modify the
modelname if using a different model
-
Enter Your Prompt:
- In the "Original Prompt Input" node, enter your simple prompt
- Example: "a beautiful sunset over mountains"
-
Generate:
- Click "Queue Prompt" to run the workflow
- The enhanced prompt will be displayed in the "Enhanced Prompt Preview" node
- The generated image will be saved automatically
Expected Output:
- You will see the enhanced prompt in the ShowText node, which transforms simple prompts into detailed, visual descriptions
- The generated image will use the enhanced prompt for better quality and detail
- You can compare the original and enhanced prompts side-by-side
Customization:
- Adjust
temperaturein the Prompt Enhance node to control creativity (lower = more focused, higher = more creative) - Modify
max_tokensto control the length of the enhanced prompt - Change the
prompt_templateto customize how prompts are enhanced - Adjust sampler settings (steps, CFG scale, etc.) to control image generation quality
Notes
- The Prompt Enhance nodes require an active API key and internet connection
- API calls may take a few seconds depending on the provider and network speed
- The default template is written in Chinese and optimized for Chinese-language prompts, but it can also work with English prompts as the LLM will understand and respond appropriately. You may want to customize the
prompt_templateparameter for English-specific instructions if desired. - The ShowText nodes are essential for debugging and understanding how your prompts are being enhanced
Troubleshooting
- API Key Error: Make sure you've entered a valid API key in the Prompt Enhance node
- Timeout: Increase the
timeoutparameter if API calls are timing out - Model Not Found: Ensure the SDXL base model is downloaded and placed in the correct directory
- No Output: Check the console for error messages from the Prompt Enhance node