Fix chat history getting lost if the UI is inactive for a long time (closes #7109)

This commit is contained in:
oobabooga 2025-07-04 06:04:04 -07:00
parent 23bb94a5fb
commit 92ec8dda03

View file

@ -296,7 +296,7 @@ def gather_interface_values(*args):
shared.persistent_interface_state.pop('textbox') shared.persistent_interface_state.pop('textbox')
# Prevent history loss if backend is restarted but UI is not refreshed # 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']) output['history'] = load_history(output['unique_id'], output['character_menu'], output['mode'])
return output return output