MCPcopy
hub / github.com/docker/docker-agent / handleSetThinkingLevel

Method handleSetThinkingLevel

pkg/tui/handlers.go:569–588  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

567// opens the effort picker dialog; unsupported levels surface the model's
568// supported list via the runtime error.
569func (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).

Callers 1

updateMethod · 0.95

Calls 8

openEffortPickerMethod · 0.95
InfoCmdFunction · 0.92
ParseFunction · 0.92
ErrorCmdFunction · 0.92
SuccessCmdFunction · 0.92
SetAgentThinkingLevelMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected