Coder Social home page Coder Social logo

midjourney-api's Introduction

midjourney-api

基于 Discord 的 Midjourney API。

添加 Midjourney 违禁词入口 issue

项目集成 Demo 参考:issue31

UML

sequenceDiagram
    participant ThirdServer
    participant APIServer
    participant DiscordAPI

    ThirdServer->>APIServer: 请求接口触发任务
    APIServer->>APIServer: 放入任务队列
    APIServer->>DiscordAPI: 调接口触发绘画任务
    APIServer-->>ThirdServer: 返回是否触发成功

    DiscordAPI->>DiscordAPI: 触发Midjourney bot绘画任务
    DiscordAPI->>DiscordAPI: 监听MidJourney bot消息
    DiscordAPI-->>ThirdServer: 返回监听实时消息
    DiscordAPI-->>APIServer: 清除队列任务

使用条件

  1. 确保程序启动环境能访问 Discord
  2. 已有 Midjourney、Discord 账户
  3. 创建 Discord 频道并添加机器人,参考教程 Midjourney|如何集成到自己的平台

安装启动

git clone
pip install -r requirements.txt

将文件.env.template重命名为.env,并填入参数值:

USER_TOKEN=用户token
BOT_TOKEN=机器人token
GUILD_ID=服务器ID
CHANNEL_ID=频道ID
CALLBACK_URL=回调地址,默认http post请求,用于接收 midjourney 作图进度和结果的服务

直接启动

# 启动监听机器人
python task_bot.py
# 启动http服务
python server.py

更新

git pull

# 启动监听机器人
python task_bot.py
# 启动http服务
python server.py

docker 启动

填写 start.sh-e 后的环境变量,直接启动:

sh start.sh

或者本地构建镜像:

# 构建镜像
sh build.sh
# 启动容器
sh start.sh

更新

docker rmi kunyu/midjourney-api:1.0
sh start.sh

接口swagger文档:http://127.0.0.1:8062/docs

midjourney-api 提供接口:

  • /v1/api/trigger/imagine:触发绘画任务(图生图,Prompt 前加上图片链接即可)
  • /v1/api/trigger/upscale:U
  • /v1/api/trigger/variation:V
  • /v1/api/trigger/solo_variation:Make Variations
  • /v1/api/trigger/solo_low_variation:Vary(Subtle)
  • /v1/api/trigger/solo_high_variation:Vary(Strong)
  • /v1/api/trigger/zoomout:Zoom Out 2x/1.5x
  • /v1/api/trigger/expand:⬅️ ➡️ ⬆️ ⬇️
  • /v1/api/trigger/reset:重绘
  • /v1/api/trigger/upload:上传图片
  • /v1/api/trigger/describe:通过上传图片名,生成 Prompt
  • /v1/api/trigger/message:发送图片消息,返回图片链接,用于图生图功能

使用

imagine

文生图

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/imagine' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "a cute cat"
}'

图生图,需带上图片 URL

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/imagine' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "prompt": "a cute cat",
  "picurl": "https://xxxxxx/xxxxxxxxxxxx.jpg"
}'

upscale

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/upscale' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "index": 1,
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "trigger_id": "xxxxxxxxxx"
}'
  • index: 图片索引,取值:1、2、3、4
  • msg_id: imagine 绘画完成后回调报文 id 字段
  • msg_hash: imagine 绘画完成后回调报文 attachments[0].filename.split("_")[-1].split(".").[0]
  • trigger_id: imagine 绘画完成后回调报文 trigger_id 字段

variation

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/variation' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "index": 2,
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "trigger_id": "xxxxxxxxxx"
}'

solo_variation

upscale 的单张图片进行 "Make Variations" 操作

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/solo_variation' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "index": 1,
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "trigger_id": "xxxxxxxxxx"
}'
  • index: 图片索引,此处无用,取值:1
  • msg_id: upscale 绘画完成后回调报文 id 字段
  • msg_hash: upscale 绘画完成后回调报文 attachments[0].filename.split("_")[-1].split(".").[0]
  • trigger_id: upscale 绘画完成后回调报文 trigger_id 字段

solo_low_variation

upscale 的单张图片进行 "Vary(Subtle)" 操作

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/solo_low_variation' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "index": 1,
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "trigger_id": "xxxxxxxxxx"
}'
  • index: 图片索引,此处无用,取值:1
  • msg_id: upscale 绘画完成后回调报文 id 字段
  • msg_hash: upscale 绘画完成后回调报文 attachments[0].filename.split("_")[-1].split(".").[0]
  • trigger_id: upscale 绘画完成后回调报文 trigger_id 字段

