Your Name commited on
Commit
b5c4cd2
1 Parent(s): 17ebf96

多线程超频错误

Browse files
Files changed (1) hide show
  1. crazy_functions/crazy_utils.py +2 -2
crazy_functions/crazy_utils.py CHANGED
@@ -105,7 +105,7 @@ def request_gpt_model_in_new_thread_with_ui_alive(
105
  if retry_op > 0:
106
  retry_op -= 1
107
  mutable[0] += f"[Local Message] 重试中,请稍等 {retry_times_at_unknown_error-retry_op}/{retry_times_at_unknown_error}:\n\n"
108
- if "Rate limit reached" in tb_str:
109
  time.sleep(30)
110
  time.sleep(5)
111
  continue # 返回重试
@@ -234,7 +234,7 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
234
  if retry_op > 0:
235
  retry_op -= 1
236
  wait = random.randint(5, 20)
237
- if "Rate limit reached" in tb_str:
238
  wait = wait * 3
239
  fail_info = "OpenAI绑定信用卡可解除频率限制 "
240
  else:
 
105
  if retry_op > 0:
106
  retry_op -= 1
107
  mutable[0] += f"[Local Message] 重试中,请稍等 {retry_times_at_unknown_error-retry_op}/{retry_times_at_unknown_error}:\n\n"
108
+ if ("Rate limit reached" in tb_str) or ("Too Many Requests" in tb_str):
109
  time.sleep(30)
110
  time.sleep(5)
111
  continue # 返回重试
 
234
  if retry_op > 0:
235
  retry_op -= 1
236
  wait = random.randint(5, 20)
237
+ if ("Rate limit reached" in tb_str) or ("Too Many Requests" in tb_str):
238
  wait = wait * 3
239
  fail_info = "OpenAI绑定信用卡可解除频率限制 "
240
  else: