abidkh commited on
Commit
cc2ba16
·
1 Parent(s): fed900c
Files changed (2) hide show
  1. history/user_sessions.json +1 -0
  2. storage.py +8 -2
history/user_sessions.json CHANGED
@@ -0,0 +1 @@
 
 
1
+ {}
storage.py CHANGED
@@ -26,5 +26,11 @@ def load_history(user_id: str) -> str:
26
  def load_full_history() -> dict:
27
  if not os.path.exists(HISTORY_FILE):
28
  return {}
29
- with open(HISTORY_FILE, "r") as f:
30
- return json.load(f)
 
 
 
 
 
 
 
26
  def load_full_history() -> dict:
27
  if not os.path.exists(HISTORY_FILE):
28
  return {}
29
+ try:
30
+ with open(HISTORY_FILE, "r") as f:
31
+ content = f.read().strip()
32
+ if not content:
33
+ return {}
34
+ return json.loads(content)
35
+ except json.JSONDecodeError:
36
+ return {}