From 92ec8dda03b6a64a0efb5b4dc6b8109b460f19ad Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Fri, 4 Jul 2025 06:04:04 -0700 Subject: [PATCH] Fix chat history getting lost if the UI is inactive for a long time (closes #7109) --- modules/ui.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/ui.py b/modules/ui.py index fb719158..0030bb02 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -296,7 +296,7 @@ def gather_interface_values(*args): shared.persistent_interface_state.pop('textbox') # Prevent history loss if backend is restarted but UI is not refreshed - if output['history'] is None and output['unique_id'] is not None: + if (output['history'] is None or (len(output['history'].get('visible', [])) == 0 and len(output['history'].get('internal', [])) == 0)) and output['unique_id'] is not None: output['history'] = load_history(output['unique_id'], output['character_menu'], output['mode']) return output