Tamil Eniyan commited on
Commit ·
1bfc32c
1
Parent(s): 66c608a
Updated app to use fire base
Browse files
app.py
CHANGED
|
@@ -44,17 +44,16 @@ def load_curated_qa_pairs():
|
|
| 44 |
try:
|
| 45 |
with open(CURATED_QA_FILE, "r", encoding="utf-8") as f:
|
| 46 |
return json.load(f)
|
| 47 |
-
except:
|
|
|
|
| 48 |
return []
|
| 49 |
|
| 50 |
# ========================================
|
| 51 |
# Chatbot Interface & Conversation Handling
|
| 52 |
# ========================================
|
| 53 |
-
|
| 54 |
def display_conversation():
|
| 55 |
"""Displays conversation history in a structured chat format."""
|
| 56 |
-
for
|
| 57 |
-
role, message = entry
|
| 58 |
with st.chat_message(role):
|
| 59 |
st.write(message)
|
| 60 |
|
|
@@ -102,4 +101,4 @@ if user_query:
|
|
| 102 |
answer = response.get("answer", "I couldn't find an answer to that.")
|
| 103 |
|
| 104 |
add_to_conversation("assistant", answer)
|
| 105 |
-
st.rerun()
|
|
|
|
| 44 |
try:
|
| 45 |
with open(CURATED_QA_FILE, "r", encoding="utf-8") as f:
|
| 46 |
return json.load(f)
|
| 47 |
+
except Exception as e:
|
| 48 |
+
st.error(f"Error loading curated Q/A pairs: {e}")
|
| 49 |
return []
|
| 50 |
|
| 51 |
# ========================================
|
| 52 |
# Chatbot Interface & Conversation Handling
|
| 53 |
# ========================================
|
|
|
|
| 54 |
def display_conversation():
|
| 55 |
"""Displays conversation history in a structured chat format."""
|
| 56 |
+
for role, message in st.session_state.conversation_history:
|
|
|
|
| 57 |
with st.chat_message(role):
|
| 58 |
st.write(message)
|
| 59 |
|
|
|
|
| 101 |
answer = response.get("answer", "I couldn't find an answer to that.")
|
| 102 |
|
| 103 |
add_to_conversation("assistant", answer)
|
| 104 |
+
st.rerun()
|