From f10ea203511a87dd66e8f29d90400417ecc1e122 Mon Sep 17 00:00:00 2001 From: qingxu fu <505030475@qq.com> Date: Fri, 14 Apr 2023 13:15:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=BB=B6=E9=95=BF=E9=81=87=E5=88=B0Rate=20limi?= =?UTF-8?q?t=20reached=E6=97=B6=E7=9A=84=E7=AD=89=E5=BE=85=E6=97=B6?= =?UTF-8?q?=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- crazy_functions/crazy_utils.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/crazy_functions/crazy_utils.py b/crazy_functions/crazy_utils.py index d6cadf8..6806d4b 100644 --- a/crazy_functions/crazy_utils.py +++ b/crazy_functions/crazy_utils.py @@ -100,10 +100,13 @@ def request_gpt_model_in_new_thread_with_ui_alive( except: # 【第三种情况】:其他错误:重试几次 tb_str = '```\n' + traceback.format_exc() + '```' + print(tb_str) mutable[0] += f"[Local Message] 警告,在执行过程中遭遇问题, Traceback:\n\n{tb_str}\n\n" - if retry_op > 0: + if retry_op > 0: retry_op -= 1 mutable[0] += f"[Local Message] 重试中 {retry_times_at_unknown_error-retry_op}/{retry_times_at_unknown_error}:\n\n" + if "Rate limit reached" in tb_str: + time.sleep(30) time.sleep(5) continue # 返回重试 else: