Nodes Browser

ComfyDeploy: How comfyui-toml-prompt works in ComfyUI?

What is comfyui-toml-prompt?

Encode Prompt in TOML for ComfyUI.

How to install it in ComfyDeploy?

Head over to the machine page

  1. Click on the "Create a new machine" button
  2. Select the Edit build steps
  3. Add a new step -> Custom Node
  4. Search for comfyui-toml-prompt and select it
  5. Close the build step dialig and then click on the "Save" button to rebuild the machine

comfyui-utils

ComfyUI custom nodes.

Install

cd ComfyUI/custom_nodes
git clone git@github.com:morino-kumasan/comfyui-utils.git
cd ../../
python_embeded/python -m pip install -r ComfyUI/custom_nodes/comfyui-utils/requirements.txt

TomlPromptEncoder

Encode Prompt in toml.

  • Input
    • model
    • clip
    • key_name_list
      • Key name list separated by line break.
    • text
      • toml prompt triggered by key_name
    • lora_info
      • toml prompt triggered by lora_name
    • seed
  • Output
    • MODEL
    • CLIP
    • CONDITION
    • STRING
      • Loaded lora tags
    • STRING
      • Prompt

text

_t is prompt. _v is variables for random choice

# key _t is prompt
[base]
_t="score_9, score_8_up, score_7_up, source_anime"

# direct string prompt
quality="best quality"

[base.girl]
_t="""1girl, perfect anatomy, 
beautiful face, (detailed skin), (detailed face), (beautiful detailed eyes),  
shiny hair, ${color} hair"""
# ${color} is replaced with red, blue or blonde.

twintails = "twintails, <lora:twintails.safetensors:1>"
ponytails = "ponytails"

[base.girl._v]
color=["red", "blue", "blonde"]

[base.boy]
1boy, muscular, ${g.color} hair, formal suit,
# ${color} is replaced with dark or light

[_v]
color=["dark", "light"]

lora_info

<lora:lora_name:strength> is replaced with prompt.

["lora.safetensors"]
_t="lora prompt"

key_name_list

// this is commont
# this is comment
/* this is comment */
quality          /* encode as "best quality" */
base, quality    /* encode as "score_9, score_8_up, score_7_up, source_anime, best quality" */
{base | quality} /* encode as "score_9, score_8_up, score_7_up, source_anime" or "best quality" */
base.girl        /* equals "base, base.girl", but not duplicate prompt. */
base.girl+boy    /* equals "base, base.girl, base.boy" */
base.?           /* equals "{base.girl | base.boy}" */
base.??          /* equals "{base.girl.twintails | base.girl.ponytails | base.boy}" */
<lora:lora.safetensors:1> /* load LoRA and encode as "lora prompt" */
<raw:this line is raw positive prompt.> /* raw positive prompt */
<!:this line is raw negative prompt.>   /* raw negative prompt */
<if:base.girl:key_name1:key_name2>     /* key_name1 if key name is already loaded else key_name2 */
<if_not:base.girl:key_name1:key_name2> /* key_name2 if key name is already loaded else key_name1 */

MultipleLoraTagLoader

Output multiple LoRA tags. (max 10)

  • Input
    • lora_name_0
      • LoRA filename.
    • strength_0
      • LoRA modify strengh.
    • lora_name_1
    • strength_1
    • ...
    • lora_name_9
    • strength_9
  • Output
    • STRING
      • LoRA tag list separated by line break.

PromptLoader

Load String from file.

StringConcat

Join strings.

StringSub

Replace text by regex.

StringViewer

View input string.