v0.2.42 821f51a

reasoning.go RawHistoryFolder

1package provider
2
3import "strings"
4
5// NormalizeReasoning canonicalizes zot's user-facing thinking levels.
6// Empty string means reasoning/thinking is disabled.
7func NormalizeReasoning(level string) string {
8	switch strings.ToLower(strings.TrimSpace(level)) {
9	case "", "off", "none", "no", "false", "disabled":
10		return ""
11	case "min", "minimal", "minimum":
12		return "minimum"
13	case "low":
14		return "low"
15	case "med", "medium":
16		return "medium"
17	case "hi", "high":
18		return "high"
19	case "max", "maximum":
20		return "maximum"
21	default:
22		return strings.ToLower(strings.TrimSpace(level))
23	}
24}
25
26// ReasoningBudget returns zot's approximate token budget for thinking-capable
27// providers that accept explicit budgets.
28func ReasoningBudget(level string) int {
29	switch NormalizeReasoning(level) {
30	case "minimum":
31		return 1024
32	case "low":
33		return 2048
34	case "medium":
35		return 8192
36	case "high":
37		return 16384
38	case "maximum":
39		return 32768
40	default:
41		return 0
42	}
43}
44
45// AnthropicAdaptiveEffort maps zot's user-facing thinking levels onto the
46// effort enum used by Anthropic's adaptive-thinking models (Opus 4.7+).
47// These models reject explicit thinking budgets; thinking depth is
48// controlled by output_config.effort instead. Returns "" when reasoning
49// is disabled.
50func AnthropicAdaptiveEffort(level string) string {
51	switch NormalizeReasoning(level) {
52	case "minimum", "low":
53		return "low"
54	case "medium":
55		return "medium"
56	case "high":
57		return "high"
58	case "maximum":
59		return "xhigh"
60	default:
61		return ""
62	}
63}
64
65// OpenAIReasoningEffort maps zot's six-level setting onto the effort enum
66// accepted by OpenAI-compatible chat-completions endpoints.
67func OpenAIReasoningEffort(level string) string {
68	switch NormalizeReasoning(level) {
69	case "minimum", "low":
70		// Many OpenAI-compatible endpoints only accept low/medium/high.
71		// Use low for zot's minimum instead of the newer minimal enum.
72		return "low"
73	case "medium":
74		return "medium"
75	case "high", "maximum":
76		return "high"
77	default:
78		return ""
79	}
80}
81
82// OpenAICompatAnthropicEffort maps zot's user-facing thinking levels
83// onto reasoning_effort values when an adaptive-thinking Anthropic
84// model (Opus 4.7+) is served over the OpenAI-compatible chat-
85// completions wire (openrouter, opencode, ...). Differs from
86// OpenAIReasoningEffort only at the top: zot's "maximum" maps to
87// "xhigh" instead of being clamped to "high", so the model's full
88// adaptive-thinking ceiling is preserved when reachable through a
89// gateway that accepts the effort knob.
90func OpenAICompatAnthropicEffort(level string) string {
91	switch NormalizeReasoning(level) {
92	case "minimum", "low":
93		return "low"
94	case "medium":
95		return "medium"
96	case "high":
97		return "high"
98	case "maximum":
99		return "xhigh"
100	default:
101		return ""
102	}
103}
104
105// OpenAICodexReasoningEffort maps zot levels onto the ChatGPT/Codex
106// Responses backend enum. That backend rejects "minimal" and uses
107// "xhigh" for the highest tier on recent GPT-5.x models.
108func OpenAICodexReasoningEffort(level string) string {
109	switch NormalizeReasoning(level) {
110	case "minimum", "low":
111		return "low"
112	case "medium":
113		return "medium"
114	case "high":
115		return "high"
116	case "maximum":
117		return "xhigh"
118	default:
119		return ""
120	}
121}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close