lcjqyml/wechatbot

[BUG] 无法发送图片

Sevenyine opened this issue · 7 comments

提交 issue 前,请先确认:

  • 我已看过 FAQ,此问题不在列表中
  • 我已看过其他 issue,他们不能解决我的问题
  • 我认为这不是 Mirai 或者 OpenAI 的 BUG

表现
当wechatbot和chatgpt运行不在一个服务器上时图片无法正常发送

运行环境:

  • 操作系统:Ubuntu 20.04
  • Docker:
    微信服务器端docker版本:
root@iZj6c38nbfy7ormrcal544Z:~# docker version
Client:
 Version:           20.10.12
 API version:       1.41
 Go version:        go1.16.2
 Git commit:        20.10.12-0ubuntu2~20.04.1
 Built:             Wed Apr  6 02:14:38 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server:
 Engine:
  Version:          20.10.12
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.2
  Git commit:       20.10.12-0ubuntu2~20.04.1
  Built:            Thu Feb 10 15:03:35 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.5.9-0ubuntu1~20.04.4
  GitCommit:        
 runc:
  Version:          1.1.0-0ubuntu1~20.04.1
  GitCommit:        
 docker-init:
  Version:          0.19.0
  GitCommit:  

chatgpt端docker版本:

root@VM-4-8-ubuntu:~/chatgpt-qq# docker version
Client: Docker Engine - Community
 Version:           23.0.3
 API version:       1.42
 Go version:        go1.19.7
 Git commit:        3e7cbfd
 Built:             Tue Apr  4 22:06:10 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.3
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.7
  Git commit:       59118bf
  Built:            Tue Apr  4 22:06:10 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.20
  GitCommit:        2806fc1057397dbaeefbea0e4e17bddfbd388f38
 runc:
  Version:          1.1.5
  GitCommit:        v1.1.5-0-gf19387a
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
  • 项目版本:
    wechatbot
root@iZj6c38nbfy7ormrcal544Z:~# docker image ls
REPOSITORY           TAG       IMAGE ID       CREATED         SIZE
lcjqyml/wechatbot    latest    680cfddd4d7c   2 days ago      1.32GB

chatgpt

root@VM-4-8-ubuntu:~# docker image ls
REPOSITORY                    TAG               IMAGE ID       CREATED        SIZE
lss233/chatgpt-mirai-qq-bot   browser-version   89ff487fa491   33 hours ago   991MB

复现步骤
描述你是如何触发这个 BUG 的
config.cfg中配置了以下内容:

[text_to_image]
# 文字转图片
# 是否强制开启,设置后所有的消息强制以图片发送,减小风控概率  
always = true

然后登陆微信,尝试触发,出现无法发送图片bug
预期行为
正常发送返回内容图片
截图
chatgpt端日志:

chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.331 | INFO     | platforms.http_service:construct_bot_request:174 - Get message from friend-[]:
chatgpt-qq-chatgpt-1     | 1
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.332 | DEBUG    | platforms.http_service:process_request:101 - Start to process bot request 1683730479332.
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.332 | DEBUG    | middlewares.concurrentlock:handle_request:25 - [Concurrent] 使用 Adapter 内部的 Queue
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.332 | DEBUG    | middlewares.concurrentlock:handle_request:27 - [Concurrent] 排队中,前面还有 0 个人!
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.332 | DEBUG    | middlewares.concurrentlock:handle_request:40 - [Concurrent] 排队中,前面还有 0 个人!
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.333 | DEBUG    | middlewares.concurrentlock:handle_request:42 - [Concurrent] 排到了!
chatgpt-qq-chatgpt-1     | INFO:quart.serving:ip:37788 POST /v2/chat 1.1 200 13 2726
chatgpt-qq-chatgpt-1     | [2023-05-10 14:54:39,334] ip:37788 POST /v2/chat 1.1 200 13 2726
chatgpt-qq-chatgpt-1     | [2023-05-10 14:54:39,334] ip:37788 POST /v2/chat 1.1 200 13 2726
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:39.334 | DEBUG    | middlewares.timeout:create_timeout_task:55 - [Timeout] 开始计时……
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:41.646 | DEBUG    | platforms.http_service:v2_chat_response:151 - Bot request 1683730479332 response -> 
chatgpt-qq-chatgpt-1     | {"result": "SUCCESS", "message": [], "voice": [], "image": []}
chatgpt-qq-chatgpt-1     | INFO:quart.serving:ip:37796 GET /v2/chat/response 1.1 200 62 1441
chatgpt-qq-chatgpt-1     | [2023-05-10 14:54:41,647] ip:37796 GET /v2/chat/response 1.1 200 62 1441
chatgpt-qq-chatgpt-1     | [2023-05-10 14:54:41,647] ip:37796 GET /v2/chat/response 1.1 200 62 1441
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:42.295 | DEBUG    | adapter.chatgpt.web:ask:97 - [ChatGPT-Web] 59788fc0-bf33-4954-af27-1f6b4e565430 - I'm sorry, but I still don't understand what you're looking for. Can you please provide more information or ask a specific question? I'm here to help.
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:42.701 | DEBUG    | platforms.onebot_bot:_:178 - 丢弃群聊消息:真的难受啊(原因:不符合触发前缀)
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:43.198 | DEBUG    | middlewares.timeout:handle_respond:46 - [Timeout] 取消计时……
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:43.198 | INFO     | platforms.http_service:response:86 - Got response msg -> <class 'graia.ariadne.message.chain.MessageChain'> -> [图片]
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:43.204 | DEBUG    | middlewares.timeout:create_timeout_task:55 - [Timeout] 开始计时……
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:43.205 | DEBUG    | platforms.http_service:process_request:115 - Bot request 1683730479332 done.
chatgpt-qq-chatgpt-1     | 2023-05-10 14:54:43.647 | DEBUG    | platforms.http_service:v2_chat_response:151 - Bot request 1683730479332 response -> 
chatgpt-qq-chatgpt-1     | {"result": "DONE", "message": [], "voice": [], "image": ["data:image/png;base64,iVBORw0KGgoAAAANSUhE
chatgpt-qq-chatgpt-1     | INFO:quart.serving:ip:37800 GET /v2/chat/response 1.1 200 69887 2025
chatgpt-qq-chatgpt-1     | QStandardPaths: XDG_RUNTIME_DIR not set, defaulting to '/tmp/runtime-root'
chatgpt-qq-chatgpt-1     | Loading page (1/2)
Rendering (2/2)                                                                         ] 0%
Done                                                                                    ] 0%
chatgpt-qq-chatgpt-1     | [2023-05-10 14:54:43,649] ip:37800 GET /v2/chat/response 1.1 200 69887 2025
chatgpt-qq-chatgpt-1     | [2023-05-10 14:54:43,649] ip:37800 GET /v2/chat/response 1.1 200 69887 2025

wechatbot端日志:

[5/10/2023, 2:54:39 PM] 🎯 ChatGPT triggered: /cchat 1
[5/10/2023, 2:54:39 PM] 🎯 Chatbot triggered: http://(ip):(port)/v2/chat
[5/10/2023, 2:54:39 PM] 🎯 Got request id: 1683730479332
[5/10/2023, 2:54:41 PM] 🎯 Wait response: http://(ip):(port)/v2/chat/response?request_id=1683730479332
[5/10/2023, 2:54:41 PM] 🎯 Got response data data length 55 -> {"result":"SUCCESS","message":[],"voice":[],"image":[]}
[5/10/2023, 2:54:43 PM] 🎯 Wait response: http://(ip):(port)/v2/chat/response?request_id=1683730479332
[5/10/2023, 2:54:44 PM] 🎯 Got response data data length 69880 -> {"result":"DONE","message":[],"voice":[],"image":["data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABRQ
[5/10/2023, 2:54:44 PM] Reply image.png -> data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABRQA
uncaughtException AssertionError [ERR_ASSERTION]: 1204 == 0
    at Object.equal (/app/node_modules/wechat4u/src/util/global.js:53:14)
    at /app/node_modules/wechat4u/src/core.js:694:16
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async PuppetWechat4u.messageSendFile (file:///app/node_modules/wechaty-puppet-wechat4u/src/puppet-wechat4u.ts:800:5)
    at async file:///app/node_modules/wechaty/src/sayable/deliver-sayable.ts:41:13
    at async WechatifiedUserClass.say (file:///app/node_modules/wechaty/src/user-modules/contact.ts:338:19)
    at async ChatBot.replyImage (file:///app/src/chatbot.ts:241:7)
    at async ChatBot.reply (file:///app/src/chatbot.ts:261:9)
    at async file:///app/src/chatbot.ts:272:7 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 1204,
  expected: 0,
  operator: '==',
  response: [Object],
  tips: '发送图片失败'
}

其他内容
此处填写其他内容,没有可跳过

补充下,发现我把config.cfg里的text-to-image全注释后,报错变成了 发送文本信息失败(好像是)
我的qq端是能够正常发信息和图片的
我使用的chatgpt端同时挂了微信和qq,和这个会有关系吗

我一直也是微信qq同时用着没问题。你这异常感觉是微信端被风控了。

我一直也是微信qq同时用着没问题。你这异常感觉是微信端被风控了。

嘶 可能是,,我为了登陆微信还改绑了个手机,那看来是得等着解封了(._.)

如果发送不了图片可以登录微信网页版测试下能不能发送

我直接网页版本都登录不上了,但是服务器还可以i,但是发不了图片了

唉 要是支持pc微信hook就好了,或者是支持padlocal ipad协议的wecahty就好了 不容易被风控。
pc微信hook 参考 https://github.com/JustUndertaker/ComWeChatBotClient
支持onebotv12协议,可是ls233的项目只支持v11协议的。唉

我的账号似乎不支持微信网页版。而且这个登陆是用的微信桌面版不是网页版