zakerytclarke commited on
Commit
62c86e1
·
verified ·
1 Parent(s): a34dacf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -281,10 +281,6 @@ def handle_chat(prompt, user_input, teapot_ai):
281
  st.markdown(user_input)
282
  st.session_state.messages.append({"role": "user", "content": user_input})
283
 
284
- with st.chat_message("assistant"):
285
- st.markdown(response)
286
- st.session_state.messages.append({"role": "assistant", "content": response})
287
-
288
  results = brave_search(user_input)
289
 
290
  documents = [desc.replace('<strong>','').replace('</strong>','') for _, desc, _ in results]
@@ -300,6 +296,11 @@ def handle_chat(prompt, user_input, teapot_ai):
300
  context = "\n".join(documents)
301
  prompt = "You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization."
302
  response = query_teapot(prompt, context, user_input, teapot_ai)
 
 
 
 
 
303
 
304
  return response
305
 
 
281
  st.markdown(user_input)
282
  st.session_state.messages.append({"role": "user", "content": user_input})
283
 
 
 
 
 
284
  results = brave_search(user_input)
285
 
286
  documents = [desc.replace('<strong>','').replace('</strong>','') for _, desc, _ in results]
 
296
  context = "\n".join(documents)
297
  prompt = "You are Teapot, an open-source AI assistant optimized for low-end devices, providing short, accurate responses without hallucinating while excelling at information extraction and text summarization."
298
  response = query_teapot(prompt, context, user_input, teapot_ai)
299
+
300
+ with st.chat_message("assistant"):
301
+ st.markdown(response)
302
+ st.session_state.messages.append({"role": "assistant", "content": response})
303
+
304
 
305
  return response
306