...
Browse files- history/user_sessions.json +1 -0
- 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 |
-
|
30 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 {}
|