mirror of
https://github.com/lllyasviel/stable-diffusion-webui-forge.git
synced 2026-01-26 19:09:45 +00:00
(#1862) a fix for the 0.01% who use comments in prompts. Before this, styles could be considered part of a comment. strips comments from prompts first, then from each applied style before merge same process for extracting styles from prompts updated tooltips for toolbuttons to apply styles removed code made redundant by this change, from modules.processing_scripts.comments
14 lines
593 B
Python
14 lines
593 B
Python
from modules import shared
|
|
import re
|
|
|
|
def strip_comments(text):
|
|
if shared.opts.enable_prompt_comments:
|
|
text = re.sub('(^|\n)#[^\n]*(\n|$)', '\n', text) # whole line comment
|
|
text = re.sub('#[^\n]*(\n|$)', '\n', text) # in the middle of the line comment
|
|
|
|
return text
|
|
|
|
shared.options_templates.update(shared.options_section(('sd', "Stable Diffusion", "sd"), {
|
|
"enable_prompt_comments": shared.OptionInfo(True, "Enable comments").info("Use # anywhere in the prompt to hide the text between # and the end of the line from the generation."),
|
|
}))
|