Spaces:
Sleeping
Sleeping
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -57,7 +57,14 @@ def list_chat_histories():
|
|
| 57 |
|
| 58 |
def load_chat_history(filename):
|
| 59 |
"""
|
| 60 |
-
Load a specific chat history file.
|
| 61 |
"""
|
| 62 |
-
|
| 63 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
|
| 58 |
def load_chat_history(filename):
|
| 59 |
"""
|
| 60 |
+
Load a specific chat history file with None check.
|
| 61 |
"""
|
| 62 |
+
if not filename:
|
| 63 |
+
st.warning("No file selected to load history.")
|
| 64 |
+
return []
|
| 65 |
+
try:
|
| 66 |
+
with open(os.path.join("history", filename), "r") as f:
|
| 67 |
+
return json.load(f)
|
| 68 |
+
except FileNotFoundError:
|
| 69 |
+
st.warning("Selected history file not found.")
|
| 70 |
+
return []
|