From 92ac20aaf5331fbf4fa00821147f936fc55062e7 Mon Sep 17 00:00:00 2001 From: tcmofashi Date: Thu, 17 Apr 2025 10:48:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=B8=BA=E5=BD=93=E5=89=8D=E5=9B=9E?= =?UTF-8?q?=E5=A4=8D=E6=B7=BB=E5=8A=A0format=5Faccept=E7=9A=84=E7=BA=A6?= =?UTF-8?q?=E6=9D=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/plugins/chat/message.py | 26 +++++++++++-------- .../think_flow_chat/think_flow_chat.py | 26 +++++++++++-------- 2 files changed, 30 insertions(+), 22 deletions(-) diff --git a/src/plugins/chat/message.py b/src/plugins/chat/message.py index 6279e8f25..54e74e01a 100644 --- a/src/plugins/chat/message.py +++ b/src/plugins/chat/message.py @@ -313,17 +313,21 @@ class MessageSending(MessageProcessBase): def set_reply(self, reply: Optional["MessageRecv"] = None) -> None: """设置回复消息""" - if reply: - self.reply = reply - if self.reply: - self.reply_to_message_id = self.reply.message_info.message_id - self.message_segment = Seg( - type="seglist", - data=[ - Seg(type="reply", data=self.reply.message_info.message_id), - self.message_segment, - ], - ) + if ( + self.message_info.format_info.accept_format is not None + and "reply" in self.message_info.format_info.accept_format + ): + if reply: + self.reply = reply + if self.reply: + self.reply_to_message_id = self.reply.message_info.message_id + self.message_segment = Seg( + type="seglist", + data=[ + Seg(type="reply", data=self.reply.message_info.message_id), + self.message_segment, + ], + ) return self async def process(self) -> None: diff --git a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py index 611eb5966..61849f925 100644 --- a/src/plugins/chat_module/think_flow_chat/think_flow_chat.py +++ b/src/plugins/chat_module/think_flow_chat/think_flow_chat.py @@ -365,17 +365,21 @@ class ThinkFlowChat: info_catcher.done_catch() # 处理表情包 - try: - with Timer("处理表情包", timing_results): - if global_config.emoji_chance == 1: - if send_emoji: - logger.info(f"麦麦决定发送表情包{send_emoji}") - await self._handle_emoji(message, chat, response_set, send_emoji) - else: - if random() < global_config.emoji_chance: - await self._handle_emoji(message, chat, response_set) - except Exception as e: - logger.error(f"心流处理表情包失败: {e}") + if ( + message.message_info.format_info.accept_format is not None + and "emoji" in message.message_info.format_info.accept_format + ): + try: + with Timer("处理表情包", timing_results): + if global_config.emoji_chance == 1: + if send_emoji: + logger.info(f"麦麦决定发送表情包{send_emoji}") + await self._handle_emoji(message, chat, response_set, send_emoji) + else: + if random() < global_config.emoji_chance: + await self._handle_emoji(message, chat, response_set) + except Exception as e: + logger.error(f"心流处理表情包失败: {e}") # 思考后脑内状态更新 try: