diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2024-02-11 09:56:53 +0000 |
---|---|---|
committer | AUTOMATIC1111 <16777216c@gmail.com> | 2024-02-11 09:56:53 +0000 |
commit | b7f45e67dcf48914d2f34d4ace977a431a5aa12e (patch) | |
tree | b37f0c45fd54d2b5aab4b4d23ccb6bb3eed48c16 /modules/ui.py | |
parent | 02ab75b86a91f2ae28edc4ca6ef00c3ab4b51d89 (diff) | |
download | stable-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.py | 6 |
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
|