From 1a0848c26ab6d53cb94cdd107b6e3d7eb5f14a73 Mon Sep 17 00:00:00 2001 From: liruihan Date: Thu, 27 Aug 2026 10:40:52 +0800 Subject: [PATCH] fix: preserve text in Lark mixed messages Copy non-empty buffered text elements before clearing them when an image is inserted, and avoid emitting empty blocks for image-first messages. --- astrbot/core/platform/sources/lark/lark_event.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/astrbot/core/platform/sources/lark/lark_event.py b/astrbot/core/platform/sources/lark/lark_event.py index ccc90455f2..e3abe5e3bc 100644 --- a/astrbot/core/platform/sources/lark/lark_event.py +++ b/astrbot/core/platform/sources/lark/lark_event.py @@ -239,9 +239,10 @@ async def _convert_to_lark(message: MessageChain, lark_client: lark.Client) -> l image_key = response.data.image_key logger.debug(image_key) - ret.append(_stage) + if _stage: + ret.append(_stage.copy()) + _stage.clear() ret.append([{"tag": "img", "image_key": image_key}]) - _stage.clear() elif isinstance(comp, File): # 文件将通过 _send_file_message 方法单独发送,这里跳过 logger.debug("[Lark] 检测到文件组件,将单独发送")