handleSetThinkingLevel applies the /effort command: it sets the current model's reasoning-effort level to the requested value. An empty level opens the effort picker dialog; unsupported levels surface the model's supported list via the runtime error.
(level string)
| 567 | // opens the effort picker dialog; unsupported levels surface the model's |
| 568 | // supported list via the runtime error. |
| 569 | func (m *appModel) handleSetThinkingLevel(level string) (tea.Model, tea.Cmd) { |
| 570 | if !m.application.SupportsModelSwitching() { |
| 571 | return m, notification.InfoCmd("Thinking levels can't be changed with remote runtimes") |
| 572 | } |
| 573 | if level == "" { |
| 574 | return m.openEffortPicker() |
| 575 | } |
| 576 | parsed, ok := effort.Parse(level) |
| 577 | if !ok { |
| 578 | return m, notification.ErrorCmd(fmt.Sprintf("Unknown effort level %q (valid: none, minimal, low, medium, high, xhigh, max)", level)) |
| 579 | } |
| 580 | applied, err := m.application.SetAgentThinkingLevel(m.ctx(), parsed) |
| 581 | if err != nil { |
| 582 | if errors.Is(err, runtime.ErrUnsupported) { |
| 583 | return m, notification.InfoCmd("Current model does not support thinking levels") |
| 584 | } |
| 585 | return m, notification.ErrorCmd(fmt.Sprintf("Failed to set thinking level: %v", err)) |
| 586 | } |
| 587 | return m, notification.SuccessCmd("Reasoning effort set to " + applied.String()) |
| 588 | } |
| 589 | |
| 590 | // openEffortPicker opens the effort picker dialog listing the thinking-effort |
| 591 | // levels supported by the current agent's model (/effort without arguments). |
no test coverage detected