shukdevdatta123 commited on
Commit
801d712
·
verified ·
1 Parent(s): c6657a0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -87,11 +87,14 @@ def load_conversations(phone_number):
87
  for line in f:
88
  try:
89
  conversation = json.loads(line)
90
- if conversation.get("phone_number") == phone_number:
91
  conversations.append(conversation)
92
  except json.JSONDecodeError:
93
  st.error("Error decoding JSON from conversations file. Please check the file.")
94
  continue
 
 
 
95
  return conversations
96
  return []
97
 
 
87
  for line in f:
88
  try:
89
  conversation = json.loads(line)
90
+ if isinstance(conversation, dict) and conversation.get("phone_number") == phone_number:
91
  conversations.append(conversation)
92
  except json.JSONDecodeError:
93
  st.error("Error decoding JSON from conversations file. Please check the file.")
94
  continue
95
+ except Exception as e:
96
+ st.error(f"Unexpected error: {e}")
97
+ continue
98
  return conversations
99
  return []
100