Skip to content
Node packVerifiedExternal
Open source

dynamic_prompt_nodes

Dynamic prompt nodes to fully support wildcards for ComfyUI

Maintainer@cesasolBgrade

Package profile

Status
Verified
Publisher
@cesasol
Source
GitHub
Stars
1

README

Dynamic Prompt Nodes

ComfyUI custom nodes for dynamic prompt generation with full wildcard and variable support. Implements the sd-dynamic-prompts syntax natively — no external generator dependency.

Features

  • Random sampling — pick random variants from {option1|option2|option3}
  • Combinatorial generation — enumerate every possible prompt combination
  • Cyclical sampling — cycle through options in order across generations
  • Wildcards — substitute values from .txt or .yaml wildcard files using __wildcard_name__
  • Variables — define and reuse values within a prompt via ${name=value}
  • PPP tags — full support for <ppp:set>, <ppp:echo>, <ppp:if>, <ppp:stn>, and <ppp:ext> tags from sd-webui-prompt-postprocessor
  • Model family inference — auto-detects SD1, SDXL, SD3, or Flux from the model input
  • Model variant override — manually specify Pony, Illustrious, Anima, or NoobAI variants for conditional tags
  • Prompt cleanup — optional duplicate removal, extra space normalization, and empty construct cleanup
  • Negative prompt collection — <ppp:stn> content is automatically collected and merged into the negative prompt output

Installation

Via ComfyUI Manager

Search for Dynamic Prompt Nodes and install.

Manual

cd ComfyUI/custom_nodes
git clone https://github.com/cesasol/dynamic_prompt_nodes
cd dynamic_prompt_nodes
pip install -e .

Place wildcard files (.txt or .yaml) in ComfyUI/custom_nodes/dynamic_prompt_nodes/wildcards/.

Nodes

Dynamic Prompt (Random)

Processes a prompt template and returns a randomly sampled string each generation.

Inputs: template (STRING), seed (INT) Output: prompt (STRING)

Dynamic Prompt (Combinatorial)

Enumerates all combinations from a template. Feed into a batch to generate every variant.

Inputs: template (STRING), index (INT) Outputs: prompt (STRING), all_prompts (STRING), total_count (INT)

Dynamic Prompt (Cyclical)

Steps through options in order, advancing one position each generation. Useful for systematic variation without randomness.

Inputs: template (STRING) Output: prompt (STRING)

Prompt with Wildcards

Advanced prompt processor with full PPP tag support, model family inference, and optional cleanup. Processes both positive and negative templates simultaneously.

Inputs:

  • model (MODEL) — model input for family inference
  • positive_template (STRING, multiline) — positive prompt template
  • negative_template (STRING, multiline) — negative prompt template
  • seed (INT) — random seed for reproducible generation
  • ignore_repeats (BOOLEAN) — remove duplicate keywords
  • cleanup_extra_spaces (BOOLEAN) — normalize whitespace
  • cleanup_empty_constructs (BOOLEAN) — remove empty keywords and attention tags
  • model_variant (STRING, optional) — override variant: pony, illustrious, anima, noobai

Outputs: positive (STRING), negative (STRING)

Model Family Auto-Detection:

  • SD1 — diffusion_model.input_blocks length of 8
  • SDXL — diffusion_model.input_blocks length of 9
  • SD3 — diffusion_model.in_channels of 16
  • Flux — diffusion_model.img_in attribute present

System Variables (available in <ppp:if> conditions):

  • _is_sd1, _is_sdxl, _is_sd3, _is_flux — base architecture
  • _is_pony, _is_illustrious, _is_anima, _is_noobai — variant flags
  • _is_sd — true for SD1, SDXL, SD3, and their variants

Syntax

Variants

SyntaxDescription
{cat|dog|bird}Pick one randomly
{2$$cat|dog|bird}Pick exactly 2
{1-3$$cat|dog|bird}Pick 1 to 3
{2$$ and $$cat|dog}Pick 2 with custom separator
{3::rare|1::common}Weighted selection
{@cat|dog|bird}Cyclical (steps each call)

Wildcards

SyntaxDescription

Nodes in this pack

4 nodes
  • DynamicPromptCombinatorial
  • DynamicPromptCyclical
  • DynamicPromptRandom
  • PromptWithWildcards

Related resources

1 connection

Sources

3 sources
GitHubSourceVersion 4d141b3773dd92ecdd8ca144fc49d76514b694fb
github.com/cesasol/dynamic_prompt_nodes

Verified Oct 23

GitHubSource
github.com/cesasol/dynamic_prompt_nodes

Verified Oct 20

Source excerpts

1 excerpt

Source context: Repo cesasol/dynamic_prompt_nodes