feat: numbered menu selection for /model and /effort + external menus.json#2
Open
baochipham942-eng wants to merge 1 commit intoeLeanwang:mainfrom
Open
feat: numbered menu selection for /model and /effort + external menus.json#2baochipham942-eng wants to merge 1 commit intoeLeanwang:mainfrom
baochipham942-eng wants to merge 1 commit intoeLeanwang:mainfrom
Conversation
Extract hardcoded model lists into data/menus.json with loadMenus() fallback, and replace plain text lists in the text-only path with numbered menus that accept digit replies (60s expiry). Feishu interactive card path unchanged. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
On mobile devices (WeChat, AUN, Feishu text fallback), users need to type exact model names like
/model sonnetor/effort high. This is painful on small keyboards. Additionally, model lists are hardcoded in each runner file, requiring code changes whenever models are added or renamed.Solution
1. External
menus.jsonconfig fileModel lists and effort levels are now loaded from
data/menus.json:{ "models": { "claude": ["opus", "sonnet", "haiku"], "codex": ["gpt-5.3-codex", "gpt-5.2-codex", ...], "gemini": ["gemini-2.5-pro", "gemini-2.5-flash", ...] }, "efforts": ["low", "medium", "high", "max"] }loadMenus()inconfig.tswith caching2. Numbered menu for text fallback path
When the channel doesn't support interactive cards (AUN, WeChat) or card sending fails,
/modeland/effortnow show numbered menus:User replies
2→ switches to sonnet. No typing required.Implementation details:
PendingSelectionstate keyed bychannel:channelId:userIdwith 60s expiryisCommand()extended to recognize digit inputs when pending selections existWhat's NOT changed
/model sonnetand/effort highstill work as beforeChanges
data/menus.jsonsrc/config.tsMenusConfiginterface +loadMenus()with cachesrc/agents/claude-runner.tslistModels()reads from menus configsrc/agents/codex-runner.tssrc/agents/gemini-runner.tssrc/core/command-handler.ts