2026-05-04 00:18:47 +02:00
2026-05-01 05:04:09 +02:00
2026-05-04 00:18:47 +02:00
2026-05-01 05:04:09 +02:00
2026-05-04 00:18:47 +02:00
2026-05-01 05:04:09 +02:00
2026-05-04 00:18:47 +02:00
2026-05-01 10:19:36 +02:00
2026-05-04 00:18:47 +02:00
2026-05-01 10:19:36 +02:00

ComfyUI-Complex-Prompt

ComfyUI node for working with complex prompts with support for variables, randomness, and basic logic.

Nodes

Complex Prompt

Takes a multiline text prompt and expands dynamic prompt variants using dynamicprompts. It can also accept optional ComplexPromptVars input and replace $variable_name tokens after dynamic prompt expansion.

Example:

a {red|green|blue} car

Outputs one randomly selected variant, such as:

a green car

With variables:

$person in a {red|green|blue} car

If person exists in vars, $person is replaced with its value. Variable tokens are preserved while dynamicprompts is parsing the prompt. The seed input is randomized after generation and is passed to dynamicprompts.

Complex Prompt Set Variable

Creates or extends an ComplexPromptVars object.

  • vars is optional. If it is not connected, the node creates a new object.
  • variable_name is the key.
  • value is multiline text expanded through dynamicprompts, then $variable_name tokens are replaced from the input vars before it is stored.
  • condition is optional. If it is set, the variable is only stored when the expression evaluates to true.
  • seed is randomized after generation and is passed to dynamicprompts.
  • wasSet is true when the variable was stored and false when the condition prevented the update.

Condition example:

(($var1 == "1") && ($var2 == "2")) || ($var3 < 10)

Conditions are evaluated with simpleeval. $variable tokens are resolved from the input vars; missing variables make the condition false.

Complex Prompt Parse JSON

Creates or extends a ComplexPromptVars object from a JSON string.

  • json_text must be a JSON object.
  • Object keys become variable names.
  • String and number values are copied into vars.
  • Boolean, null, object, empty array, and unsupported values are ignored.
  • If a value is a non-empty array of strings or numbers, one item is selected randomly using seed.
  • vars is optional. If it is not connected, the node creates a new object.

Example:

{
  "person": "Ada",
  "color": ["red", "green", "blue"],
  "age": 37
}

This can produce variables such as:

person = Ada
color = green
age = 37

Configuration

The configuration file is stored at:

ComfyUI/user/default/ComfyUI-Complex-Prompt/config.json
S
Description
No description provided
Readme MIT
3.2 MiB
Languages
Python 91.2%
JavaScript 8.8%