3.5 KiB
SD Webui Prompt Format
[English|中文]
This is an Extension for the Automatic1111 Webui, which helps formatting prompts.

Sometimes, when you type too fast or copy prompts from all over the places, you end up with duplicated spaces or commas. This simple Extension helps removing them whenever you click Generate.
Features
- Works in both
txt2imgandimg2img - Works in both
PositiveandNegative, as well asHires. fixprompts - Remove extra spaces and commas
- Fix misplaced brackets and commas
- Enable
Remove Duplicatesto remove identical tags found in the prompts- Note: Only works for tag-based prompt, not sentence-based prompt
- eg.
1girl, solo, smile, 1girlwill become1girl, solo, smile - eg.
a girl smiling, a girl standingwill not be changed
- eg.
- Note: Only works for tag-based prompt, not sentence-based prompt
- Enable
Remove Underscoresto replace_withspace - Respect line breaks
Remove Duplicatesonly checks within the same line
- Append a comma before a line break
- Toggle between auto formatting and manual formatting
- In
Automode: The process is ran whenever you click on Generate - In
Manualmode: The process is only ran when you click the Format button
- In
- Toggle whether the above features are enabled / disabled by default in the
Prompt Formatsection under the System category of the Settings tab - Pressing
Alt+Shift+Fcan also trigger formatting - Assign "alias" that counts as duplicates for the specified tags
- Exclude specific tags from
Remove Underscores - Click
Reloadto cache new cards- By default, the
ExtraNetworkcards are cached once at the start, to be excluded fromRemove Underscores. If you added more cards while the Webui is already running, click this button to re-cache again.
- By default, the
Tag Alias
-
In the
Prompt Formatsettings, there is a new field for Tag Alias -
You can assign other tags that count as the same as the main tag, and thus get removed during
Remove Duplicates -
The syntax is in the format of
main tag: alias1, alias2, alias3- example:
1girl: girl, woman, lady- If you type
girl, it will get converted into1girl, and if you already have1girl, then the future ones will get removed.
- If you type
- example:
-
The pattern for alias uses Regular Expression, so certain symbols (eg.
(,)) will need to be escaped (ie.\(,\))- Comma is not supported, as it is used to separate multiple patterns
- Check out RegExr for cheatsheet
- example:
adult: \d*\s*(y\.?o\.?|[Yy]ear[s]? [Oo]ld)- It will convert
15 yo,20 y.o.,25 years old,30 Year Oldall intoadult
- It will convert
Note
-
Since the formatting in
Automode is triggered at the same time as the generation, the immediate image might not have its prompts updated. -
Some Extensions (eg. tagcomplete) listen to the text editing event, meaning the formatting will cause them to be triggered. You can disable updating the actual prompts in the
Prompt Formatsettings to prevent this. Though you may need to manually type something else for the prompt to get actually updated.