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

Method handleSetThinkingLevel

pkg/leantui/update.go:148–176  ·  view source on GitHub ↗

handleSetThinkingLevel applies the /effort command: it sets the current model's reasoning-effort level to the requested value.

(ctx context.Context, level string)

Source from the content-addressed store, hash-verified

146// handleSetThinkingLevel applies the /effort command: it sets the current
147// model's reasoning-effort level to the requested value.
148func (m *model) handleSetThinkingLevel(ctx context.Context, level string) {
149 if m.app == nil {
150 return
151 }
152 if !m.app.SupportsModelSwitching() {
153 m.addNotice("", "Thinking levels can't be changed with remote runtimes", stMuted())
154 return
155 }
156 if level == "" {
157 m.addNotice("", "Usage: /effort <none|minimal|low|medium|high|xhigh|max>", stMuted())
158 return
159 }
160 parsed, ok := effort.Parse(level)
161 if !ok {
162 m.addNotice("✗ ", fmt.Sprintf("Unknown effort level %q (valid: none, minimal, low, medium, high, xhigh, max)", level), stError())
163 return
164 }
165 applied, err := m.app.SetAgentThinkingLevel(ctx, parsed)
166 if err != nil {
167 if errors.Is(err, runtime.ErrUnsupported) {
168 m.addNotice("", "Current model does not support thinking levels", stMuted())
169 return
170 }
171 m.addNotice("✗ ", fmt.Sprintf("Failed to set thinking level: %v", err), stError())
172 return
173 }
174 m.status.thinking = applied.String()
175 m.addNotice("", "Reasoning effort set to "+applied.String(), stMuted())
176}
177
178func (m *model) submit(ctx context.Context, text string) {
179 trimmed := strings.TrimSpace(text)

Callers 3

handleSlashMethod · 0.95

Calls 7

addNoticeMethod · 0.95
ParseFunction · 0.92
stMutedFunction · 0.85
stErrorFunction · 0.85
SetAgentThinkingLevelMethod · 0.65
StringMethod · 0.45