solo_high_variation

upscale 的单张图片进行 "Vary(Strong)" 操作

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/solo_high_variation' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "index": 1,
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "trigger_id": "xxxxxxxxxx"
}'
  • index: 图片索引,此处无用,取值:1
  • msg_id: upscale 绘画完成后回调报文 id 字段
  • msg_hash: upscale 绘画完成后回调报文 attachments[0].filename.split("_")[-1].split(".").[0]
  • trigger_id: upscale 绘画完成后回调报文 trigger_id 字段

zoomout

upscale 的单张图片进行 Zoom Out 2x/1.5x 操作

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/zoomout' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "zoomout": 50
  "trigger_id": "xxxxxxxxxx"
}'
  • zoomout: 图片扩大(Outpaint)系数,2x -> 50、1.5x -> 75

expand

upscale 的单张图片进行某方向的扩展操作

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/expand' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "direction": "up"
  "trigger_id": "xxxxxxxxxx"
}'
  • direction: 图片扩大方向,取值:left/right/up/down

reset

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/reset' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "msg_id": "xxxxxxxxxx",
  "msg_hash": "xxxxx-xxx-xxxx-xxxx-xxxxxx",
  "trigger_id": "xxxxxxxxxx"
}'

describe

  1. 先上传图片
curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/upload' \
  -H 'accept: application/json' \
  -H 'Content-Type: multipart/form-data' \
  -F '[email protected];type=image/jpeg'
  1. 根据返回的图片文件名,调用 describe
curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/describe' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "upload_filename": "b56ca21a-5fbe-40b4-89ab-6e0aa732f561/9231228408.jpg",
  "trigger_id": "9231228408"
}'
  • trigger_id 先用 upload 返回的 trigger_id
  • upload_filename upload 返回的文件名

message

describe 一样,先 /v1/api/trigger/upload 上传图片,然后根据返回文件名,发送消息:

curl -X 'POST' \
  'http://127.0.0.1:8062/v1/api/trigger/message' \
  -H 'accept: application/json' \
  -H 'Content-Type: application/json' \
  -d '{
  "upload_filename": "560a1e26-36a2-4d5f-a48d-9dd877642b51/7185811546.jpg"
}'

发送图片后,会返回图片链接。 该链接用于以图生图中,拼接 Prompt 形如 图片URL Prompt,调用 /v1/api/trigger/imagine

功能

  • imagine
  • upscale
  • variation
  • solo_variation
  • solo_low_variation
  • solo_high_variation
  • zoomout
  • expand
  • reset
  • describe
  • 图生图(获取到上传图片的链接)
  • 敏感词过滤上报
  • 任务队列(内存存储,不希望引入外建,可加入异常落盘)
  • tests

enjoy it

midjourney-api's People

Contributors

yokonsan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

midjourney-api's Issues

代理地址在哪里加?

我不想直接访问 discord的地址,在国内想要使用代理地址访问,可以在env 文件加个 代理地址选项吗

🐛 队列拥挤超过10几条以后,服务终端,mid不再收到指令

问题简述

队列拥堵问题。经常性出现队列拥堵,然后系统提示信息发送成功 但是mid上面没有收到指令的问题。然后中断服务,重启sever。就会恢复正常

INFO: 192.155.90.118:34938 - "GET / HTTP/1.1" 404 Not Found
INFO: 58.251.35.143:40262 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:40390 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:41582 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:43030 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:45126 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:45314 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:45340 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:45898 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:48920 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:51610 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:52288 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:52626 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
INFO: 58.251.35.143:52644 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK

复现方式

连续多发送几次命令就会出现

环境信息

  • OS: windows server 2019
  • Python: python 3.10
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

回调地址接收不到返回信息和触发不了机器人的问题

问题简述

开始正常的跑着,然后不知道是手动在频道那里发送命令,还是因为测试的时候发送了禁用词,看到在频道那里有提示,然后再跑一段时间,回调地址就没有接收到消息了,此时/v1/api/trigger/imagine是有返回tid的,但是一直没触发机器人绘画任务。
image
image
image

复现方式

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

callback_url的内容

想请教一下.env文件中callback_url中填写的内容的是什么?作用是什么?

再安装依赖的时候报错了🐛

问题简述

ERROR: No matching distribution found for discord.py==2.2.3 (from -r requirements.txt (line 1))
这个怎么解决呀,求大佬回复~

复现方式

再启动项目的时候报错了

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息
    ubuntu 18

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

关于图生图的使用上传接口返回的链接无法使用

