fix js func signature and not forget to initialize confirmation var to prevent exception upon cancelling confirmation

This commit is contained in:
papuSpartan 2022-10-22 14:53:37 -05:00
parent 700340448b
commit ce42879438
2 changed files with 7 additions and 4 deletions

View File

@ -162,12 +162,13 @@ function selected_tab_id() {
} }
function clear_prompt(_, _prompt_neg, confirmed,_steps) { function clear_prompt(_, _prompt_neg, confirmed, _token_counter) {
confirmed = false
if(confirm("Delete prompt?")) { if(confirm("Delete prompt?")) {
confirmed = true confirmed = true
} else { } else {
return [_, confirmed] return [_, _prompt_neg, confirmed, _token_counter]
} }
if(selected_tab_id() == "tab_txt2img") { if(selected_tab_id() == "tab_txt2img") {
@ -176,7 +177,7 @@ return [_, confirmed]
update_token_counter("txt2img_token_button") update_token_counter("txt2img_token_button")
} }
return [_, _prompt_neg, confirmed,_steps] return [_, _prompt_neg, confirmed, _token_counter]
} }

View File

@ -429,10 +429,12 @@ def create_seed_inputs():
return seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox return seed, reuse_seed, subseed, reuse_subseed, subseed_strength, seed_resize_from_h, seed_resize_from_w, seed_checkbox
def clear_prompt(_prompt, _prompt_neg, confirmed, _token_counter): def clear_prompt(prompt, _prompt_neg, confirmed, _token_counter):
"""Given confirmation from a user on the client-side, go ahead with clearing prompt""" """Given confirmation from a user on the client-side, go ahead with clearing prompt"""
if confirmed: if confirmed:
return ["", "", confirmed, update_token_counter("", 1)] return ["", "", confirmed, update_token_counter("", 1)]
else:
return [prompt, _prompt_neg, confirmed, _token_counter]
def connect_clear_prompt(button, prompt, prompt_neg, _dummy_confirmed, token_counter): def connect_clear_prompt(button, prompt, prompt_neg, _dummy_confirmed, token_counter):