Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -54,6 +54,22 @@ def launch_bot():
|
|
54 |
if "messages" not in st.session_state.keys():
|
55 |
st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
|
56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
# Display chat messages
|
58 |
for message in st.session_state.messages:
|
59 |
with st.chat_message(message["role"]):
|
|
|
54 |
if "messages" not in st.session_state.keys():
|
55 |
st.session_state.messages = [{"role": "assistant", "content": "How may I help you?"}]
|
56 |
|
57 |
+
###
|
58 |
+
# Display clickable buttons for example questions
|
59 |
+
st.markdown("## Try these example questions:")
|
60 |
+
for question in cfg.examples:
|
61 |
+
if st.button(question):
|
62 |
+
prompt = question
|
63 |
+
process_user_input(prompt) # Function to process and display the user input and response
|
64 |
+
|
65 |
+
# Function to process and display the user input and response
|
66 |
+
def process_user_input(user_input):
|
67 |
+
st.session_state.messages.append({"role": "user", "content": user_input})
|
68 |
+
response = generate_response(user_input)
|
69 |
+
st.session_state.messages.append({"role": "assistant", "content": response})
|
70 |
+
display_chat_messages()
|
71 |
+
###
|
72 |
+
|
73 |
# Display chat messages
|
74 |
for message in st.session_state.messages:
|
75 |
with st.chat_message(message["role"]):
|