yokonsan / midjourney-api

midjourney in discord api.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

HadXu opened this issue · comments

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

根据文档设置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。

commented

查看 discord 频道 midjourney bot 有触发绘画任务吗,或者有其他输出内容吗

查看 discord 频道 midjourney bot 有触发绘画任务吗,或者有其他输出内容吗

并没有。

如果在discord进行绘图任务倒是能够看到task_bot.py debug的信息。

commented

有设置并发队列大小吗

没有,除了设置4个参数之外并没有设置其他额外参数。目前考虑是不是bot权限的问题,但是也是根据文档来的设置bot的权限
如图所示

image

commented

Bot 页面设置,最下面的 MESSAGE CONTENT INTENT 有勾选上吗

image
已经勾选上。 奇怪。。。

commented

这真的奇怪了,你的 task_bot.py 启动使用的和 server.py 是一个配置吗。
task_bot.py启动的日志登记是DEBUG吗。
或者重新选择 scope,然后重新 oauth2 授权到频道试试呢 😂

My problem. I mixed the channel id and the User id.

thanks.

commented

我也遇到了相同的问题,task_bot.py 启动后输出如下(在discord进行绘图任务倒是能够看到task_bot.py debug的信息):
root@racknerd-02890d:~/midjourney-api# python3 task_bot.py 2023-06-06 15:43:49 INFO discord.client logging in using static token 2023-06-06 15:43:49 INFO discord.gateway Shard ID None has connected to Gateway (Session ID: xxxxxxxxxxxxxxxxxx). 2023-06-06 15:43:51 | SUCCESS | 794970-140686918711104 | "/root/midjourney-api/task/bot/listener.py:22":on_ready - Logged in as knoyo#6902 (ID: 1115642557704184060)
server.py启动后信息如下:
root@racknerd-02890d:~/midjourney-api# python3 server.py INFO: Started server process [795001] INFO: Waiting for application startup. INFO: Application startup complete. INFO: Uvicorn running on http://0.0.0.0:8062 (Press CTRL+C to quit) 2023-06-06 15:43:56 | DEBUG | 795001-139804442888000 | "/root/midjourney-api/util/_queue.py:62":_exec - Task[4001348130] start execution: generate(('https://discord.com/channels/662267976984297473/989739808286974002/1115633974581141636 <#4001348130#>half fish half dragon hybrid, retro screencap --ar 2:3 --niji 5',), {}) INFO: 64.227.21.251:48074 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK 2023-06-06 15:43:56 | DEBUG | 795001-139804442888000 | "/root/midjourney-api/util/fetch.py:47":fetch - Fetch: https://discord.com/api/v9/interactions, {'data': '{"type": 2, "application_id": "936929561302675456", "guild_id": "1115651062666362900", "channel_id": "1115651062666362903", "session_id": "xxxxxxxxxxx", "data": {"version": "1077969938624553050", "id": "938956540159881230", "name": "imagine", "type": 1, "options": [{"type": 3, "name": "prompt", "value": "https://discord.com/channels/662267976984297473/989739808286974002/1115633974581141636 <#4001348130#>half fish half dragon hybrid, retro screencap --ar 2:3 --niji 5"}], "application_command": {"id": "938956540159881230", "application_id": "936929561302675456", "version": "1077969938624553050", "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": []}}'}
已经核对所有权限及配置问题,大佬帮我看看哈
@yokonsan

commented

https://discord.com/channels/662267976984297473/989739808286974002/1115633974581141636

你这 prompt 是不是有问题啊,前面的链接是图片链接吗?

commented

image
{ "prompt": "half fish half dragon hybrid, retro screencap --ar 2:3 --niji 5", "picurl": "" }
这是我post的内容
@yokonsan

commented
2023-06-07 01:48:47 | DEBUG | 1082173-140219800999744 | "/root/midjourney-api/util/_queue.py:62":_exec - Task[3666200930] start execution: generate(('<#3666200930#>half fish half dragon hybrid, retro screencap --ar 2:3 --niji 5',), {})
INFO:     64.227.21.251:58428 - "POST /v1/api/trigger/imagine HTTP/1.1" 200 OK
2023-06-07 01:48:47 | DEBUG | 1082173-140219800999744 | "/root/midjourney-api/util/fetch.py:47":fetch - Fetch: https://discord.com/api/v9/interactions, {'data': '{"type": 2, "application_id": "936929561302675456", "guild_id": "1115651062666362900", "channel_id": "1115651062666362903", "session_id": "xxxxxxxxx", "data": {"version": "1077969938624553050", "id": "938956540159881230", "name": "imagine", "type": 1, "options": [{"type": 3, "name": "prompt", "value": "<#3666200930#>half fish half dragon hybrid, retro screencap --ar 2:3 --niji 5"}], "application_command": {"id": "938956540159881230", "application_id": "936929561302675456", "version": "1077969938624553050", "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": []}}'}

这是server.py启动后信息,task_bot.py没有输出

commented

看下 discord 有触发绘画任务吗
你的 channel_id、user_id 对吗

commented

image
这是我的配置项
@yokonsan

commented

discord 也没有触发绘画任务

commented

discord 也没有触发绘画任务

看你的描述,直接请求 API 没有触发绘画任务,在 Discord 内手动触发绘画任务,task_bot 能监听到。
排除 BOT_TOKEN 配置问题,且 BOT 和 Midjourneyu 的BOT 在一个频道。

需要检查:

  1. 确保频道ID和服务器ID配置对的
  2. 确保 Midjourney 在你配置的频道内
commented

image
1和2都可以确定,没有问题

commented

也尝试过新建服务器,新建频道,新建BOt

commented

discord 也没有触发绘画任务

看你的描述,直接请求 API 没有触发绘画任务,在 Discord 内手动触发绘画任务,task_bot 能监听到。 排除 BOT_TOKEN 配置问题,且 BOT 和 Midjourneyu 的BOT 在一个频道。

需要检查:

  1. 确保频道ID和服务器ID配置对的
  2. 确保 Midjourney 在你配置的频道内

BOT 和 Midjourneyu 的BOT 在一个频道,怎么确认呢?

@Fred3343 Did you solve the issue?