Spaces:
Sleeping
Sleeping
Update app.py
Browse files167 unmodified lines168169170171172173174175176177178179180181182183184167 unmodified linesif follow_up_query:with st.spinner("Generating response..."):try:follow_up_context = "\n".join([f"Q: {q}\nA: {a}" for q, a in st.session_state.chat_history[-5:]])follow_up_prompt = f"""Based on the following context and the new question, provide a detailed answer. If the new question is not related to the previous context, answer it independently.Context:{follow_up_context}New Question: {follow_up_query}Answer:"""follow_up_response = generate_detailed_explanation(follow_up_query, follow_up_prompt)st.session_state.chat_history.append((follow_up_query, follow_up_response))st.rerun() # Rerun to display the new responseexcept Exception as e:167 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:
app.py+1-11