Repository navigation
feat(feishu): interactive card model picker with two-level drill-down - #84476
ShanNing-YU wants to merge 1 commit into
Conversation
feat(feishu): interactive card model picker with two-level drill-down Reviewed A few observations:
|
2d86a7d to
9380cb4
Compare
682d449 to
e2f40f8
Compare
|
Thanks for the thorough review — all four points are addressed, plus additional hardening found while auditing the same paths. The picker has also been verified end-to-end on a real Feishu client. 1. Key mismatch in 2. No operator authorization on picker actions — Picker taps are now gated exactly like the approval path: 3. Stale picker state never expires — Each picker carries 4. Rapid double-tap races two switches — A Additional hardening found in the same paths:
Tests: |
782299e to
b51a013
Compare
…w fixes Port the Feishu /model interactive card picker to the v0.20.6 adapter after upstream refactored plugins/platforms/feishu/adapter.py. - Two-level drill-down (provider -> model, 8/page) mirroring Telegram - Synchronous P2CardActionTriggerResponse navigation (no subprocess) - Background switch + lark-cli card PATCH + text fallback confirmation - Review fixes (all from NousResearch#84476 review): operator authz, chat binding, 5-min expiry, double-tap switching guard, unguessable picker tokens, server-side model validation, update_multi, state cap - Tests updated to match final behaviour; 16 pass on v0.20.6
b51a013 to
9dfcdf4
Compare
|
Rebased and ported to v0.20.6 — ready for review. This PR has been updated to the current What's in this update:
Closes #20520. |
|
Independent end-to-end verification (Windows 11 · Feishu cloud · WebSocket mode · current main) I implemented the same picker locally before finding this PR, and can corroborate the two hardest parts of the diagnosis — plus one extra footgun that cost me a debugging round. 1. Confirmed working end-to-end on a real client. 2. 3. Corroborating the 4. Mutability note. The picker is only reachable when the adapter class defines Happy to re-verify after the next rebase if useful. |
|
Read at head @sy3q's def _resp(card_json):
if P2CardActionTriggerResponse is None:
return None
response = P2CardActionTriggerResponse()
if CallBackCard is not None:
cb = CallBackCard()
cb.type = "raw"
cb.data = card_json # the dict, not json.dumps(card)
response.card = cb
return response
That said, your point stands as a guard rather than a fix, and it is cheap: On The four original points, re-read at this head: operator gating via Not a blocker from me. Two things I have not verified and am not claiming: the end-to-end Feishu client behaviour (yours and @sy3q's respectively — I have no way to exercise a real Feishu tenant), and whether Nothing outstanding from me. |
Summary
Implements
send_model_pickerfor the Feishu/Lark plugin adapter (plugins/platforms/feishu/adapter.py), enabling an interactive card-based model selector — matching the UX that Telegram and Discord already have. Closes #20520.Design
Two-level drill-down mirrors the Telegram adapter pattern:
Navigation is instant: the synchronous card-action callback returns a
P2CardActionTriggerResponsecarrying aCallBackCard, so Feishu swaps the card in place with no subprocess or external PATCH call (unlike the existing #10301 which targets the retiredgateway/platforms/feishu.py).The actual model switch runs in the background; the card is patched to its final green/red confirmation state via lark-cli (the lark-oapi SDK's
message.updatehas a content-encoding bug formsg_type=interactive, so we route around it).Why this PR is different from #10301
gateway/platforms/feishu.pyplugins/platforms/feishu/adapter.pyTesting
tests/gateway/test_feishu_model_picker.py