mirror of
https://github.com/AstrBotDevs/AstrBot.git
synced 2026-10-16 15:06:04 +08:00
fix: preserve text in Lark mixed messages (#9841)
Copy non-empty buffered text elements before clearing them when an image is inserted, and avoid emitting empty blocks for image-first messages. Co-authored-by: liruihan <liruihan@example.com>
This commit is contained in:
@@ -239,9 +239,10 @@ class LarkMessageEvent(AstrMessageEvent):
|
||||
|
||||
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] 检测到文件组件,将单独发送")
|
||||
|
||||
Reference in New Issue
Block a user