OpenAI缩减了免费用户的请求速率限制
This commit is contained in:
parent
b2fba01487
commit
ea7fd53a97
@ -19,6 +19,10 @@ if USE_PROXY:
|
||||
else:
|
||||
proxies = None
|
||||
|
||||
# 多线程函数插件中,默认允许多少路线程同时访问OpenAI。Free trial users的限制是每分钟3次,提高限制请查询:
|
||||
# https://platform.openai.com/docs/guides/rate-limits/overview
|
||||
DEFAULT_WORKER_NUM = 3
|
||||
|
||||
|
||||
# [step 3]>> 以下配置可以优化体验,但大部分场合下并不需要修改
|
||||
# 对话窗的高度
|
||||
@ -33,9 +37,6 @@ LAYOUT = "LEFT-RIGHT" # "LEFT-RIGHT"(左右布局) # "TOP-DOWN"(上下布
|
||||
# 发送请求到OpenAI后,等待多久判定为超时
|
||||
TIMEOUT_SECONDS = 30
|
||||
|
||||
# 多线程函数插件中,默认允许多少路线程同时访问OpenAI。OpenAI的限制是不能超过20
|
||||
DEFAULT_WORKER_NUM = 8
|
||||
|
||||
# 网页的端口, -1代表随机端口
|
||||
WEB_PORT = -1
|
||||
|
||||
|
@ -221,13 +221,21 @@ def request_gpt_model_multi_threads_with_very_awesome_ui_and_high_efficiency(
|
||||
except:
|
||||
# 【第三种情况】:其他错误
|
||||
tb_str = '```\n' + traceback.format_exc() + '```'
|
||||
print(tb_str)
|
||||
gpt_say += f"[Local Message] 警告,线程{index}在执行过程中遭遇问题, Traceback:\n\n{tb_str}\n\n"
|
||||
if len(mutable[index][0]) > 0: gpt_say += "此线程失败前收到的回答:\n\n" + mutable[index][0]
|
||||
if retry_op > 0:
|
||||
retry_op -= 1
|
||||
wait = random.randint(5, 20)
|
||||
for i in range(wait):# 也许等待十几秒后,情况会好转
|
||||
mutable[index][2] = f"等待重试 {wait-i}"; time.sleep(1)
|
||||
if "Rate limit reached" in tb_str:
|
||||
wait = wait * 5
|
||||
fail_info = "OpenAI请求速率限制 "
|
||||
else:
|
||||
fail_info = ""
|
||||
# 也许等待十几秒后,情况会好转
|
||||
for i in range(wait):
|
||||
mutable[index][2] = f"{fail_info}等待重试 {wait-i}"; time.sleep(1)
|
||||
# 开始重试
|
||||
mutable[index][2] = f"重试中 {retry_times_at_unknown_error-retry_op}/{retry_times_at_unknown_error}"
|
||||
continue # 返回重试
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user