sdxl_prompt_styler

sdxl_prompt_styler
★ 915

提示工程模板驱动SDXL兼容负面提示处理
基于JSON模板对SDXL提示词进行风格化处理,支持正/负面提示样式开关、复制去重与高级负面分割等功能,便于批量统一风格和复杂流程。
💡 为SDXL生成统一风格的正负面提示并支持快速切换样式
🍴 81 Forks💻 Python🔄 2024-05-22
📦
网盘下载
复制链接后前往夸克网盘下载
https://pan.quark.cn/s/c73fe210bae7
SDXL Prompt Styler Screenshot
SDXL Prompt Styler Advanced Screenshot
📄 README

SDXL Prompt Styler, a custom node for ComfyUI

SDXL Prompt Styler

SDXL Prompt Styler Advanced

SDXL Prompt Styler is a node that enables you to style prompts based on predefined templates stored in multiple JSON files. The node specifically replaces a {prompt} placeholder in the ‘prompt’ field of each template with provided positive text.

The node also effectively manages negative prompts. If negative text is provided, the node combines this with the ‘negative_prompt’ field from the template. If no negative text is supplied, the system defaults to using the ‘negative_prompt’ from the JSON template. This flexibility enables the creation of a diverse and specific range of negative prompts.

Changelog

This section details the updates and new features committed over time, organized chronologically with the most recent changes at the top.

Commit date (2024-01-26)

New Features

  • SDXL Prompt Styler Advanced: New option to copy the positive G prompt tokens to L, removing duplicates
  • Commit date (2024-01-19)

    New Features

  • SDXL Prompt Styler: Add toggles to disable styling for positive, negative, or both sentiments (bypass mode)
  • Commit date (2023-08-27)

    New Features

  • SDXL Prompt Styler Advanced: New node for more elaborate workflows with linguistic and supportive terms. Selector to change the split behavior of the negative prompt. Special thanks to @WinstonWoof and @Danamir for their contributions!
  • SDXL Prompt Styler: Minor changes to output names and printed log prompt.
  • Commit date (2023-08-11)

    Important Update

    With the latest changes, the file structure and naming convention for style JSONs have been modified. If you’ve added or made changes to the sdxl_styles.json file in the past, follow these steps to ensure your styles remain intact:

  • Backup: Before pulling the latest changes, back up your sdxl_styles.json to a safe location.
  • Migration: After updating the repository, create a new JSON file in the styles directory. Move your custom styles from the backup of sdxl_styles.json into this new file.
  • Unique Style Names: While the system now detects duplicates and appends a suffix to ensure uniqueness, it’s a best practice to ensure your style names are originally unique to prevent any potential confusion.
  • Managing Included JSON Files: If you prefer not to load specific included JSON files, consider renaming or moving them to a different location outside of the styles directory. The system will load all JSON files present in the specified directory.
  • New Features

  • Loading from Multiple JSON Files: The system can now load styles from multiple JSON files present in the specified directory, ensuring the uniqueness of style names by appending a suffix to duplicates.
  • Enhanced Error Handling: Improved error handling for file reading, data validity, and template replacement functions.

  • Usage Example with SDXL Prompt Styler

    Template example from a JSON file:

    [
        {
            "name": "base",
            "prompt": "{prompt}",
            "negative_prompt": ""
        },
        {
            "name": "sai-enhance",
            "prompt": "breathtaking {prompt} . award-winning, professional, highly detailed",
            "negative_prompt": "ugly, deformed, noisy, blurry, distorted, grainy"
        }
    ]

    style = "sai-enhance"
    text_positive = "a futuristic pop up tent in a forest"
    text_negative = "dark"

    The above will generate the following styled prompts:

    text_positive_styled = "breathtaking a futuristic pop up tent in a forest . award-winning, professional, highly detailed"
    text_negative_styled = "ugly, deformed, noisy, blurry, distorted, grainy, dark"

    Installation

    To install and use the SDXL Prompt Styler nodes, follow these steps:

  • Open a terminal or command line interface.
  • Navigate to the ComfyUI/custom_nodes/ directory.
  • Run the following command: