Spaces:
Running
Running
Update utils.py
Browse files
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(
|
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.
|
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()
|