Skip to content

fix: send feishu markdown tables as interactive cards via send_message - #45939

Closed
x7peeps wants to merge 1 commit into
NousResearch:mainfrom
x7peeps:fix/feishu-interactive-card-tables
Closed

fix: send feishu markdown tables as interactive cards via send_message#45939
x7peeps wants to merge 1 commit into
NousResearch:mainfrom
x7peeps:fix/feishu-interactive-card-tables

Conversation

@x7peeps

@x7peeps x7peeps commented Jun 14, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes send_message tool sending Feishu markdown tables as plain text
instead of native Interactive Card tables.

Root Cause

The _send_feishu standalone sender path creates a fresh FeishuAdapter
instance and calls adapter.send(). The table-to-Card conversion in
_build_outbound_payload was not triggered reliably through this path.

Fix

  1. New _send_interactive_card() helper - sends Interactive Card payload
    directly via lark_oapi message.create API with msg_type=interactive
  2. Table detection in _send_feishu() - checks for markdown table
    pattern before calling adapter.send()

Screenshots

image

Before: (Drag your before screenshot here showing raw markdown table)
image

After: (Drag your after screenshot here showing proper Interactive Card)

The send_message tool sends Feishu markdown tables as plain text,
making pipe characters and dashes visible to the user. The Feishu
adapter's _build_outbound_payload already handles table→interactive
card conversion, but the _send_feishu standalone sender path was
bypassing it.

Fix: detect markdown tables in _send_feishu before calling
adapter.send(). When a table is present, build the Interactive Card
payload directly via _build_table_card_payload and send it through
the lark_oapi message.create API with msg_type='interactive'.

Adds _send_interactive_card() helper that sends the raw card JSON
via the adapter's API client and returns a SendResult.
@liuhao1024

Copy link
Copy Markdown
Contributor

Review: unused thread_id parameter + cross-layer overlap

thread_id is accepted but never forwarded to the Feishu API. _send_interactive_card takes thread_id=None as a keyword argument but the function body never passes it to CreateMessageRequest. When a user sends a markdown table inside a Feishu thread/group reply, the interactive card would be delivered to the main chat instead of the thread context.

Compare with the normal adapter.send() path, which handles threading via metadata. _send_interactive_card bypasses the adapter entirely (adapter._client.im.v1.message.create directly), losing the adapter's thread-routing logic.

Cross-layer overlap with #45907: PR #45907 fixes the same table-rendering issue at the adapter level by changing _build_outbound_payload to return "interactive" with _build_markdown_card_payload (Feishu schema 2.0 cards). This PR fixes it at the send_message_tool level using _build_table_card_payload (the older card format). If both merge, the two code paths would produce different card structures for the same content. Consider aligning on one layer — either the adapter (where threading is already handled) or the send_message_tool (with proper thread_id forwarding).

@alt-glitch alt-glitch added type/bug Something isn't working comp/tools Tool registry, model_tools, toolsets platform/feishu Feishu / Lark adapter P3 Low — cosmetic, nice to have duplicate This issue or pull request already exists labels Jun 14, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Duplicate of #12114 / #31038 — same approach (detect markdown tables and render them as native Feishu interactive Card table elements). This is the saturated Feishu-table-card cluster; #31038 is the canonical CardKit-2.0 open PR.

@x7peeps

x7peeps commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #12114 (canonical Feishu table-card PR). Thanks @alt-glitch.

@x7peeps

x7peeps commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

Closing as duplicate of #12114 (canonical Feishu table→card PR). Same markdown-table-to-Interactive-Card approach.

@x7peeps x7peeps closed this Jun 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tools Tool registry, model_tools, toolsets duplicate This issue or pull request already exists P3 Low — cosmetic, nice to have platform/feishu Feishu / Lark adapter type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants