Add option to disable prompt token counters
This commit is contained in:
parent
5ed970b949
commit
618c59b01d
@ -21,6 +21,9 @@ function update_img2img_tokens(...args) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function update_token_counter(button_id) {
|
function update_token_counter(button_id) {
|
||||||
|
if (opts.disable_token_counters) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (promptTokenCountTimeouts[button_id]) {
|
if (promptTokenCountTimeouts[button_id]) {
|
||||||
clearTimeout(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 counter = gradioApp().getElementById(id_counter);
|
||||||
var textarea = gradioApp().querySelector(`#${id} > label > textarea`);
|
var textarea = gradioApp().querySelector(`#${id} > label > textarea`);
|
||||||
|
|
||||||
|
if (opts.disable_token_counters) {
|
||||||
|
counter.style.display = "none";
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (counter.parentElement == prompt.parentElement) {
|
if (counter.parentElement == prompt.parentElement) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -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(),
|
"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_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(),
|
"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"), {
|
options_templates.update(options_section(('infotext', "Infotext"), {
|
||||||
|
Loading…
Reference in New Issue
Block a user