Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -349,10 +349,18 @@ def main():
|
|
349 |
user_question = st.text_input("Ask your question:", key="user_input")
|
350 |
|
351 |
if st.session_state.chat_ready and user_question:
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
356 |
|
357 |
# After bot responds, ask for feedback
|
358 |
with st.form(key=f"feedback_form_{len(st.session_state.chat_history)}"):
|
|
|
349 |
user_question = st.text_input("Ask your question:", key="user_input")
|
350 |
|
351 |
if st.session_state.chat_ready and user_question:
|
352 |
+
with st.spinner("Generating answer..."):
|
353 |
+
try:
|
354 |
+
set_global_vectorstore(st.session_state.vectorstore)
|
355 |
+
response = handle_user_query(user_question)
|
356 |
+
except Exception as e:
|
357 |
+
response = f"⚠️ Something went wrong: {e}"
|
358 |
+
|
359 |
+
# ✅ Show the response
|
360 |
+
st.markdown(f"**Answer:**\n\n{response}")
|
361 |
+
st.write(response)
|
362 |
+
|
363 |
+
st.session_state.chat_history.append({"user": user_question, "bot": response})
|
364 |
|
365 |
# After bot responds, ask for feedback
|
366 |
with st.form(key=f"feedback_form_{len(st.session_state.chat_history)}"):
|