Fix for comments in prompts with styles (#1948)
(#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
This commit is contained in:
@@ -27,6 +27,7 @@ from modules import prompt_parser
|
||||
from modules.infotext_utils import image_from_url_text, PasteField
|
||||
from modules_forge.forge_canvas.canvas import ForgeCanvas, canvas_head
|
||||
from modules_forge import main_entry, forge_space
|
||||
import modules.processing_scripts.comments as comments
|
||||
|
||||
|
||||
create_setting_component = ui_settings.create_setting_component
|
||||
@@ -173,6 +174,8 @@ def update_token_counter(text, steps, styles, *, is_positive=True):
|
||||
if shared.opts.include_styles_into_token_counters:
|
||||
apply_styles = shared.prompt_styles.apply_styles_to_prompt if is_positive else shared.prompt_styles.apply_negative_styles_to_prompt
|
||||
text = apply_styles(text, styles)
|
||||
else:
|
||||
text = comments.strip_comments(text).strip()
|
||||
|
||||
try:
|
||||
text, _ = extra_networks.parse_prompt(text)
|
||||
|
||||
Reference in New Issue
Block a user