fix(chat): reset model override with default · openclaw/openclaw@830a72d
steipete
·
2026-05-08
·
via Recent Commits to openclaw:main
| Original file line number | Diff line number | Diff line change |
|---|
@@ -154,6 +154,7 @@ Docs: https://docs.openclaw.ai
|
154 | 154 | |
155 | 155 | ### Fixes |
156 | 156 | |
| 157 | +- Chat commands: make `/model default` reset the session model override instead of treating it as a literal model name. Fixes #78182. |
157 | 158 | - Cron: make rejected `payload.model` errors show the configured `agents.defaults.models` allowlist instead of echoing the rejected model twice. Fixes #79058. |
158 | 159 | - Agents/subagents: retry parent wake announces when the announce-summary model run fails with fallback cooldown exhaustion instead of dropping the wake on the first transient provider overload. Refs #78581. |
159 | 160 | - Providers/network: honor IPv4 CIDR and octet-wildcard `NO_PROXY` entries such as `100.64.0.0/10` and `100.64.*` before enabling trusted env-proxy mode for model-provider requests. Fixes #79030. |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -66,6 +66,15 @@ export function resolveModelSelectionFromDirective(params: {
|
66 | 66 | } |
67 | 67 | |
68 | 68 | const raw = params.directives.rawModelDirective.trim(); |
| 69 | +if (/^default$/i.test(raw)) { |
| 70 | +return { |
| 71 | +modelSelection: { |
| 72 | +provider: params.defaultProvider, |
| 73 | +model: params.defaultModel, |
| 74 | +isDefault: true, |
| 75 | +}, |
| 76 | +}; |
| 77 | +} |
69 | 78 | const storedNumericProfile = |
70 | 79 | params.directives.rawModelProfile === undefined |
71 | 80 | ? resolveStoredNumericProfileModelDirective({ |
|
| Original file line number | Diff line number | Diff line change |
|---|
@@ -643,6 +643,21 @@ describe("/model chat UX", () => {
|
643 | 643 | }); |
644 | 644 | }); |
645 | 645 | |
| 646 | +it("treats /model default as a session model reset", () => { |
| 647 | +const resolved = resolveModelSelectionForCommand({ |
| 648 | +command: "/model default", |
| 649 | +allowedModelKeys: new Set(["anthropic/claude-opus-4-6", "openai/gpt-4o"]), |
| 650 | +allowedModelCatalog: [], |
| 651 | +}); |
| 652 | + |
| 653 | +expect(resolved.errorText).toBeUndefined(); |
| 654 | +expect(resolved.modelSelection).toEqual({ |
| 655 | +provider: "anthropic", |
| 656 | +model: "claude-opus-4-6", |
| 657 | +isDefault: true, |
| 658 | +}); |
| 659 | +}); |
| 660 | + |
646 | 661 | it("keeps openrouter provider/model split for exact selections", () => { |
647 | 662 | const resolved = resolveModelSelectionForCommand({ |
648 | 663 | command: "/model openrouter/anthropic/claude-opus-4-6", |
|
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。