{ "message": "success", "upload_filename": "d8ae0b4a-0b8d-4a9a-8b55-e0033d294912/1125718076.jpg", "upload_url": "https://discord-attachments-uploads-prd.storage.googleapis.com/d8ae0b4a-0b8d-4a9a-8b55-e0033d294912/1125718076.jpg?upload_id=ADPycdu34ksNqZLXYt8QnkXS35_tgHsPUvmWKbS9UvUMfi11Ikz1y0hfkQ_IWnrfIz5UXbrvonwTPw9qZvO21WlMnERdMZ_4HBp4", "trigger_id": "1125718076" }
通过upload上传图片后处理其中所返回图片url再使用imagine生成时无法生成,并且将url复制到discord中生成时提示无法识别链接
image

关于task_bot并没有监听到信息的问题?

非常感谢该项目。但是在使用过程中发现无法正常运行的问题。

根据文档设置4个参数,我将callback-url注释掉了。

python task_bot.py
2023-06-04 08:31:52 INFO     discord.client logging in using static token
2023-06-04 08:31:54 INFO     discord.gateway Shard ID None has connected to Gateway (Session ID: xxxxxxxxxx).
2023-06-04 08:31:56 | SUCCESS | 35494-4302947712 | "/Users/xxx/Developer/midjourney-api/task/bot/listener.py:22":on_ready - Logged in as mj-listener#4471 (ID: xxxxx)

另起一个终端

python server.py

NFO:     Started server process [35938]
INFO:     Waiting for application startup.
INFO:     Application startup complete.
INFO:     Uvicorn running on http://0.0.0.0:8062 (Press CTRL+C to quit)

再另起一个终端发送请求

curl -X 'POST' 'http://127.0.0.1:8062/v1/api/trigger/imagine' -H 'accept: application/json' -H 'Content-Type: application/json' -d '{"prompt": "a cute cat"}'

发现task_bot.py并没有log输出,而server.py端的输出

INFO:     127.0.0.1:50241 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
2023-06-04 08:39:36 | DEBUG | 35938-4339844480 | "/Users/xx/Developer/midjourney-api/util/fetch.py:47":fetch - Fetch: https://discord.com/api/v9/interactions, {'data': '{"type": 2, "application_id": "xxx", "guild_id": "xxx", "channel_id": "xxx", "session_id": "xxx", "data": {"version": "xx", "id": "xx", "name": "imagine", "type": 1, "options": [{"type": 3, "name": "prompt", "value": "<#7219825264#>a cute cat"}], "application_command": {"id": "xx", "application_id": "xx", "version": "xx", "default_permission": true, "default_member_permissions": null, "type": 1, "nsfw": false, "name": "imagine", "description": "Create images with Midjourney", "dm_permission": true, "options": [{"type": 3, "name": "prompt", "description": "The prompt to imagine", "required": true}]}, "attachments": []}}'}

如何排查,thanks。

服务器执行python3 task_bot.py 时报异常了,参数都是按步骤操作填入的

Midjourney API拉下来后,按照步骤填入各种参数,但是启动时报错了。这个是啥原因?
错误信息:discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

關於 imagine 的 value <# trigger_id #> 影響 圖生圖

因為 imagine 的 prompt 在 prompt_handler() 當中被處理成
前頭會加上 <# trigger_id #>
導致 圖生圖的時候 midjourney 不能完整的判斷這個指令是圖生圖
以下是無法判斷的圖
截圖 2023-06-05 下午4 27 50

這個是正常的判斷
截圖 2023-06-05 下午4 27 54

如果自行拿掉 <# trigger_id #> 會造成什麼問題嗎?
目前測試 -> 一個人使用上並沒有什麼太大的問題
怕是不是有牽扯到列隊 callback 之類的判斷

另外感謝大神開源這個專案, 獻上 12 萬分敬意

🐛 发送指令都是成功的,就是收不到回调消息,另外发送了指令之后 discord 频道中会不会出现消息喃,我一直没有看到出现

问题简述

🐛 发送指令都是成功的,就是收不到回调消息,另外发送了指令之后 discord 频道中会不会出现消息喃,我一直没有看到出现

复现方式

必现

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

🐛 服务启动后,调用接口,无任何数据返回

问题简述

服务启动后没有报错,请求接口成功
{
"message": "success",
"trigger_id": "111111111",
"trigger_type": "generate"
}

但是收不到callback的回调,discord的频道里也不提示,怎么知道请求是否成功呢

复现方式

已经按照教程来部署的

环境信息

  • OS: MacBook m2
  • Python: Python 3.10.9
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

🐛

问题简述

我按照教程上填写了,用户token,bot token,服务器id,频道ID,也安装好了环境,启动后日志报没有权限;

