diff options
author | Aarni Koskela <akx@iki.fi> | 2023-05-21 20:20:50 +0000 |
---|---|---|
committer | Aarni Koskela <akx@iki.fi> | 2023-05-21 20:25:06 +0000 |
commit | 618c59b01d8b90794df0aea625de1c1d5d94d407 (patch) | |
tree | 6682a1f16f590047a930e00571fc43672f8bb005 | |
parent | 5ed970b94972004961ecada3bc1c936ef6017f3c (diff) | |
download | stable-diffusion-webui-gfx803-618c59b01d8b90794df0aea625de1c1d5d94d407.tar.gz stable-diffusion-webui-gfx803-618c59b01d8b90794df0aea625de1c1d5d94d407.tar.bz2 stable-diffusion-webui-gfx803-618c59b01d8b90794df0aea625de1c1d5d94d407.zip |
Add option to disable prompt token counters
-rw-r--r-- | javascript/token-counters.js | 8 | ||||
-rw-r--r-- | modules/shared.py | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/javascript/token-counters.js b/javascript/token-counters.js index 0b74658c..9d81a723 100644 --- a/javascript/token-counters.js +++ b/javascript/token-counters.js @@ -21,6 +21,9 @@ function update_img2img_tokens(...args) { } function update_token_counter(button_id) { + if (opts.disable_token_counters) { + return; + } if (promptTokenCountTimeouts[button_id]) { clearTimeout(promptTokenCountTimeouts[button_id]); } @@ -54,6 +57,11 @@ function setupTokenCounting(id, id_counter, id_button) { var counter = gradioApp().getElementById(id_counter); var textarea = gradioApp().querySelector(`#${id} > label > textarea`); + if (opts.disable_token_counters) { + counter.style.display = "none"; + return; + } + if (counter.parentElement == prompt.parentElement) { return; } diff --git a/modules/shared.py b/modules/shared.py index 3099d1d2..e8dbd8a4 100644 --- a/modules/shared.py +++ b/modules/shared.py @@ -487,6 +487,7 @@ options_templates.update(options_section(('ui', "User interface"), { "ui_reorder": OptionInfo(", ".join(ui_reorder_categories), "txt2img/img2img UI item order").needs_restart(),
"hires_fix_show_sampler": OptionInfo(False, "Hires fix: show hires sampler selection").needs_restart(),
"hires_fix_show_prompts": OptionInfo(False, "Hires fix: show hires prompt and negative prompt").needs_restart(),
+ "disable_token_counters": OptionInfo(False, "Disable prompt token counters").needs_restart(),
}))
options_templates.update(options_section(('infotext', "Infotext"), {
|