Skip to content

Commit abcbb34

Browse files
committed
fix(chat_gpt_bot.py, open_ai_bot.py): increase retry time to 20 seconds when encountering RateLimitError
1 parent f2e29f3 commit abcbb34

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bot/chatgpt/chat_gpt_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def reply_text(self, session: ChatGPTSession, api_key=None, retry_count=0) -> di
142142
logger.warn("[CHATGPT] RateLimitError: {}".format(e))
143143
result["content"] = "提问太快啦,请休息一下再问我吧"
144144
if need_retry:
145-
time.sleep(5)
145+
time.sleep(20)
146146
elif isinstance(e, openai.error.Timeout):
147147
logger.warn("[CHATGPT] Timeout: {}".format(e))
148148
result["content"] = "我没有收到你的消息"

bot/openai/open_ai_bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def reply_text(self, session: OpenAISession, retry_count=0):
114114
logger.warn("[OPEN_AI] RateLimitError: {}".format(e))
115115
result["content"] = "提问太快啦,请休息一下再问我吧"
116116
if need_retry:
117-
time.sleep(5)
117+
time.sleep(20)
118118
elif isinstance(e, openai.error.Timeout):
119119
logger.warn("[OPEN_AI] Timeout: {}".format(e))
120120
result["content"] = "我没有收到你的消息"

0 commit comments

Comments
 (0)