diff --git a/aiserver.py b/aiserver.py index 6fa2307e..b3e0710b 100644 --- a/aiserver.py +++ b/aiserver.py @@ -9384,7 +9384,11 @@ def text2img_api(prompt, apiaddress = '{}/sdapi/v1/txt2img'.format(koboldai_vars.img_gen_api_url.rstrip("/")) payload_json = json.dumps(final_imgen_params) logger.debug(final_imgen_params) - submit_req = requests.post(url=apiaddress, data=payload_json) + + try: + submit_req = requests.post(url=apiaddress, data=payload_json) + finally: + koboldai_vars.generating_image = False if submit_req.status_code == 404: show_error_notification( @@ -9396,7 +9400,6 @@ def text2img_api(prompt, elif not submit_req.ok: show_error_notification("SD Web API Failure", f"HTTP Code {submit_req.status_code} -- See console for details") logger.error(f"SD Web API Failure: HTTP Code {submit_req.status_code}, Body:\n{submit_req.text}") - koboldai_vars.generating_image = False return None results = submit_req.json() diff --git a/gensettings.py b/gensettings.py index 7ca496c7..6af24f21 100644 --- a/gensettings.py +++ b/gensettings.py @@ -670,23 +670,6 @@ gensettingstf = [ "ui_level": 2 }, { - "UI_V2_Only": True, - "uitype": "toggle", - "unit": "bool", - "label": "Reset Image Generating", - "id": "generating_image", - "min": 0, - "max": 1, - "step": 1, - "default": 0, - "tooltip": "Use to reset image gen flag in case of error.", - "menu_path": "Interface", - "sub_path": "Images", - "classname": "system", - "name": "generating_image", - "ui_level": 2 - }, - { "UI_V2_Only": True, "uitype": "toggle", "unit": "bool", diff --git a/koboldai_settings.py b/koboldai_settings.py index e057698e..a28fbcba 100644 --- a/koboldai_settings.py +++ b/koboldai_settings.py @@ -1060,7 +1060,8 @@ class system_settings(settings): no_save_variables = ['socketio', 'lua_state', 'lua_logname', 'lua_koboldbridge', 'lua_kobold', 'lua_koboldcore', 'sp', 'sp_length', '_horde_pid', 'horde_share', 'aibusy', 'serverstarted', 'inference_config', 'image_pipeline', 'summarizer', - 'summary_tokenizer', 'use_colab_tpu', 'noai', 'disable_set_aibusy', 'cloudflare_link', 'tts_model'] + 'summary_tokenizer', 'use_colab_tpu', 'noai', 'disable_set_aibusy', 'cloudflare_link', 'tts_model', + 'generating_image'] settings_name = "system" def __init__(self, socketio, koboldai_var): self.socketio = socketio