From f08bb9a2012eeac213232c2fe087ba330b1801fb Mon Sep 17 00:00:00 2001 From: oobabooga <112222186+oobabooga@users.noreply.github.com> Date: Thu, 24 Jul 2025 10:34:59 -0700 Subject: [PATCH] Handle edge case in chat history loading (closes #7155) --- modules/chat.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/chat.py b/modules/chat.py index 827b6050..1a16a689 100644 --- a/modules/chat.py +++ b/modules/chat.py @@ -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