Skip to content

fix(feishu): support reading WebSocket rendered card content - #4342

Merged
Re-bin merged 3 commits into
HKUDS:mainfrom
JiajunBernoulli:support-feishu-card
Jun 19, 2026
Merged

fix(feishu): support reading WebSocket rendered card content#4342
Re-bin merged 3 commits into
HKUDS:mainfrom
JiajunBernoulli:support-feishu-card

Conversation

@JiajunBernoulli

Copy link
Copy Markdown
Contributor

Problem

Feishu cards arriving via WebSocket have a different structure than expected. The function returned empty results, causing cards to be displayed as placeholder.

Root Cause

Three structural mismatches between actual WebSocket card format and code expectations:

  1. Nested list elements: is (list of lists), not (flat list)
  2. Text element format: Rendered cards use with field, not with field
  3. Missing user_dsl: Original card definition is in JSON string field, not used by extraction code

Fix

Three minimal changes to :

  1. Extract first (richest source for original card data)
  2. Handle nested list format (detect is list)
  3. Add handler in
  4. Support (schema 2.0 format)

Testing

Verified with actual Feishu card messages - bot now correctly reads card content including markdown, tables, and structured data.

Feishu cards arriving via WebSocket have a different structure than
expected: elements are nested lists with tag:text/text fields instead
of flat lists with tag:markdown/content. Also extract user_dsl for
richer card data and support body.elements (schema 2.0).
@JiajunBernoulli

JiajunBernoulli commented Jun 16, 2026

Copy link
Copy Markdown
Contributor Author

【需求背景】我会将一些Bot发送的消息卡片直接转发给Nanobot处理,但是当前的Nanobot无法读取飞书卡片
【测试用例】
修复前飞书读不到nanobot发出的卡片
image
修复后可以读到nanobot发出的卡片
image

Maintainer edit: parse Feishu card table columns and rows so forwarded table cards do not fall back to [interactive], and add parser regression coverage.
@chengyongru

Copy link
Copy Markdown
Collaborator

Pushed a maintainer fix for the Feishu card parser: table components now extract column headers and row values instead of falling back to [interactive], and the parser has regression coverage for user_dsl, nested rendered text elements, and table rows.

Maintainer edit: remove speculative recursive cell handling and keep table extraction to the documented columns and row values.
@chengyongru

Copy link
Copy Markdown
Collaborator

@JiajunBernoulli 我做了一点改动,可以看看是不是符合你的预期💖

@JiajunBernoulli

Copy link
Copy Markdown
Contributor Author

@JiajunBernoulli 我做了一点改动,可以看看是不是符合你的预期💖

LGTM

@Re-bin Re-bin left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. This fixes a real Feishu card ingestion gap: WebSocket-rendered interactive cards now extract useful content from user_dsl, nested rendered text elements, schema 2.0 body elements, and table rows instead of falling back to [interactive].

I also checked the maintainer follow-up around table extraction, and the author confirmed the behavior matches expectations.

Validated locally:

  • python -m pytest tests/channels/test_feishu_card_extraction.py tests/channels/test_feishu_login.py tests/channels/test_feishu_streaming.py -q
  • python -m ruff check nanobot/channels/feishu.py tests/channels/test_feishu_card_extraction.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working channel valid

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants