Skip to content

Commit 7cfe2ac

Browse files
authored
fix: apply reply_with_quote and reply_with_mention to image-only response (#5219)
* fix: apply reply_with_quote and reply_with_mention to image-only responses * fix: restrict reply_with_quote and reply_with_mention to plain-text/image chains
1 parent 3a938d2 commit 7cfe2ac

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

  • astrbot/core/pipeline/result_decorate

astrbot/core/pipeline/result_decorate/stage.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
from collections.abc import AsyncGenerator
66

77
from astrbot.core import file_token_service, html_renderer, logger
8-
from astrbot.core.message.components import At, File, Image, Node, Plain, Record, Reply
8+
from astrbot.core.message.components import At, Image, Node, Plain, Record, Reply
99
from astrbot.core.message.message_event_result import ResultContentType
1010
from astrbot.core.pipeline.content_safety_check.stage import ContentSafetyCheckStage
1111
from astrbot.core.platform.astr_message_event import AstrMessageEvent
@@ -383,8 +383,11 @@ async def process(
383383
)
384384
result.chain = [node]
385385

386-
has_plain = any(isinstance(item, Plain) for item in result.chain)
387-
if has_plain:
386+
# at 回复 / 引用回复仅适用于纯文本或图文消息
387+
can_decorate = all(
388+
isinstance(item, (Plain, Image)) for item in result.chain
389+
)
390+
if can_decorate:
388391
# at 回复
389392
if (
390393
self.reply_with_mention
@@ -399,5 +402,4 @@ async def process(
399402

400403
# 引用回复
401404
if self.reply_with_quote:
402-
if not any(isinstance(item, File) for item in result.chain):
403-
result.chain.insert(0, Reply(id=event.message_obj.message_id))
405+
result.chain.insert(0, Reply(id=event.message_obj.message_id))

0 commit comments

Comments
 (0)