Update app.py
Browse files
app.py
CHANGED
@@ -50,6 +50,9 @@ if "system_message" not in st.session_state:
|
|
50 |
if "starter_message" not in st.session_state:
|
51 |
st.session_state.starter_message = "Hello, there! How can I help you today?"
|
52 |
|
|
|
|
|
|
|
53 |
# Initialize state for continue action
|
54 |
need_continue = False
|
55 |
|
@@ -171,7 +174,6 @@ refresh_chat()
|
|
171 |
st.session_state.user_text = st.chat_input(placeholder="Enter your text here.")
|
172 |
|
173 |
# When the user enters new text
|
174 |
-
can_continue = False
|
175 |
if st.session_state.user_text:
|
176 |
# Display the user's message
|
177 |
with st.chat_message("user", avatar=st.session_state.avatars['user']):
|
@@ -189,12 +191,12 @@ if st.session_state.user_text:
|
|
189 |
continue_last=False
|
190 |
)
|
191 |
st.markdown(response)
|
192 |
-
can_continue = True
|
193 |
|
194 |
# Clear the user input
|
195 |
st.session_state.user_text = None
|
196 |
|
197 |
-
if can_continue:
|
198 |
if st.button("Continue"):
|
199 |
need_continue = True
|
200 |
else:
|
|
|
50 |
if "starter_message" not in st.session_state:
|
51 |
st.session_state.starter_message = "Hello, there! How can I help you today?"
|
52 |
|
53 |
+
if "can_continue" not in st.session_state:
|
54 |
+
st.session_state.can_continue = False
|
55 |
+
|
56 |
# Initialize state for continue action
|
57 |
need_continue = False
|
58 |
|
|
|
174 |
st.session_state.user_text = st.chat_input(placeholder="Enter your text here.")
|
175 |
|
176 |
# When the user enters new text
|
|
|
177 |
if st.session_state.user_text:
|
178 |
# Display the user's message
|
179 |
with st.chat_message("user", avatar=st.session_state.avatars['user']):
|
|
|
191 |
continue_last=False
|
192 |
)
|
193 |
st.markdown(response)
|
194 |
+
st.session_state.can_continue = True
|
195 |
|
196 |
# Clear the user input
|
197 |
st.session_state.user_text = None
|
198 |
|
199 |
+
if st.session_state.can_continue:
|
200 |
if st.button("Continue"):
|
201 |
need_continue = True
|
202 |
else:
|