feat(bot): use interactive card with markdown for Feishu messages (v2)#1015
feat(bot): use interactive card with markdown for Feishu messages (v2)#1015chenjw merged 1 commit intovolcengine:mainfrom
Conversation
Change Feishu message format from post (plain text) to interactive card with markdown rendering. Fixes review feedback from volcengine#981. v2 fixes: - P0: Remove extra {"card": ...} wrapper from card JSON - P1: Mention prefix on its own line to avoid breaking heading parsing - P1: Only add mention prefix when reply_to_message_id is present Closes volcengine#960
|
|
|
Failed to generate code suggestions for PR |
|
Thanks for your commit! 1) [P1] Interactive card missing
|
Follow-up to volcengine#1015. Addresses review comments from yeshion23333: 1. Add config.wide_screen_mode to card payload to prevent text/table truncation and align with official card schema 2. Add alt field to img elements for card schema completeness 3. Quote id attribute in @mention tag for parser compatibility
Follow-up to #1015. Addresses review comments from yeshion23333: 1. Add config.wide_screen_mode to card payload to prevent text/table truncation and align with official card schema 2. Add alt field to img elements for card schema completeness 3. Quote id attribute in @mention tag for parser compatibility Co-authored-by: wzr <[email protected]>
Closes #960
Problem
AI models (LLMs) typically return content in markdown format, but the Feishu channel sends messages using the
postmessage type with plain text elements ({"tag": "text", "text": ...}). This causes markdown syntax like##,**bold**, and code blocks to display as literal text instead of rendered formatting.Solution (v2 — fixes from #981 review)
Changed the Feishu message format from
post(plain text) tointeractive(card with markdown rendering):"post"→"interactive"{"tag": "markdown", "content": ...}elements instead of{"tag": "text", "text": ...}json.dumps({"elements": ...})— no extra{"card": ...}wrapper that caused v1 API errors_build_card_elements()reply_to_message_idis present (confirmed reply in group chat){"tag": "img", "img_key": ...}approach within cards_build_card_elements()which handles markdown tables, headings, and code blocksChanges
bot/vikingbot/channels/feishu.py: Replaced post message building with interactive card building (26 insertions, 35 deletions)