Browse Source

Merge pull request #1577 from xyshell/patch-1

Update chat_gpt_bot.py retry APIConnectionError
master
zhayujie GitHub 11 months ago
parent
commit
b9dfdcef3d
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions
  1. +2
    -1
      bot/chatgpt/chat_gpt_bot.py

+ 2
- 1
bot/chatgpt/chat_gpt_bot.py View File

@@ -148,8 +148,9 @@ class ChatGPTBot(Bot, OpenAIImage):
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


Loading…
Cancel
Save