From 04d91f7f2f07d7b249fc1ef4b7afabfdd0b2f4f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=82=E5=A3=B9?= Date: Thu, 19 Feb 2026 15:05:57 +0900 Subject: [PATCH 1/2] fix: apply reply_with_quote and reply_with_mention to image-only responses --- .../core/pipeline/result_decorate/stage.py | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/astrbot/core/pipeline/result_decorate/stage.py b/astrbot/core/pipeline/result_decorate/stage.py index 15d68fb22e..ff0f06e734 100644 --- a/astrbot/core/pipeline/result_decorate/stage.py +++ b/astrbot/core/pipeline/result_decorate/stage.py @@ -383,21 +383,19 @@ async def process( ) result.chain = [node] - has_plain = any(isinstance(item, Plain) for item in result.chain) - if has_plain: - # at 回复 - if ( - self.reply_with_mention - and event.get_message_type() != MessageType.FRIEND_MESSAGE - ): - result.chain.insert( - 0, - At(qq=event.get_sender_id(), name=event.get_sender_name()), - ) - if len(result.chain) > 1 and isinstance(result.chain[1], Plain): - result.chain[1].text = "\n" + result.chain[1].text + # at 回复 + if ( + self.reply_with_mention + and event.get_message_type() != MessageType.FRIEND_MESSAGE + ): + result.chain.insert( + 0, + At(qq=event.get_sender_id(), name=event.get_sender_name()), + ) + if len(result.chain) > 1 and isinstance(result.chain[1], Plain): + result.chain[1].text = "\n" + result.chain[1].text - # 引用回复 - if self.reply_with_quote: - if not any(isinstance(item, File) for item in result.chain): - result.chain.insert(0, Reply(id=event.message_obj.message_id)) + # 引用回复 + if self.reply_with_quote: + if not any(isinstance(item, File) for item in result.chain): + result.chain.insert(0, Reply(id=event.message_obj.message_id)) From fcfe2f4f1285a07504cc8cb8b55d0ee3167ff5e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=99=82=E5=A3=B9?= Date: Mon, 23 Feb 2026 13:05:54 +0900 Subject: [PATCH 2/2] fix: restrict reply_with_quote and reply_with_mention to plain-text/image chains --- .../core/pipeline/result_decorate/stage.py | 34 +++++++++++-------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/astrbot/core/pipeline/result_decorate/stage.py b/astrbot/core/pipeline/result_decorate/stage.py index ff0f06e734..2947466441 100644 --- a/astrbot/core/pipeline/result_decorate/stage.py +++ b/astrbot/core/pipeline/result_decorate/stage.py @@ -5,7 +5,7 @@ from collections.abc import AsyncGenerator from astrbot.core import file_token_service, html_renderer, logger -from astrbot.core.message.components import At, File, Image, Node, Plain, Record, Reply +from astrbot.core.message.components import At, Image, Node, Plain, Record, Reply from astrbot.core.message.message_event_result import ResultContentType from astrbot.core.pipeline.content_safety_check.stage import ContentSafetyCheckStage from astrbot.core.platform.astr_message_event import AstrMessageEvent @@ -383,19 +383,23 @@ async def process( ) result.chain = [node] - # at 回复 - if ( - self.reply_with_mention - and event.get_message_type() != MessageType.FRIEND_MESSAGE - ): - result.chain.insert( - 0, - At(qq=event.get_sender_id(), name=event.get_sender_name()), - ) - if len(result.chain) > 1 and isinstance(result.chain[1], Plain): - result.chain[1].text = "\n" + result.chain[1].text + # at 回复 / 引用回复仅适用于纯文本或图文消息 + can_decorate = all( + isinstance(item, (Plain, Image)) for item in result.chain + ) + if can_decorate: + # at 回复 + if ( + self.reply_with_mention + and event.get_message_type() != MessageType.FRIEND_MESSAGE + ): + result.chain.insert( + 0, + At(qq=event.get_sender_id(), name=event.get_sender_name()), + ) + if len(result.chain) > 1 and isinstance(result.chain[1], Plain): + result.chain[1].text = "\n" + result.chain[1].text - # 引用回复 - if self.reply_with_quote: - if not any(isinstance(item, File) for item in result.chain): + # 引用回复 + if self.reply_with_quote: result.chain.insert(0, Reply(id=event.message_obj.message_id))