瀏覽代碼

add dall-e-2 retry_count limit

master
unknown 8 月之前
父節點
當前提交
22c7f8fe9e
共有 1 個檔案被更改,包括 3 行新增0 行删除
  1. +3
    -0
      bot/chatgpt/chat_gpt_bot.py

+ 3
- 0
bot/chatgpt/chat_gpt_bot.py 查看文件

@@ -187,8 +187,11 @@ class AzureChatGPTBot(ChatGPTBot):
operation_location = submission.headers['operation-location']
status = ""
while (status != "succeeded"):
if retry_count > 3:
return False, "图片生成失败"
response = requests.get(operation_location, headers=headers)
status = response.json()['status']
retry_count += 1
image_url = response.json()['result']['data'][0]['url']
return True, image_url
except Exception as e:


Loading…
取消
儲存