Spaces:
Sleeping
Sleeping
Update app.py
Browse files167 unmodified lines168169170171172173174167 unmodified linesif follow_up_query:with st.spinner("Generating response..."):try:follow_up_response = generate_detailed_explanation(follow_up_query, "") # Passing an empty contextst.session_state.chat_history.append((follow_up_query, follow_up_response))st.rerun() # Rerun to display the new responseexcept Exception as e:167 unmodified lines168169170171172173174175176177178167 unmodified linesif follow_up_query:with st.spinner("Generating response..."):try:# Get the last 5 messages from the chat historylast_5_messages = st.session_state.chat_history[-5:]context = "\n".join([f"Q: {q}\nA: {a}" for q, a in last_5_messages])follow_up_response = generate_detailed_explanation(follow_up_query, context)st.session_state.chat_history.append((follow_up_query, follow_up_response))st.rerun() # Rerun to display the new responseexcept Exception as e:
app.py+5-1