Skip to content

Commit 0ccfe23

Browse files
committed
feat(tui): show reasoning effort in statusbar
1 parent 9d92c68 commit 0ccfe23

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

internal/tui/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ func initialModel(agent *agent.Agent) model {
7373
return model{
7474
agent: agent,
7575
spinner: s,
76-
statusbar: statusbar.New(agent.Chat.Model, modelContextWindow(agent.ModelInfo)),
76+
statusbar: statusbar.New(agent.Chat.Model, string(agent.Chat.ReasoningEffort), modelContextWindow(agent.ModelInfo)),
7777
help: help.New(),
7878
textarea: t,
7979
keys: defaultKeyMap(),

internal/tui/statusbar/statusbar.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ var style = lipgloss.NewStyle().Faint(true)
2020
type Model struct {
2121
directory string
2222
model string
23+
reasoningEffort string
2324
messageCount int
2425
usage Usage
2526
contextWindow int64
@@ -34,17 +35,19 @@ type Usage struct {
3435
CachedTokensRatio float64
3536
}
3637

37-
// New creates a status bar that shows the current working directory and model name.
38-
func New(modelName string, contextWindow int64) Model {
38+
// New creates a status bar that shows the current working directory, model name, and
39+
// reasoning effort.
40+
func New(modelName, reasoningEffort string, contextWindow int64) Model {
3941
directory, err := os.Getwd()
4042
if err != nil {
4143
directory = ""
4244
}
4345

4446
return Model{
45-
directory: shortenHome(directory, homeDirectory()),
46-
model: modelName,
47-
contextWindow: contextWindow,
47+
directory: shortenHome(directory, homeDirectory()),
48+
model: modelName,
49+
reasoningEffort: reasoningEffort,
50+
contextWindow: contextWindow,
4851
contextProgress: progress.New(
4952
progress.WithColors(lipgloss.BrightBlack, lipgloss.BrightBlack),
5053
progress.WithoutPercentage(),
@@ -79,6 +82,9 @@ func (m Model) View() string {
7982
if m.model != "" {
8083
parts = append(parts, m.model)
8184
}
85+
if m.reasoningEffort != "" {
86+
parts = append(parts, m.reasoningEffort)
87+
}
8288

8389
return style.Render(strings.Join(parts, " · ")) + "\n" + m.usageSummary()
8490
}

internal/tui/statusbar/statusbar_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@ func TestShortenHome(t *testing.T) {
5050
}
5151

5252
func TestViewShowsModel(t *testing.T) {
53-
m := Model{directory: "~/Development/thing", model: "gpt-4o"}
53+
m := Model{directory: "~/Development/thing", model: "gpt-4o", reasoningEffort: "high"}
5454

55-
if got := m.View(); !strings.Contains(got, "~/Development/thing · gpt-4o") {
55+
if got := m.View(); !strings.Contains(got, "~/Development/thing · gpt-4o · high") {
5656
t.Errorf("View() = %q, want directory and model", got)
5757
}
5858
}
@@ -78,7 +78,7 @@ func TestFormatTokens(t *testing.T) {
7878
}
7979

8080
func TestViewShowsStats(t *testing.T) {
81-
m := New("gpt-4o", 1000)
81+
m := New("gpt-4o", "high", 1000)
8282
m.directory = "~/thing"
8383
m.SetStats(5, Usage{
8484
PromptTokens: 100,

0 commit comments

Comments
 (0)