Spaces:
Sleeping
Sleeping
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -4
src/streamlit_app.py
CHANGED
|
@@ -745,10 +745,15 @@ def render_ai_chat():
|
|
| 745 |
if user_question:
|
| 746 |
with st.spinner("Thinking..."):
|
| 747 |
response = query_ai(user_question)
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
|
| 753 |
# Display history
|
| 754 |
if st.session_state.chat_history:
|
|
|
|
| 745 |
if user_question:
|
| 746 |
with st.spinner("Thinking..."):
|
| 747 |
response = query_ai(user_question)
|
| 748 |
+
if response and 'answer' in response:
|
| 749 |
+
st.session_state.chat_history.append({
|
| 750 |
+
'question': user_question,
|
| 751 |
+
'answer': response['answer']
|
| 752 |
+
})
|
| 753 |
+
elif response and 'error' in response:
|
| 754 |
+
st.error(f"❌ {response['error']}")
|
| 755 |
+
else:
|
| 756 |
+
st.warning("⚠️ Unable to get AI response. Please try again.")
|
| 757 |
|
| 758 |
# Display history
|
| 759 |
if st.session_state.chat_history:
|