Skip to content

Commit

Permalink
Merge pull request #1577 from xyshell/patch-1
Browse files Browse the repository at this point in the history
Update chat_gpt_bot.py retry APIConnectionError
  • Loading branch information
zhayujie authored Dec 8, 2023
2 parents 9d4afea + 55df191 commit b9dfdce
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion bot/chatgpt/chat_gpt_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,8 +148,9 @@ def reply_text(self, session: ChatGPTSession, api_key=None, args=None, retry_cou
time.sleep(10)
elif isinstance(e, openai.error.APIConnectionError):
logger.warn("[CHATGPT] APIConnectionError: {}".format(e))
need_retry = False
result["content"] = "我连接不到你的网络"
if need_retry:
time.sleep(5)
else:
logger.exception("[CHATGPT] Exception: {}".format(e))
need_retry = False
Expand Down

0 comments on commit b9dfdce

Please sign in to comment.