fix: 修复文转图相关问题

This commit is contained in:
Soulter
2024-06-09 08:56:52 -04:00
parent a4e7904953
commit 05071144fb
3 changed files with 8 additions and 7 deletions
+2 -1
View File
@@ -106,7 +106,7 @@ class Command:
if self.command_start_with(message, "update"):
return True, self.update(message, role)
if message == "t2i":
return True, "t2i", self.t2i_toggle(message, role)
return True, self.t2i_toggle(message, role)
if not self.provider and message == "help":
return True, await self.help()
@@ -220,6 +220,7 @@ class Command:
"nick": "设置机器人唤醒词",
"plugin": "插件安装、卸载和重载",
"web on/off": "LLM 网页搜索能力",
"t2i": "启用/关闭文本转图片模式"
}
async def help_messager(self, commands: dict, platform: str, cached_plugins: List[RegisteredPlugin] = None):
+1 -2
View File
@@ -44,7 +44,6 @@ class QQGOCQ(Platform):
self.context = global_object
self.unique_session = cfg['uniqueSessionMode']
self.pic_mode = cfg['qq_pic_mode']
self.client = CQHTTP(
host=self.cc.get("gocq_host", "127.0.0.1"),
@@ -204,7 +203,7 @@ class QQGOCQ(Platform):
res.append(Plain(text=res_str))
# if image mode, put all Plain texts into a new picture.
if self.pic_mode and isinstance(res, list):
if self.cc.get("qq_pic_mode", False) and isinstance(res, list):
plains = []
news = []
for i in res:
+5 -4
View File
@@ -21,6 +21,7 @@ from type.message import *
from typing import Union, List
from nakuru.entities.components import *
from util.image_render.helper import text_to_image_base
from util.cmd_config import CmdConfig
from SparkleLogging.utils.core import LogManager
from logging import Logger
@@ -58,14 +59,14 @@ class QQOfficial(Platform):
asyncio.set_event_loop(self.loop)
self.waiting: dict = {}
self.cc = CmdConfig()
self.cfg = cfg
self.appid = cfg['qqbot']['appid']
self.token = cfg['qqbot']['token']
self.secret = cfg['qqbot_secret']
self.unique_session = cfg['uniqueSessionMode']
qq_group = cfg['qqofficial_enable_group_message']
self.pic_mode = cfg['qq_pic_mode']
if qq_group:
self.intents = botpy.Intents(
@@ -198,7 +199,7 @@ class QQOfficial(Platform):
# if response.status == 200:
# image = PILImage.open(io.BytesIO(await response.read()))
# image_path = gu.save_temp_img(image)
if self.pic_mode:
if self.cc.get("qq_pic_mode", False):
plains = []
news = []
if isinstance(res, str):
@@ -220,7 +221,7 @@ class QQOfficial(Platform):
else:
plain_text = res
if source is not None and image_path == '': # file_image与message_reference不能同时传入
if source and not image_path: # file_image与message_reference不能同时传入
msg_ref = Reference(message_id=source.id,
ignore_get_message_error=False)