lewisliuX123 commited on
Commit
b784875
1 Parent(s): 6100a3d

Update bot/chatgpt/chat_gpt_bot.py

Browse files
Files changed (1) hide show
  1. bot/chatgpt/chat_gpt_bot.py +3 -3
bot/chatgpt/chat_gpt_bot.py CHANGED
@@ -12,7 +12,7 @@ user_session = dict()
12
  class ChatGPTBot(Bot):
13
  def __init__(self):
14
  openai.api_key = conf().get('open_ai_api_key')
15
- # openai.api_base="https://api.realgpt.ink/v1"
16
 
17
  def reply(self, query, context=None):
18
  # acquire reply content
@@ -57,7 +57,7 @@ class ChatGPTBot(Bot):
57
  except openai.error.RateLimitError as e:
58
  # rate limit exception
59
  logger.warn(e)
60
- if retry_count < 1:
61
  time.sleep(5)
62
  logger.warn("[OPEN_AI] RateLimit exceed, 第{}次重试".format(retry_count+1))
63
  return self.reply_text(query, user_id, retry_count+1)
@@ -82,7 +82,7 @@ class ChatGPTBot(Bot):
82
  return image_url
83
  except openai.error.RateLimitError as e:
84
  logger.warn(e)
85
- if retry_count < 1:
86
  time.sleep(5)
87
  logger.warn("[OPEN_AI] ImgCreate RateLimit exceed, 第{}次重试".format(retry_count+1))
88
  return self.reply_text(query, retry_count+1)
 
12
  class ChatGPTBot(Bot):
13
  def __init__(self):
14
  openai.api_key = conf().get('open_ai_api_key')
15
+ openai.api_base="https://api.realgpt.ink/v1"
16
 
17
  def reply(self, query, context=None):
18
  # acquire reply content
 
57
  except openai.error.RateLimitError as e:
58
  # rate limit exception
59
  logger.warn(e)
60
+ if retry_count < 3:
61
  time.sleep(5)
62
  logger.warn("[OPEN_AI] RateLimit exceed, 第{}次重试".format(retry_count+1))
63
  return self.reply_text(query, user_id, retry_count+1)
 
82
  return image_url
83
  except openai.error.RateLimitError as e:
84
  logger.warn(e)
85
+ if retry_count < 3:
86
  time.sleep(5)
87
  logger.warn("[OPEN_AI] ImgCreate RateLimit exceed, 第{}次重试".format(retry_count+1))
88
  return self.reply_text(query, retry_count+1)