victor7246 commited on
Commit
c62acd1
·
verified ·
1 Parent(s): 42c1511

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -187,7 +187,10 @@ if __name__ == '__main__':
187
  st.session_state.messages.append({"role": "assistant", "content": response})
188
 
189
  else:
190
- if st.button("Looks like this question is not related to the database, but a generic. Do you want me to answer it from the table? Otherwise I will use my own knowledge."):
 
 
 
191
  with st.status("Retrieving results..."):
192
  #top_table_names = table_search(question, topk=1)['table'].tolist()
193
  questions = extract_question_list(llm, question)
@@ -261,7 +264,8 @@ if __name__ == '__main__':
261
  st.markdown(response)
262
  # Add assistant response to chat history
263
  st.session_state.messages.append({"role": "assistant", "content": response})
264
- else:
 
265
  response = llm.invoke(question).content
266
  with st.chat_message("assistant"):
267
  st.markdown(response)
 
187
  st.session_state.messages.append({"role": "assistant", "content": response})
188
 
189
  else:
190
+ with st.chat_message("assistant"):
191
+ st.markdown("Looks like this question is not related to the database, but a generic. Do you want me to answer it from the table? Otherwise I will use my own knowledge.")
192
+ if st.button("Yes"):
193
+ question = st.session_state.messages[-1]['question']
194
  with st.status("Retrieving results..."):
195
  #top_table_names = table_search(question, topk=1)['table'].tolist()
196
  questions = extract_question_list(llm, question)
 
264
  st.markdown(response)
265
  # Add assistant response to chat history
266
  st.session_state.messages.append({"role": "assistant", "content": response})
267
+ elif st.button("No"):
268
+ question = st.session_state.messages[-1]['question']
269
  response = llm.invoke(question).content
270
  with st.chat_message("assistant"):
271
  st.markdown(response)