YingxuHe commited on
Commit
01221b8
1 Parent(s): b4ca523

Update utils.py

Browse files
Files changed (1) hide show
  1. utils.py +3 -3
utils.py CHANGED
@@ -198,11 +198,11 @@ def generate_response(text_input):
198
  return stream, warnings
199
 
200
 
201
- def retry_generate_response(retry=3):
202
  response, warnings = "", []
203
 
204
  try:
205
- stream, warnings = generate_response(st.session_state.prompt)
206
  for warning_msg in warnings:
207
  st.warning(warning_msg)
208
  response = st.write_stream(stream)
@@ -210,7 +210,7 @@ def retry_generate_response(retry=3):
210
  if retry == 0:
211
  raise e
212
 
213
- st.error(f"Internet connection is down. Trying to re-establish connection ({retry}).")
214
 
215
  if st.session_state.server.is_down():
216
  st.session_state.server.restart()
 
198
  return stream, warnings
199
 
200
 
201
+ def retry_generate_response(prompt, retry=3):
202
  response, warnings = "", []
203
 
204
  try:
205
+ stream, warnings = generate_response(prompt)
206
  for warning_msg in warnings:
207
  st.warning(warning_msg)
208
  response = st.write_stream(stream)
 
210
  if retry == 0:
211
  raise e
212
 
213
+ st.warning(f"Internet connection is down. Trying to re-establish connection ({retry}).")
214
 
215
  if st.session_state.server.is_down():
216
  st.session_state.server.restart()