andreska commited on
Commit
c9b44c4
·
verified ·
1 Parent(s): 9898aa3

Try fix problem with clearing user input box

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -36,6 +36,7 @@ st.markdown(
36
 
37
  def handle_submit():
38
  user_input = st.session_state.user_input
 
39
  if user_input:
40
  if st.session_state.include_context:
41
  messages = [
@@ -57,8 +58,8 @@ def handle_submit():
57
  )
58
 
59
  answer = completion.choices[0].message['content']
60
- st.session_state.conversation = f"<p><strong>User:</strong> {user_input}</p><p><strong>Adrega AI:</strong> {answer}</p>" + st.session_state.conversation
61
- st.session_state.user_input = ""
62
  else:
63
  st.session_state.conversation(f"<p><strong>Adrega AI:</strong>: Please enter a question.")
64
 
 
36
 
37
  def handle_submit():
38
  user_input = st.session_state.user_input
39
+ st.session_state.user_input = ""
40
  if user_input:
41
  if st.session_state.include_context:
42
  messages = [
 
58
  )
59
 
60
  answer = completion.choices[0].message['content']
61
+
62
+ st.session_state.conversation = f"<p><strong>User:</strong> {user_input}</p><p><strong>Adrega AI:</strong> {answer}</p>" + st.session_state.conversation
63
  else:
64
  st.session_state.conversation(f"<p><strong>Adrega AI:</strong>: Please enter a question.")
65