Compare commits

...

3 Commits

Author SHA1 Message Date
lanvent 3001ba9266 fix: azure dalle generate image 2023-04-28 11:06:17 +08:00
lanvent b0a401a1ed fix(azure_dalle): use openai.api_base 2023-04-28 10:53:30 +08:00
Jianglang 6b4dc37428 Update README.md 2023-04-28 01:24:26 +08:00
2 changed files with 4 additions and 5 deletions
+2 -3
View File
@@ -158,9 +158,8 @@ class AzureChatGPTBot(ChatGPTBot):
self.args["deployment_id"] = conf().get("azure_deployment_id")
def create_img(self, query, retry_count=0, api_key=None):
api_base = "https://a-wxf.openai.azure.com/"
api_version = "2022-08-03-preview"
url = "{}dalle/text-to-image?api-version={}".format(api_base, api_version)
url = "{}dalle/text-to-image?api-version={}".format(openai.api_base, api_version)
api_key = api_key or openai.api_key
headers = {"api-key": api_key, "Content-Type": "application/json"}
try:
@@ -175,7 +174,7 @@ class AzureChatGPTBot(ChatGPTBot):
time.sleep(int(retry_after))
response = requests.get(operation_location, headers=headers)
status = response.json()["status"]
image_url = response.json()["result"]["contentUrl"]
image_url = response.json()["result"]["contentUrl"]
return True, image_url
except Exception as e:
logger.error("create image error: {}".format(e))
+2 -2
View File
@@ -74,7 +74,7 @@ Error code: 60020, message: "not allow to access from your ip, ...from ip: xx.xx
### Railway部署方式
公众号不能在`Railway`上部署,但企业微信应用可以!
公众号不能在`Railway`上部署,但企业微信应用[可以](https://railway.app/template/-FHS--?referralCode=RC3znh)!
[![Deploy on Railway](https://railway.app/button.svg)](https://railway.app/template/-FHS--?referralCode=RC3znh)
@@ -84,4 +84,4 @@ Error code: 60020, message: "not allow to access from your ip, ...from ip: xx.xx
AIGC开放社区中已经部署了多个可免费使用的Bot,扫描下方的二维码会自动邀请你来体验。
<img width="200" src="../../docs/images/aigcopen.png">
<img width="200" src="../../docs/images/aigcopen.png">