Bug:** When the agent sends markdown table content via Feishu, it appears as plain text instead of Feishu's native interactive card with a formatted table.
Root cause: The _should_send_as_card() function in gateway/platforms/feishu.py has an overly strict trigger condition. It requires a markdown table AND (a heading OR checkboxes OR specific report keywords):
has_table = bool(re.search(r'\|.+?\|.+?\|', content, re.MULTILINE))
return has_table and (has_heading or has_checkbox or has_report_keywords)
Simple tables without headings or special keywords fall through to plain text, which renders poorly in Feishu.
Additionally, there's a regex gotcha: r'\\|' in a raw string matches two characters (backslash + pipe), not the pipe character alone. The correct pattern is r'\|'.
Fix: Simplify the condition — any content containing a markdown table should be sent as an interactive card:
def _should_send_as_card(content: str) -> bool:
"""判断内容是否适合以 Interactive Card 格式发送。
任何有 markdown 表格的内容都发送为卡片格式。
"""
if len(content) < 30:
return False
has_table = bool(re.search(r'\|.+?\|.+?\|', content, re.MULTILINE))
return has_table
Why this is safe: The interactive card format handles mixed content well — tables render as native Feishu tables, and surrounding markdown text renders as lark_md divs. There's no downside to sending table-containing content as cards.
Affected use cases: Any agent response containing a simple table without headings — e.g., data lookups, comparison tables, status reports with just tabular data.
Reproduction:
- Ask agent a question that returns tabular data without headings
- Response appears as raw markdown text with
| characters instead of a formatted table
Bug:** When the agent sends markdown table content via Feishu, it appears as plain text instead of Feishu's native interactive card with a formatted table.
Root cause: The
_should_send_as_card()function ingateway/platforms/feishu.pyhas an overly strict trigger condition. It requires a markdown table AND (a heading OR checkboxes OR specific report keywords):Simple tables without headings or special keywords fall through to plain text, which renders poorly in Feishu.
Additionally, there's a regex gotcha:
r'\\|'in a raw string matches two characters (backslash + pipe), not the pipe character alone. The correct pattern isr'\|'.Fix: Simplify the condition — any content containing a markdown table should be sent as an interactive card:
Why this is safe: The interactive card format handles mixed content well — tables render as native Feishu tables, and surrounding markdown text renders as
lark_mddivs. There's no downside to sending table-containing content as cards.Affected use cases: Any agent response containing a simple table without headings — e.g., data lookups, comparison tables, status reports with just tabular data.
Reproduction:
|characters instead of a formatted table