Document the new remove_extra_comma option in 3 languages and bump the package version (existing-node enhancement, minor bump). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
7.0 KiB
7.0 KiB
- Top
- Node / Image Node / Text Node / XYPlot Node / Float Palet
- Workflow
Node
🍅 Text Node
D2 Regex Replace
- Can replace using regular expressions
- Multiple conditions can be specified
- Supports reuse of regex match strings (e.g., \1, \2)
- Target string can be specified by "tag unit" or "whole"
Input
text- Target string for search
modeTag: Break downtextby newlines and "," and replace individuallyAdvanced: Replacetextas a whole
regex_and_output- List of search strings and output strings
- Write in following format
- If output string is empty, matched part is deleted
- No limit on number of entries
Search string 1
--
Output string 1
--
Search string 2
--
Output string 2
Output
text- Text after replacement
Sample
Sample for removing Pony series quality tags.
Mode: Tag
Input text
score_9, score_8_up, (score_7_up, score_6_up:0.8) , rating_explicit, source_anime, BREAK
1girl, swimsuit
Regex Replace
.*(score_|rating_|source_).*
--
--
BREAK
--
Output text
1girl, swimsuit
D2 Regex Switcher
- Searches input text with regex and outputs matching text
- Main purpose is switching quality tags per Checkpoint
- When matching string is found in input
text, outputs target string and match index (starting from 0) - Can concatenate strings at front and back
Input
text- Search target string
prefix- String to concatenate at front
suffix- String to concatenate at back
regex_and_output- List of search strings and output strings
- Write in following format
pre_delim- Character inserted between
prefixandregex_and_output Comma:,/Line break: newline /None: nothing
- Character inserted between
suf_delim- Character inserted between
regex_and_outputandsuffix
- Character inserted between
Output
combined_text- String combining
prefix+ output string +suffix
- String combining
prefix/suffix- Input passthrough
D2 Multi Output
- Node that outputs generic parameters like seed and cfg as lists
Input
typeFLOAT: Floating point numbers. For CFG etc.INT: Integers. For steps etc.STRING: Strings. For sampler etc.SEED: Can input seed values with random number button
Add Random- Adds random numbers to input field
- Only shown when
typeisSEED
D2 Filename Template / D2 Filename Template2
- A node for creating string templates by incorporating date and parameters from other nodes
D2 Filename Template2is a version that supports multiple lines- It is also possible to retrieve values from arrays, dictionaries, and objects
- Preset feature for commonly used formats like Stable Diffusion webui A1111-style metadata
- You can add presets by editing
custom_nodes/d2-nodes-comfyui/config/template_config.yaml
- You can add presets by editing
Input
arg_{number}- Import values from other nodes
format%date:{yyyy/MM/dd/hh/mm/ss}%yyyy: YearMM: Monthdd: Dayhh: Hourmm: Minutess: Second
%{node name}.{key}%- Retrieves values by specifying node name and item name
- Example:
%Empty Latent Image.width%: Get width from the Empty Latent Image node
%node:{id}.{key}%- Retrieves values by specifying node ID and item name
- Example:
%node:8.width%: Get width from node ID 8
%arg_{number}%- Embed input values
%arg_{number}:ckpt_name%- Embed checkpoint name with
.safetensorsremoved
- Embed checkpoint name with
%arg_{number}:preset.{preset_name}%- Presets can be added by editing
custom_nodes/d2-nodes-comfyui/config/template_config.yaml
- Presets can be added by editing
%exec_{number}[{index}]%- Retrieves the value at
{index}from the array input toarg_{number}
- Retrieves the value at
%exec_{number}['{key}']%- Retrieves the value for
{key}from the dictionary input toarg_{number}
- Retrieves the value for
%exec_{number}.{key}%- Retrieves the value for
{key}from the object input toarg_{number}
- Retrieves the value for
arg_count- Increase or decrease the number of input items
normalization- Filename sanitization option
Retrieving node information connected to `arg_N`, using the node name, etc.
Retrieving `steps` and `sampler_name` from the `d2_pipe` object, which summarizes generation parameters.
Using the preset `a1111` with the value input to `arg_1`. Using `D2 Pipe` to add the checkpoint name.
D2 Prompt
- You can select LoRA from the
CHOOSEbutton and insert an A1111-style LoRA prompt - Delete comments in text
- Targets lines starting with "#", lines starting with "//", and text between "/" and "/"
- Displays token count at the bottom (works when
token_countistrue) - Uses "ViT-L/14" CLIP for token count measurement. Please use
D2 Token Counterif you want to use other CLIP models
About Comment Shortcut Keys
- Comment shortcut key (ctrl + /) is available in all text boxes
- Shortcut keys can be changed in
Settings > D2 > shortcutKey - Delete the content above if you want to disable it
D2 Prompt Sanitizer
- A node that cleans up prompt strings
- Converts
_(underscore) to a space (long_hair→long hair) - Ensures a single space after each
,(comma) and tidies up surrounding whitespace (a , b→a, b) - Collapses redundant consecutive commas and removes commas at the start of a line (
a,, ,b→a, b) - Each transformation can be toggled on / off individually
Input
underscore_to_space: Convert_to a spacespace_after_comma: Tidy the whitespace around commas and normalize it to,(line breaks are preserved)remove_extra_comma: Collapse redundant consecutive commas (,,/, ,) into one and remove commas at the start of a line (line breaks are preserved)protect_lora: Protect LoRA notation enclosed in<...>from conversion (keeps the underscores in<lora:my_lora:1>)protect_score: Protect Pony quality tags such asscore_9/score_8_upfrom conversion
D2 Token Counter
- Counts tokens in prompts