aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ui.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2024-02-11 09:56:53 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2024-02-11 09:56:53 +0000
commitb7f45e67dcf48914d2f34d4ace977a431a5aa12e (patch)
treeb37f0c45fd54d2b5aab4b4d23ccb6bb3eed48c16 /modules/ui.py
parent02ab75b86a91f2ae28edc4ca6ef00c3ab4b51d89 (diff)
downloadstable-diffusion-webui-gfx803-b7f45e67dcf48914d2f34d4ace977a431a5aa12e.tar.gz
stable-diffusion-webui-gfx803-b7f45e67dcf48914d2f34d4ace977a431a5aa12e.tar.bz2
stable-diffusion-webui-gfx803-b7f45e67dcf48914d2f34d4ace977a431a5aa12e.zip
add before_token_counter callback and use it for prompt comments
Diffstat (limited to 'modules/ui.py')
-rw-r--r--modules/ui.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/ui.py b/modules/ui.py
index 5284a630..dcba8e88 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -152,6 +152,12 @@ def connect_clear_prompt(button):
def update_token_counter(text, steps, styles, *, is_positive=True):
+ params = script_callbacks.BeforeTokenCounterParams(text, steps, styles, is_positive=is_positive)
+ script_callbacks.before_token_counter_callback(params)
+ text = params.prompt
+ steps = params.steps
+ styles = params.styles
+ is_positive = params.is_positive
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