备注:我没有设置回调地址。

报错信息:
[root@iZt4n7ah8y2rvi0odnvq7lZ midjourney-api]# python task_bot.py
2023-06-16 13:40:20 INFO discord.client logging in using static token
Traceback (most recent call last):
File "task_bot.py", line 13, in
bot.run(BOT_TOKEN)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/discord/client.py", line 860, in run
asyncio.run(runner())
File "/root/.pyenv/versions/3.8.8/lib/python3.8/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
return future.result()
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/discord/client.py", line 849, in runner
await self.start(token, reconnect=reconnect)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/discord/client.py", line 778, in start
await self.connect(reconnect=reconnect)
File "/root/.pyenv/versions/3.8.8/lib/python3.8/site-packages/discord/client.py", line 704, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

复现方式

在我这里每次启动都不行

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息
    [root@iZt4n7ah8y2rvi0odnvq7lZ midjourney-api]# lsb_release -a
    LSB Version: :core-4.1-amd64:core-4.1-noarch
    Distributor ID: CentOS
    Description: CentOS Linux release 8.5.2111
    Release: 8.5.2111
    Codename: n/a

[root@iZt4n7ah8y2rvi0odnvq7lZ midjourney-api]# python --version
Python 3.8.8

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

关于describe的问题

你好,感谢分享!想问下,describe调用了命令,返回了4个描述,选择一个描述去生成图片,我看需要传入prompt,但是机器人这边哪里可以获取到这个prompt呢

🐛 回调地址怎么使用,有没有并发请求的限制

问题简述

不是很明白回调地址的作用,另外怎么获取MJ生成的图片呢

复现方式

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

🐛 请问国内部署的话使用方法呢?docker 机器上装个代理吗?

问题简述

如果是国内服务器部署的话,会访问 discord.com不通,而又因为项目使用了 discord.py 的 lib,所以大批量替换 host 也不太可能,但是服务器安装代理有点重了,有什么比较好的方法吗?

复现方式

暂无

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

如描述

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

在阿里云服务器启动时,提示SSL错误

aiohttp.client_exceptions.ClientConnectorCertificateError: Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate

关于session_id的问题

你好,想问下,这个session_id我看会变化,这个有没有影响呢,我看代码里面写死了。

/v1/api/trigger/bot报错

请问/v1/api/trigger/bot接口是移除了吗,swagger接口里面没有,然后测试也提示找不到接口,使用imagine接口没有触发task_bot.py的内容好像。

/image调用一直失败

