Files

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 PromptEnhanceAdvanced node to enhance simple prompts into detailed visual descriptions
  • Displays both the enhanced and original prompts for comparison using ShowText nodes
  • Complete SDXL image generation pipeline
  • Generates 1024x1024 images using SDXL base model

Workflow Components:

  1. 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
  2. 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

How to Use:

  1. 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)
  2. Load the Workflow:

    • In ComfyUI, click "Load" and select sdxl_prompt_enhance_workflow.json
  3. Configure the Prompt Enhance Node:

    • Locate the "Prompt Enhance Advanced (LLM)" node
    • Replace your-api-key-here with your actual API key
    • (Optional) Modify the api_endpoint if using a different provider
    • (Optional) Modify the model name if using a different model
  4. Enter Your Prompt:

    • In the "Original Prompt Input" node, enter your simple prompt
    • Example: "a beautiful sunset over mountains"
  5. 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 temperature in the Prompt Enhance node to control creativity (lower = more focused, higher = more creative)
  • Modify max_tokens to control the length of the enhanced prompt
  • Change the prompt_template to 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_template parameter 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 timeout parameter 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