hermes - ✅(Solved) Fix [Feishu] Add interactive card model picker (send_model_picker) [1 pull requests, 2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
NousResearch/hermes-agent#20520Fetched 2026-05-07 03:57:35
View on GitHub
Comments
2
Participants
2
Timeline
9
Reactions
0
Timeline (top)
labeled ×4commented ×2cross-referenced ×1mentioned ×1

Fix Action

Fix / Workaround

Implementation

I have a working implementation ready:

  • send_model_picker() method matching the existing contract in gateway/run.py
  • _build_model_picker_provider_card() and _build_model_picker_model_card() card builders
  • _handle_model_picker_card_action() synchronous dispatch (provider→model→selection)
  • _handle_model_picker_selection() async handler for actual model switch
  • 12 unit tests covering card structure and dispatch logic (all passing ✅)

PR fix notes

PR #20526: feat(feishu): Add interactive card model picker (send_model_picker)

Description (problem / solution / changelog)

Summary

Implements send_model_picker for the Feishu/Lark platform adapter, enabling an interactive card-based model selector — matching the UX that Telegram and Discord already have.

Closes #20520

What Changed

gateway/platforms/feishu.py

  • Added _model_picker_state dict to track per-chat picker state
  • Added send_model_picker() — sends an interactive provider selection card, matching the contract in gateway/run.py
  • Added _build_model_picker_provider_card() — builds the top-level provider selection card (4 buttons per action group, Feishu limit)
  • Added _build_model_picker_model_card() — builds the paginated model selection card with navigation
  • Added _handle_model_picker_card_action() — synchronous dispatch handler for all picker button clicks:
    • mp:<slug> → switch to model list for selected provider
    • mg:<page> → paginate model list
    • mm:<idx> → show "processing..." card + schedule async switch
    • mb → back to provider list
    • mx → cancel
  • Added _handle_model_picker_selection() — async callback that performs the actual model switch via on_model_selected
  • Added helper methods: _cleanup_picker_state, _update_card, _picker_expired_response, _picker_error_response
  • Modified _on_card_action_trigger to intercept model picker actions before approval handling

tests/gateway/test_feishu_model_picker.py (new)

  • 12 unit tests covering:
    • Provider card structure and current-provider marking
    • Model card structure, pagination, back/cancel buttons
    • Synchronous dispatch: provider→model, page nav, back, cancel, expired state
    • Model selection schedules async work and returns processing card

All tests pass ✅

Design Decisions

  • Navigation is synchronousP2CardActionTriggerResponse replaces the card immediately on provider/page/back actions (fast, no loading state needed)
  • Model switch is async — the actual on_model_selected callback may involve API calls; we show "⏳ processing..." card first, then update via edit_message when done
  • Reuses existing infrastructure_submit_on_loop, _feishu_send_with_retry, _finalize_send_result, P2CardActionTriggerResponse/CallBackCard patterns
  • Feishu card constraints honored — 4 buttons per action group, wide screen mode enabled

Testing

pytest tests/gateway/test_feishu_model_picker.py -v
# 12 passed ✅

Before/After

Before: /model on Feishu → plain text list:

Current: deepseek-v4-pro on ollama-cloud

OpenRouter:
  openai/gpt-5.4, anthropic/claude-sonnet-4, ...

After: /model on Feishu → interactive card with buttons for provider selection, then paginated model list with navigation.

Changed files

  • gateway/platforms/feishu.py (modified, +395/-0)
  • tests/gateway/test_feishu_model_picker.py (added, +291/-0)
RAW_BUFFERClick to expand / collapse

Feature Request

Problem

In Feishu (飞书), the /model command currently falls back to a plain text list of providers and models. Unlike Telegram and Discord, which both have interactive inline-keyboard / component-based model pickers, Feishu has no send_model_picker implementation.

Current Behavior

  • /model on Feishu → text-only fallback (line 7210-7239 in gateway/run.py)
  • Telegram: full two-layer inline keyboard picker ✅
  • Discord: full component-based picker ✅
  • Feishu: ❌ missing send_model_picker

Desired Behavior

Feishu should have an interactive card-based model picker using Feishu interactive cards (interactive message type + P2CardActionTriggerResponse). The existing Feishu adapter already has the infrastructure for this:

  • send_exec_approval already builds interactive cards with buttons and handles callbacks
  • P2CardActionTriggerResponse + CallBackCard can replace cards synchronously on button clicks
  • _on_card_action_trigger can intercept hermes_action values for routing

Proposed Design

Two-layer drill-down (same as Telegram/Discord):

  1. Provider selection card — buttons per provider, each carrying hermes_action: "mp:<slug>"
  2. Model selection card — paginated model buttons (mm:<idx>), navigation (mg:<page>), back (mb), cancel (mx)
  3. All navigation (provider→model, page change, back) updates the card synchronously via P2CardActionTriggerResponse
  4. Model selection shows a "⏳ processing..." card immediately, then schedules async switch + card update

Implementation

I have a working implementation ready:

  • send_model_picker() method matching the existing contract in gateway/run.py
  • _build_model_picker_provider_card() and _build_model_picker_model_card() card builders
  • _handle_model_picker_card_action() synchronous dispatch (provider→model→selection)
  • _handle_model_picker_selection() async handler for actual model switch
  • 12 unit tests covering card structure and dispatch logic (all passing ✅)

I can submit a PR with the implementation if this feature request is accepted.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING