Soulter / AstrBot

OneBot、微信、Telegram、QQ 等多平台兼容的支持 LLM 的聊天机器人平台,支持插件。
GNU Affero General Public License v3.0
566 stars 55 forks source link

实现图床来支持在官方 API 下 QQ 群聊发图 #171

Open xinghanxu666 opened 2 weeks ago

xinghanxu666 commented 2 weeks ago

日志为: 2024-07-07 14:17:44 [06:17:44| astrbot-core - INFO|general_utils.py:335]: 保存临时图片: temp/1720333064.jpg 2024-07-07 14:17:44 Traceback (most recent call last): 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 246, in reply_msg 2024-07-07 14:17:44 await self._send_wrapper(data) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 287, in _send_wrapper 2024-07-07 14:17:44 await self.client.api.post_group_message(media=media, kwargs) 2024-07-07 14:17:44 TypeError: BotAPI.post_group_message() got an unexpected keyword argument 'file_image' 2024-07-07 14:17:44 2024-07-07 14:17:44 During handling of the above exception, another exception occurred: 2024-07-07 14:17:44 2024-07-07 14:17:44 Traceback (most recent call last): 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 262, in reply_msg 2024-07-07 14:17:44 await self._send_wrapper(data) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 287, in _send_wrapper 2024-07-07 14:17:44 await self.client.api.post_group_message(media=media, kwargs) 2024-07-07 14:17:44 TypeError: BotAPI.post_group_message() got an unexpected keyword argument 'file_image' 2024-07-07 14:17:44 2024-07-07 14:17:44 During handling of the above exception, another exception occurred: 2024-07-07 14:17:44 2024-07-07 14:17:44 Traceback (most recent call last): 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 267, in reply_msg 2024-07-07 14:17:44 await self._send_wrapper(data) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 287, in _send_wrapper 2024-07-07 14:17:44 await self.client.api.post_group_message(media=media, kwargs) 2024-07-07 14:17:44 TypeError: BotAPI.post_group_message() got an unexpected keyword argument 'file_image' 2024-07-07 14:17:44 2024-07-07 14:17:44 During handling of the above exception, another exception occurred: 2024-07-07 14:17:44 2024-07-07 14:17:44 Traceback (most recent call last): 2024-07-07 14:17:44 File "/usr/local/lib/python3.10/site-packages/botpy/client.py", line 285, in _run_event 2024-07-07 14:17:44 await coro(*args, kwargs) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 36, in on_group_at_message_create 2024-07-07 14:17:44 await self.platform.handle_msg(abm) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 146, in handle_msg 2024-07-07 14:17:44 await self.reply_msg(message, message_result.result_message) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 273, in reply_msg 2024-07-07 14:17:44 await self._send_wrapper(data) 2024-07-07 14:17:44 File "/AstrBot/model/platform/qq_official.py", line 287, in _send_wrapper 2024-07-07 14:17:44 await self.client.api.post_group_message(media=media, **kwargs) 2024-07-07 14:17:44 TypeError: BotAPI.post_group_message() got an unexpected keyword argument 'file_image'

Soulter commented 2 weeks ago

看起来是用官方的 API 在群聊里面发图报错,目前 QQ 提供的针对群聊的 API 貌似只接收图片 url,这说明需要自己先上传图片到图床。后期会做一个上传图片的接口来实现