GGLS commited on
Commit
cf8bf4d
·
verified ·
1 Parent(s): 81395cb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -0
app.py CHANGED
@@ -61,6 +61,14 @@ for message in st.session_state.messages:
61
  with st.chat_message(message["role"]):
62
  st.write(message["content"])
63
 
 
 
 
 
 
 
 
 
64
  def clear_chat_history():
65
  st.session_state.messages = [{"role": "assistant", "content": "How may I assist you today?"}]
66
  st.sidebar.button('Clear Chat History', on_click=clear_chat_history)
 
61
  with st.chat_message(message["role"]):
62
  st.write(message["content"])
63
 
64
+ def set_query(query):
65
+ st.session_state.messages.append({"role": "user", "content": query})
66
+ # Create a list of candidate questions
67
+ candidate_questions = ["Can you tell me a joke?", "Write a quicksort code in Python.", "Write a poem about love in Shakespearean tone."]
68
+ # Display the chat interface with a list of clickable question buttons
69
+ for question in candidate_questions:
70
+ st.sidebar.button(label=question, on_click=set_query, args=[question])
71
+
72
  def clear_chat_history():
73
  st.session_state.messages = [{"role": "assistant", "content": "How may I assist you today?"}]
74
  st.sidebar.button('Clear Chat History', on_click=clear_chat_history)