Remove reset switch for sd web api

Automatically recover from errors
This commit is contained in:
somebody
2022-11-24 23:34:48 -06:00
parent a48d31c746
commit ec20b31931
3 changed files with 7 additions and 20 deletions

View File

@@ -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()

View File

@@ -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",

View File

@@ -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