shukdevdatta123 commited on
Commit
d26c2b9
·
verified ·
1 Parent(s): 7a8aacd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -103,8 +103,12 @@ if option == "Ask a Question":
103
  # View previous conversations
104
  elif option == "View Previous Conversations":
105
  if os.path.exists(conversation_file):
106
- with open(conversation_file, "r") as file:
107
- st.text_area("Previous Conversations", file.read(), height=300)
 
 
 
 
108
  else:
109
  st.warning("No previous conversations found.")
110
 
 
103
  # View previous conversations
104
  elif option == "View Previous Conversations":
105
  if os.path.exists(conversation_file):
106
+ try:
107
+ with open(conversation_file, "r", encoding="utf-8", errors="replace") as file:
108
+ content = file.read()
109
+ st.text_area("Previous Conversations", content, height=300)
110
+ except Exception as e:
111
+ st.error(f"An error occurred while reading the file: {e}")
112
  else:
113
  st.warning("No previous conversations found.")
114