feat: 为当前回复添加format_accept的约束
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user