延长遇到Rate limit reached时的等待时间

This commit is contained in:
qingxu fu 2023-04-14 13:15:42 +08:00
parent 2e044d97c7
commit f10ea20351

View File

@ -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: