ash2203 commited on
Commit
bc7ddbc
·
verified ·
1 Parent(s): ef0d7c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -11
app.py CHANGED
@@ -168,17 +168,7 @@ if st.session_state.query_submitted:
168
  if follow_up_query:
169
  with st.spinner("Generating response..."):
170
  try:
171
- follow_up_context = "\n".join([f"Q: {q}\nA: {a}" for q, a in st.session_state.chat_history[-5:]])
172
- 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.
173
-
174
- Context:
175
- {follow_up_context}
176
-
177
- New Question: {follow_up_query}
178
-
179
- Answer:"""
180
-
181
- follow_up_response = generate_detailed_explanation(follow_up_query, follow_up_prompt)
182
  st.session_state.chat_history.append((follow_up_query, follow_up_response))
183
  st.rerun() # Rerun to display the new response
184
  except Exception as e:
 
168
  if follow_up_query:
169
  with st.spinner("Generating response..."):
170
  try:
171
+ follow_up_response = generate_detailed_explanation(follow_up_query, "") # Passing an empty context
 
 
 
 
 
 
 
 
 
 
172
  st.session_state.chat_history.append((follow_up_query, follow_up_response))
173
  st.rerun() # Rerun to display the new response
174
  except Exception as e: