Update app.py
Browse files
app.py
CHANGED
@@ -46,9 +46,8 @@ if "system_message" not in st.session_state:
|
|
46 |
if "starter_message" not in st.session_state:
|
47 |
st.session_state.starter_message = "Hello, there! How can I help you today?"
|
48 |
|
49 |
-
# Initialize
|
50 |
-
|
51 |
-
st.session_state.need_continue = False
|
52 |
|
53 |
# Initialize the last response
|
54 |
if "last_response" not in st.session_state:
|
@@ -186,8 +185,11 @@ if st.session_state.user_text:
|
|
186 |
# Clear the user input
|
187 |
st.session_state.user_text = None
|
188 |
|
|
|
|
|
|
|
189 |
# If "Continue" button was pressed
|
190 |
-
if
|
191 |
# Display a spinner while generating the continuation
|
192 |
with st.chat_message("assistant", avatar=st.session_state.avatars['assistant']):
|
193 |
with st.spinner("Continuing..."):
|
@@ -200,10 +202,4 @@ if st.session_state.get('need_continue', False):
|
|
200 |
continue_last=True
|
201 |
)
|
202 |
st.markdown(response)
|
203 |
-
# refresh_chat()
|
204 |
-
|
205 |
-
# Reset the flag
|
206 |
-
st.session_state.need_continue = False
|
207 |
-
|
208 |
-
if st.button("Continue"):
|
209 |
-
st.session_state.need_continue = True
|
|
|
46 |
if "starter_message" not in st.session_state:
|
47 |
st.session_state.starter_message = "Hello, there! How can I help you today?"
|
48 |
|
49 |
+
# Initialize state for continue action
|
50 |
+
need_continue = False
|
|
|
51 |
|
52 |
# Initialize the last response
|
53 |
if "last_response" not in st.session_state:
|
|
|
185 |
# Clear the user input
|
186 |
st.session_state.user_text = None
|
187 |
|
188 |
+
if st.button("Continue"):
|
189 |
+
need_continue = True
|
190 |
+
|
191 |
# If "Continue" button was pressed
|
192 |
+
if need_continue:
|
193 |
# Display a spinner while generating the continuation
|
194 |
with st.chat_message("assistant", avatar=st.session_state.avatars['assistant']):
|
195 |
with st.spinner("Continuing..."):
|
|
|
202 |
continue_last=True
|
203 |
)
|
204 |
st.markdown(response)
|
205 |
+
# refresh_chat()
|
|
|
|
|
|
|
|
|
|
|
|