feat(tui): assign model to specific agent via Ctrl+E#24317
feat(tui): assign model to specific agent via Ctrl+E#24317MrRobotoGit wants to merge 3 commits intoanomalyco:devfrom
Conversation
Users can now configure the model for specific primary or subagents directly from the Agent selection dialog without manually editing opencode.json. - Show assigned model in agent descriptions - Add Ctrl+E shortcut to dialog-agent to edit model - Modify dialog-model to support assignToAgent mode - Persist per-agent model configurations to config.json preserving JSONC format - Persist last-used model per agent to state - Hide built-in background subagents from assignment list
|
The following comment was made by an LLM, it may be inaccurate: Based on my search, I found one potentially related PR: Related PR Found:
The current PR (24317) appears to be a new or updated implementation of model assignment functionality with a focus on the |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
…ction Read from modelStore instead of static agent data so the agent list reflects the newly selected model immediately without reopening the menu. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… lacks vision support When a user pastes an image into the chat and the selected model does not support image input, automatically find a vision-capable model from any available provider, use it to describe the image(s), and inject the description as text before the main model processes the request. - Add `vision_model` config field to pin a specific vision model - Add `Provider.getVisionModel()` that scans all providers (skipping the current model) for one with `capabilities.input.image` - Add vision fallback logic in `LLM.run()` with full error handling so failures degrade gracefully without breaking the main stream Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
For maintainers — comparison with PR #17570 (also open, addresses a related goal):
Both PRs solve "assign a specific model to an agent", but they're structurally independent — only If only one approach should land, I think the trade-off is:
Happy to align with whatever direction the team prefers — including reworking this on top of #17570 if you'd rather take that one and extend it to primary agents, or closing this if there's a clear preference. |
Issue for this PR
Closes #
Type of change
What does this PR do?
It allows users to assign specific models to primary agents and subagents directly from the TUI without manually editing
opencode.json.Previously, you had to edit the JSON config to assign a specific model to an agent (e.g., using
deepseek-v4-proforplanandqwen-3.5-plusforcode_analyzer).With this PR:
/agents) now displays the assigned model under each agent's name.Ctrl+Eon an agent opens the model picker to assign a model to that specific agent.opencode.jsonusingjsonc-parserto preserve comments and formatting.~/.opencode/state/model.json.explore,general,translator) are hidden from the manual assignment list to reduce clutter.I noticed PR #17570 exists, but this implementation focuses specifically on the TUI experience (
Ctrl+Ekeybind) and automatic config persistence.How did you verify your code works?
bun run dev/agentsdialog and verified the models are displayed correctly.Ctrl+Eon thecode_analyzersubagent, selected a different model, and verifiedopencode.jsonwas updated correctly without losing its JSONC formatting.exploreandgeneraldo not appear in the assignment list.bun typecheckwith no errors.Screenshots / recordings
Checklist