mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-07-22 06:37:11 +08:00
add dall-e-2 retry_count limit
This commit is contained in:
@@ -187,8 +187,11 @@ class AzureChatGPTBot(ChatGPTBot):
|
|||||||
operation_location = submission.headers['operation-location']
|
operation_location = submission.headers['operation-location']
|
||||||
status = ""
|
status = ""
|
||||||
while (status != "succeeded"):
|
while (status != "succeeded"):
|
||||||
|
if retry_count > 3:
|
||||||
|
return False, "图片生成失败"
|
||||||
response = requests.get(operation_location, headers=headers)
|
response = requests.get(operation_location, headers=headers)
|
||||||
status = response.json()['status']
|
status = response.json()['status']
|
||||||
|
retry_count += 1
|
||||||
image_url = response.json()['result']['data'][0]['url']
|
image_url = response.json()['result']['data'][0]['url']
|
||||||
return True, image_url
|
return True, image_url
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
|||||||
Reference in New Issue
Block a user