This commit is contained in:
Haoming 2025-09-09 11:34:42 +08:00
parent 1c9fe22fd3
commit d38c616681
2 changed files with 5 additions and 3 deletions

View File

@ -384,6 +384,7 @@ options_templates.update(
"sd_webui_modal_lightbox_toolbar_opacity": OptionInfo(0.9, "[Lightbox]: tool bar opacity", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.05}, onchange=shared.reload_gradio_theme).info("for mouse only").needs_reload_ui(),
"open_dir_button_choice": OptionInfo("Subdirectory", "What directory the [📂] button opens", gr.Radio, {"choices": ("Output Root", "Subdirectory", "Subdirectory (even temp dir)")}),
"hires_button_gallery_insert": OptionInfo(False, "When using the [✨] button, insert the upscaled image to the gallery").info("otherwise replace the selected image in the gallery"),
"hires_insert_index": OptionInfo(True, "When the above option is enabled, automatically select the upscaled image").info("otherwise select the original image"),
},
)
)

View File

@ -111,14 +111,15 @@ def txt2img_upscale_function(id_task: str, request: gr.Request, gallery, gallery
if i == gallery_index:
new_gallery.extend(processed.images)
new_index = gallery_index
if insert:
new_index += 1
new_index = gallery_index + 1
geninfo["infotexts"].insert(new_index, processed.info)
if not getattr(shared.opts, "hires_insert_index", True):
gallery_index -= 1
else:
geninfo["infotexts"][gallery_index] = processed.info
return new_gallery, json.dumps(geninfo), plaintext_to_html(processed.info), plaintext_to_html(processed.comments, classname="comments")
return gr.update(value=new_gallery, selected_index=gallery_index), json.dumps(geninfo), plaintext_to_html(processed.info), plaintext_to_html(processed.comments, classname="comments")
def txt2img_function(id_task: str, request: gr.Request, *args):