ct_n_times - 请求失败(ClientConnectorCertificateError),正在重试,剩余 0 次, Cannot connect to host discord.com:443 ssl:True [SSLCertVerificationError: (1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1002)')]

请教下这个原因是什么那

重新登录了discord,也更新了user token,但消息传不过去了

问题简述

您好,作者,之前调试成功了,discord也收到了绘画指令。但是,昨天重新登录了discord,然后我更新了USER_TOKEN,就出问题了,消息传不过去🐛

复现方式

我也重新启动了云服务器,试了各种重启,依旧不成功,不知道问题出现在哪儿

环境信息

  • OS: 操作系统类型及其版本号: debian
  • Python: Python 版本号 (python --version) 3.9.2
  • Others: 其它信息

额外信息

image

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

机器人启动报错

raise client_error(req.connection_key, exc) from exc
aiohttp.client_exceptions.ClientConnectorError: Cannot connect to host discord.com:443 ssl:default [Connect call failed ('31.13.88.169', 443)]

看报错应该是连接不上,需要什么配置吗?

今天开始被拦截了

Action needed to continue
Sorry! Our AI moderators feel your prompt might be against our community standards.

If you think this is a mistake, please press the "Appeal" button below and we will send it to a more sophisticated AI to double-check the result.
/imagine <#11e9cf60b8#>gril

image

🐛 调用u 命令不生效

问题简述

image
image

discord那边没有发送消息,我的参数不对吗?

复现方式

image

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

引入队列后代码报错,换了台服务器环境还是一样

Traceback (most recent call last):
File "server.py", line 4, in
api_app = server.init_app()
File "/home/civi/midjourney-api/app/server.py", line 12, in init_app
register_blueprints(_app)
File "/home/civi/midjourney-api/app/server.py", line 41, in register_blueprints
from app import routers
File "/home/civi/midjourney-api/app/routers.py", line 5, in
from util._queue import taskqueue
File "/home/civi/midjourney-api/util/_queue.py", line 4, in
from typing import ParamSpec, Callable, Any, Dict, List, Deque
ImportError: cannot import name 'ParamSpec' from 'typing' (/usr/lib/python3.8/typing.py)

upscale调用的时候 midjouney 没有反应

upscale 接口使用和 imagine 是一样的吗?为什么我调用的时候 discord页面都没有反应,但是 imagine 是没问题的,而且我手动 upscale 的时候生成的图片callback 也是收不到信息的?

🐛 INTERACTION_APPLICATION_COMMAND_INVALID_VERSION错误怎么解

问题简述

今天调用文生图Api的时候,突然不行了,返回400错误。把错误信息详细看了一下:
{"code": 50035, "errors": {"data": {"_errors": [{"code": "INTERACTION_APPLICATION_COMMAND_INVALID_VERSION", "message": "\u8be5\u6743\u9650\u5df2\u8fc7\u65f6\uff0c\u8bf7\u7a0d\u5019\u51e0\u5206\u949f\u518d\u8bd5"}]}}, "message": "Invalid Form Body"}

是因为"该权限已过时,请稍候几分钟再试",是啥子原因?

复现方式

突然出现

环境信息

ubuntu- Python: Python 版本号 (python --version)

  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

🐛 When you re-select variants on an already generated image, it does not send progress updates to callback_url

问题简述

When you re-select variants on an already generated image, it does not send progress updates to callback_url

复现方式

At the first imagine, it sends updates to callback_url, But if you select the variants of the same image again, it sends only the finished result without intermediate updates with progress

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

DEMO

我的 Midjourney 到 6 月 10 日到期,还剩几天给大伙免费用。

我和一前端朋友空余时间写的,bug 应该挺多,大伙凑活着用😂。

微信交流群,使用方法在群公告(咨询本仓库相关问题,请别加群、咨询本仓库相关问题,请别加群、咨询本仓库相关问题,请别加群):

image

提示队列已满

variation和rest接口 发送任务成功 状态显示success 但是data返回code:15 消息提示task queue is full:10

一直提示超出最大重试次数

discord.client: Ignoring exception in on_message
Traceback (most recent call last):
File "C:\ProgramData\miniconda3\lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "C:\Users\Administrator\midjourney-api\task\bot\listener.py", line 47, in on_message
await callback_trigger(trigger_id, trigger_status, message)
File "C:\Users\Administrator\midjourney-api\task\bot\handler.py", line 38, in callback_trigger
await callback(CallbackData(
File "C:\Users\Administrator\midjourney-api\lib\api\callback.py", line 20, in callback
await fetch(session, CALLBACK_URL, json=data)
File "C:\Users\Administrator\midjourney-api\util\fetch.py", line 30, in connect_n_times
raise MaxRetryError("超出最大重试次数")
exceptions.MaxRetryError: 超出最大重试次数
discord上面正常接收到了信息

更新程序后,discord接收不到信息🐛

问题简述

更新程序以后,本地发送指令,discord无反应。本地sever和监视机器人均没有报错

复现方式

反复重启无效。服务正常。回调接口也是正常.网络是正常的。可以访问discord 。机器人也是正常的。未发现重复问题

环境信息

  • OS: windows server 2019
  • Python: 3.09
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

🐛 callback api接口有没有示例

问题简述

我配置CALLBACK_URL=http://127.0.0.1:8000/callback,它没有被调用
from fastapi import FastAPI
from typing import List, TypedDict

app = FastAPI()

class Attachment(TypedDict):
id: int
url: str
proxy_url: str
filename: str
content_type: str
width: int
height: int
size: int
ephemeral: bool

class EmbedsImage(TypedDict):
url: str
proxy_url: str

class Embed(TypedDict):
type: str
description: str
image: EmbedsImage

class CallbackData(TypedDict):
type: str
id: int
content: str
attachments: List[Attachment]
embeds: List[Embed]
trigger_id: str

@app.post("/callback")
async def callback(callback_data: CallbackData):
# 在这里可以访问解析后的参数
# callback_data.type
# callback_data.id
# callback_data.content
# callback_data.attachments
# callback_data.embeds
# callback_data.trigger_id

# 在这里进行处理和逻辑操作

return {"message": "Callback received"}

if name == "main":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)

复现方式

执行以上代码

环境信息

  • OS: 操作系统类型及其版本号
  • Python: Python 版本号 (python --version)
  • Others: 其它信息

额外信息

No response

一点点的自我检查

  • 充分阅读 README.md,特别是与本 issue 相关的部分
  • 如果是网络问题,已经检查网络连接、设置是否正常,并经过充分测试认为这是项目本身的问题
  • 本 issue 在 issues 中并没有重复问题

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.