fix(desktop): reuse model picker for agent settings

This commit is contained in:
程序员阿江(Relakkes)
2026-08-14 16:43:44 +08:00
parent 49cfd179fa
commit 9f5c1951a2
11 changed files with 265 additions and 142 deletions
+4 -2
View File
@@ -59,7 +59,7 @@ order: 3
在列表里点内置 Agent 那一行的「调整模型」,或者进详情页点右上角的同名按钮。能改的只有两项:
- **模型** — 「内置默认」「继承主会话」「Haiku / Sonnet / Opus / Fable」,也可以填自定义模型 ID。
- **模型** — 「内置默认」「继承主会话」、Haiku / Sonnet / Opus / Fable 别名,以及当前 Provider 已配置的模型。
- **思考强度** — 「内置默认」或低 / 中 / 高 / 极高 / 最大。
系统提示词、工具范围和颜色不能改,仍由 Claude Code 固定。
@@ -70,6 +70,8 @@ order: 3
覆盖写进 `~/.claude/settings.json` 的 `builtInAgentOverrides`,对所有项目生效。恢复默认时这条记录会被整个删掉,不会在配置文件里留下空壳。
Agent 配置只保存模型 ID,不绑定 Provider。选择器会列出当前 Provider 的可用模型;如果以后切换 Provider,别名会按新 Provider 的映射解析,完整模型 ID 则需要新 Provider 也支持。
如果你自己建了一个同名的用户 Agent(比如手写一个 `name: Explore` 的 md 文件),它会完全盖住内置的那个,此时改内置的模型不会有任何效果——弹窗里会提示这一点。
## 捏一个自己的
@@ -82,7 +84,7 @@ order: 3
2. **名称** — 1–64 位小写字母、数字、连字符或下划线,比如 `code-reviewer`。这是主 Agent 调用它时用的名字。
3. **描述** — 说明主 Agent 应该在什么场景下委派给它。**这一条最重要**:主 Agent 就是靠它决定要不要派这个 Agent,写含糊了就永远不会被叫到。
4. **系统提示词** — 定义这个 Agent 的职责、边界和预期输出。
5. **模型** — 继承主 Agent,或指定 Haiku / Sonnet / Opus / Fable,也可以填自定义模型 ID。简单重复的活给 Haiku 更快更省。
5. **模型** — 继承主 Agent,选择 Haiku / Sonnet / Opus / Fable 别名,或选择当前 Provider 已配置的模型。简单重复的活给 Haiku 更快更省。
6. **思考强度** — 继承,或单独指定低 / 中 / 高 / 极高 / 最大。模型不支持某档时会自动降级或忽略。
7. **工具** — 三选一:全部工具、不允许使用工具、自定义列表。选自定义时按读取与搜索 / 修改文件 / 执行命令 / 工作流分类勾选,下面还有一个自由输入框,用来填 MCP 工具名或者 `Bash(git:*)` 这样的权限规则。
8. **颜色** — 用来在界面上区分,可选。
+4 -2
View File
@@ -59,7 +59,7 @@ Built-in agents each pin a default model — `Explore` and `claude-code-guide` r
Click **Adjust model** on the built-in agent's row, or the same button in the top-right of its detail page. Only two things are editable:
- **Model** — Built-in default, Inherit from parent, Haiku / Sonnet / Opus / Fable, or a custom model ID.
- **Model** — Built-in default, Inherit from parent, the Haiku / Sonnet / Opus / Fable aliases, or a model configured for the current provider.
- **Reasoning effort** — Built-in default, or low / medium / high / xhigh / max.
The system prompt, tool scope, and color stay fixed by Claude Code.
@@ -70,6 +70,8 @@ The system prompt, tool scope, and color stay fixed by Claude Code.
The override is written to `builtInAgentOverrides` in `~/.claude/settings.json` and applies to every project. Resetting removes the entry entirely rather than leaving an empty shell behind in your config.
Agent configuration stores a model ID, not a provider. The picker lists models from the current provider. If you switch providers later, aliases resolve through the new provider's mapping, while a full model ID must also be supported by the new provider.
If you create a user agent with the same name (a hand-written file with `name: Explore`, say), it shadows the built-in one completely — changing the built-in's model then has no effect, and the dialog says so.
## Writing your own
@@ -82,7 +84,7 @@ Click **Create Agent** in the top right. The fields:
2. **Name** — 1–64 lowercase letters, digits, hyphens, or underscores, e.g. `code-reviewer`. This is what the main agent calls it by.
3. **Description** — when the main agent should delegate to it. **This is the field that matters most**: it's what the main agent reads to decide whether to call this agent at all. Write it vaguely and the agent will never be used.
4. **System prompt** — its responsibilities, boundaries, and expected output.
5. **Model** — inherit from the main agent, or pick Haiku / Sonnet / Opus / Fable, or enter a custom model ID. Simple repetitive work is faster and cheaper on Haiku.
5. **Model** — inherit from the main agent, choose a Haiku / Sonnet / Opus / Fable alias, or choose a model configured for the current provider. Simple repetitive work is faster and cheaper on Haiku.
6. **Effort** — inherit, or set low / medium / high / xhigh / max. Models that don't support a level downgrade or ignore it.
7. **Tools** — all tools, no tools, or a custom list. The custom picker groups built-in tools by read and search, modify files, execute commands, and workflow, with a free-text field below for MCP tool names or permission rules like `Bash(git:*)`.
8. **Color** — optional, purely for telling agents apart in the UI.