yokonsan / midjourney-api Goto Github PK
View Code? Open in Web Editor NEWmidjourney in discord api.
midjourney in discord api.
队列拥堵问题。经常性出现队列拥堵,然后系统提示信息发送成功 但是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
连续多发送几次命令就会出现
No response
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.
今天调用文生图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
)
No response
我用于内部员工使用的 有时候会有多个员工使用,如果被占用了 那另外的员工只能等待完成之后才能使用 这不是很友好,
upscale 接口使用和 imagine 是一样的吗?为什么我调用的时候 discord页面都没有反应,但是 imagine 是没问题的,而且我手动 upscale 的时候生成的图片callback 也是收不到信息的?
callback_url 是你希望接收 midjourney 生成图片进度和结果的服务地址
日志中是有输出图片链接的,确保配置的日志等级 LOG_LEVEL
为 DEBUG
或更低
Originally posted by @yokonsan in #13 (comment)
这里说的日志等级是在哪里配置的?callback_url中接收的信息包格式是怎样的呢?
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.
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
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)]
看报错应该是连接不上,需要什么配置吗?
非常感谢该项目。但是在使用过程中发现无法正常运行的问题。
根据文档设置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。
服务启动后没有报错,请求接口成功
{
"message": "success",
"trigger_id": "111111111",
"trigger_type": "generate"
}
但是收不到callback的回调,discord的频道里也不提示,怎么知道请求是否成功呢
已经按照教程来部署的
No response
你好,想问下,这个session_id我看会变化,这个有没有影响呢,我看代码里面写死了。
图生图的功能中,是否支持多个图片链接?
请问/v1/api/trigger/bot接口是移除了吗,swagger接口里面没有,然后测试也提示找不到接口,使用imagine接口没有触发task_bot.py的内容好像。
是否考虑支持多账户 一个账户的话 多人使用的话 会不够 能不能做个账号池 多账户轮询
违禁词等错误信息的话 可以通过wss获取
https://github.com/erictik/midjourney-api 这个库就有wss的 可以参考一下
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)')]
请教下这个原因是什么那
大佬 我来催你了抓紧把剩下的功能完善一下
图片生成接口无反应无回调,别的接口可以用,请问应该怎么处理?
我配置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)
执行以上代码
python --version
)No response
我按照教程上填写了,用户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.
在我这里每次启动都不行
python --version
)[root@iZt4n7ah8y2rvi0odnvq7lZ midjourney-api]# python --version
Python 3.8.8
No response
想请教一下.env文件中callback_url中填写的内容的是什么?作用是什么?
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上面正常接收到了信息
报错主要有两个原因:1、无法连接discord,telnet discord.com 443,显示无法连接。解决办法:果断换梯子,可以试试https://steampp.net/。2、discord bot配置问题,打开https://discord.com/developers/applications,
,开启:SERVER MEMBERS INTENT 问题完美解决。
{ "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中生成时提示无法识别链接
如果是国内服务器部署的话,会访问 discord.com不通,而又因为项目使用了 discord.py 的 lib,所以大批量替换 host 也不太可能,但是服务器安装代理有点重了,有什么比较好的方法吗?
暂无
python --version
)如描述
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
python --version
)No response
ERROR: No matching distribution found for discord.py==2.2.3 (from -r requirements.txt (line 1))
这个怎么解决呀,求大佬回复~
再启动项目的时候报错了
python --version
)No response
您好,作者,之前调试成功了,discord也收到了绘画指令。但是,昨天重新登录了discord,然后我更新了USER_TOKEN,就出问题了,消息传不过去🐛
我也重新启动了云服务器,试了各种重启,依旧不成功,不知道问题出现在哪儿
python --version
) 3.9.2我不想直接访问 discord的地址,在国内想要使用代理地址访问,可以在env 文件加个 代理地址选项吗
请问该如何解决这个情况
你好,感谢分享!想问下,describe调用了命令,返回了4个描述,选择一个描述去生成图片,我看需要传入prompt,但是机器人这边哪里可以获取到这个prompt呢
variation和rest接口 发送任务成功 状态显示success 但是data返回code:15 消息提示task queue is full:10
重新启动服务就可以了,请问是队列的问题吗
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)
NFO: 64.227.21.251:55514 - "POST /v1/api/trigger/bot HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:52258 - "POST /v1/api/trigger/bot HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:52260 - "POST /v1/api/trigger/bot HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:52262 - "POST /v1/api/trigger/bot HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:52264 - "POST /v1/api/trigger/bot HTTP/1.1" 404 Not Found
我想知道你是否可以添加/blend命令,因为我真的很需要它。
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.