shukdevdatta123 commited on
Commit
b029384
·
verified ·
1 Parent(s): ae0fdda

Update app.py

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