Handle edge case in chat history loading (closes #7155)

This commit is contained in:
oobabooga 2025-07-24 10:34:59 -07:00
parent d746484521
commit f08bb9a201

View file

@ -1175,6 +1175,9 @@ def save_last_chat_state(character, mode, unique_id):
def load_history(unique_id, character, mode):
p = get_history_file_path(unique_id, character, mode)
if not p.exists():
return {'internal': [], 'visible': [], 'metadata': {}}
f = json.loads(open(p, 'rb').read())
if 'internal' in f and 'visible' in f:
history = f