qingxu99 commited on
Commit
f10ea20
1 Parent(s): 2e044d9

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

Browse files
Files changed (1) hide show
  1. crazy_functions/crazy_utils.py +4 -1
crazy_functions/crazy_utils.py CHANGED
@@ -100,10 +100,13 @@ def request_gpt_model_in_new_thread_with_ui_alive(
100
  except:
101
  # 【第三种情况】:其他错误:重试几次
102
  tb_str = '```\n' + traceback.format_exc() + '```'
 
103
  mutable[0] += f"[Local Message] 警告,在执行过程中遭遇问题, Traceback:\n\n{tb_str}\n\n"
104
- if retry_op > 0:
105
  retry_op -= 1
106
  mutable[0] += f"[Local Message] 重试中 {retry_times_at_unknown_error-retry_op}/{retry_times_at_unknown_error}:\n\n"
 
 
107
  time.sleep(5)
108
  continue # 返回重试
109
  else:
 
100
  except:
101
  # 【第三种情况】:其他错误:重试几次
102
  tb_str = '```\n' + traceback.format_exc() + '```'
103
+ print(tb_str)
104
  mutable[0] += f"[Local Message] 警告,在执行过程中遭遇问题, Traceback:\n\n{tb_str}\n\n"
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 # 返回重试
112
  else: