Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 21 additions & 5 deletions bot/vikingbot/channels/feishu.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,13 @@ async def _process_content_with_images(

# Add image elements
for img in images:
elements.append({"tag": "img", "img_key": img["img_key"]})
elements.append(
{
"tag": "img",
"img_key": img["img_key"],
"alt": {"tag": "plain_text", "content": ""},
}
)

if not elements:
elements = [{"tag": "markdown", "content": content_no_images}]
Expand Down Expand Up @@ -552,7 +558,7 @@ async def send(self, msg: OutboundMessage) -> None:
# @mention prefix only when replying in group chats
mention_prefix = ""
if reply_to_message_id and original_sender_id and chat_type == "group":
mention_prefix = f"<at id={original_sender_id}></at>"
mention_prefix = f'<at id="{original_sender_id}"></at>'

if content_with_mentions.strip():
md_content = (
Expand All @@ -566,13 +572,23 @@ async def send(self, msg: OutboundMessage) -> None:

# Add images
for img in images:
card_elements.append({"tag": "img", "img_key": img["image_key"]})
card_elements.append(
{
"tag": "img",
"img_key": img["image_key"],
"alt": {"tag": "plain_text", "content": ""},
}
)

if not card_elements:
card_elements.append({"tag": "markdown", "content": " "})

# Build interactive card message (no extra {"card": ...} wrapper)
card_content = json.dumps({"elements": card_elements}, ensure_ascii=False)
# Build interactive card message
card_payload = {
"config": {"wide_screen_mode": True},
"elements": card_elements,
}
card_content = json.dumps(card_payload, ensure_ascii=False)

if reply_to_message_id:
# Reply to existing message (quotes the original)
Expand Down
Loading