From edbacb813bd148db33d8747ada293ef2acabe7e9 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sun, 14 Dec 2025 14:43:00 +0300 Subject: Enha: toggle visibility of status line --- tui.go | 57 +++++++++++++++++++++++++++++++++++++++++---------------- 1 file changed, 41 insertions(+), 16 deletions(-) (limited to 'tui.go') diff --git a/tui.go b/tui.go index 383d680..941371b 100644 --- a/tui.go +++ b/tui.go @@ -23,7 +23,7 @@ var ( textArea *tview.TextArea editArea *tview.TextArea textView *tview.TextView - position *tview.TextView + statusLineWidget *tview.TextView helpView *tview.TextView flex *tview.Flex imgView *tview.Image @@ -32,6 +32,7 @@ var ( renameWindow *tview.InputField roleEditWindow *tview.InputField fullscreenMode bool + positionVisible bool = true // pages historyPage = "historyPage" agentPage = "agentPage" @@ -87,6 +88,7 @@ var ( [yellow]Alt+1[white]: toggle shell mode (execute commands locally) [yellow]Alt+4[white]: edit msg role [yellow]Alt+5[white]: toggle system and tool messages display +[yellow]Alt+6[white]: toggle status line visibility === scrolling chat window (some keys similar to vim) === [yellow]arrows up/down and j/k[white]: scroll up and down @@ -171,6 +173,26 @@ func toggleShellMode() { updateStatusLine() } +func updateFlexLayout() { + if fullscreenMode { + // flex already contains only focused widget; do nothing + return + } + flex.Clear() + flex.AddItem(textView, 0, 40, false) + flex.AddItem(textArea, 0, 10, false) + if positionVisible { + flex.AddItem(statusLineWidget, 0, 2, false) + } + // Keep focus on currently focused widget + focused := app.GetFocus() + if focused == textView { + app.SetFocus(textView) + } else { + app.SetFocus(textArea) + } +} + func executeCommandAndDisplay(cmdText string) { // Parse the command (split by spaces, but handle quoted arguments) cmdParts := parseCommand(cmdText) @@ -456,8 +478,10 @@ func init() { // flex = tview.NewFlex().SetDirection(tview.FlexRow). AddItem(textView, 0, 40, false). - AddItem(textArea, 0, 10, true). // Restore original height - AddItem(position, 0, 2, false) + AddItem(textArea, 0, 10, true) // Restore original height + if positionVisible { + flex.AddItem(statusLineWidget, 0, 2, false) + } // textView.SetBorder(true).SetTitle("chat") textView.SetDoneFunc(func(key tcell.Key) { if key == tcell.KeyEnter { @@ -516,14 +540,16 @@ func init() { }) focusSwitcher[textArea] = textView focusSwitcher[textView] = textArea - position = tview.NewTextView(). + statusLineWidget = tview.NewTextView(). SetDynamicColors(true). SetTextAlign(tview.AlignCenter) // Initially set up flex without search bar flex = tview.NewFlex().SetDirection(tview.FlexRow). AddItem(textView, 0, 40, false). - AddItem(textArea, 0, 10, true). // Restore original height - AddItem(position, 0, 2, false) + AddItem(textArea, 0, 10, true) // Restore original height + if positionVisible { + flex.AddItem(statusLineWidget, 0, 2, false) + } editArea = tview.NewTextArea(). SetPlaceholder("Replace msg...") editArea.SetBorder(true).SetTitle("input") @@ -749,6 +775,14 @@ func init() { textView.SetText(chatToText(cfg.ShowSys)) colorText() } + if event.Key() == tcell.KeyRune && event.Rune() == '6' && event.Modifiers()&tcell.ModAlt != 0 { + // toggle status line visibility + if name, _ := pages.GetFrontPage(); name != "main" { + return event + } + positionVisible = !positionVisible + updateFlexLayout() + } if event.Key() == tcell.KeyF1 { // chatList, err := loadHistoryChats() chatList, err := store.GetChatByChar(cfg.AssistantRole) @@ -841,16 +875,7 @@ func init() { } } else { // focused is the fullscreened widget here - flex.Clear(). - AddItem(textView, 0, 40, false). - AddItem(textArea, 0, 10, false). - AddItem(position, 0, 2, false) - - if focused == textView { - app.SetFocus(textView) - } else { // default to textArea - app.SetFocus(textArea) - } + updateFlexLayout() } return nil } -- cgit v1.2.3 From d73c3abd6bda8690e8b5e57342221c8cb2cc88b3 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 17 Dec 2025 13:03:40 +0300 Subject: Feat: preload lcp model --- tui.go | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'tui.go') diff --git a/tui.go b/tui.go index 941371b..53c8cfd 100644 --- a/tui.go +++ b/tui.go @@ -89,6 +89,7 @@ var ( [yellow]Alt+4[white]: edit msg role [yellow]Alt+5[white]: toggle system and tool messages display [yellow]Alt+6[white]: toggle status line visibility +[yellow]Alt+9[white]: warm up (load) selected llama.cpp model === scrolling chat window (some keys similar to vim) === [yellow]arrows up/down and j/k[white]: scroll up and down @@ -1235,6 +1236,14 @@ func init() { toggleShellMode() return nil } + if event.Key() == tcell.KeyRune && event.Modifiers() == tcell.ModAlt && event.Rune() == '9' { + // Warm up (load) the currently selected model + go warmUpModel() + if err := notifyUser("model warmup", "loading model: "+chatBody.Model); err != nil { + logger.Debug("failed to notify user", "error", err) + } + return nil + } // cannot send msg in editMode or botRespMode if event.Key() == tcell.KeyEscape && !editMode && !botRespMode { msgText := textArea.GetText() -- cgit v1.2.3 From 67ea1aef0dafb9dc6f82e009cc1ecc613f71e520 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Fri, 19 Dec 2025 11:06:22 +0300 Subject: Feat: two agent types; WebAgentB impl --- tui.go | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) (limited to 'tui.go') diff --git a/tui.go b/tui.go index 53c8cfd..d3ce14e 100644 --- a/tui.go +++ b/tui.go @@ -18,21 +18,21 @@ import ( ) var ( - app *tview.Application - pages *tview.Pages - textArea *tview.TextArea - editArea *tview.TextArea - textView *tview.TextView + app *tview.Application + pages *tview.Pages + textArea *tview.TextArea + editArea *tview.TextArea + textView *tview.TextView statusLineWidget *tview.TextView - helpView *tview.TextView - flex *tview.Flex - imgView *tview.Image - defaultImage = "sysprompts/llama.png" - indexPickWindow *tview.InputField - renameWindow *tview.InputField - roleEditWindow *tview.InputField - fullscreenMode bool - positionVisible bool = true + helpView *tview.TextView + flex *tview.Flex + imgView *tview.Image + defaultImage = "sysprompts/llama.png" + indexPickWindow *tview.InputField + renameWindow *tview.InputField + roleEditWindow *tview.InputField + fullscreenMode bool + positionVisible bool = true // pages historyPage = "historyPage" agentPage = "agentPage" @@ -984,12 +984,14 @@ func init() { if len(ORFreeModels) > 0 { currentORModelIndex = (currentORModelIndex + 1) % len(ORFreeModels) chatBody.Model = ORFreeModels[currentORModelIndex] + cfg.CurrentModel = chatBody.Model } updateStatusLine() } else { if len(LocalModels) > 0 { currentLocalModelIndex = (currentLocalModelIndex + 1) % len(LocalModels) chatBody.Model = LocalModels[currentLocalModelIndex] + cfg.CurrentModel = chatBody.Model } updateStatusLine() // // For non-OpenRouter APIs, use the old logic -- cgit v1.2.3 From ba3330ee54bcab5cfde470f8e465fc9ed1c6cb2c Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 20 Dec 2025 14:21:40 +0300 Subject: Fix: model load if llama.cpp started after gf-lt --- tui.go | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tui.go') diff --git a/tui.go b/tui.go index d3ce14e..4313d26 100644 --- a/tui.go +++ b/tui.go @@ -12,11 +12,14 @@ import ( "path" "strconv" "strings" + "sync" "github.com/gdamore/tcell/v2" "github.com/rivo/tview" ) +var _ = sync.RWMutex{} + var ( app *tview.Application pages *tview.Pages @@ -988,11 +991,13 @@ func init() { } updateStatusLine() } else { + localModelsMu.RLock() if len(LocalModels) > 0 { currentLocalModelIndex = (currentLocalModelIndex + 1) % len(LocalModels) chatBody.Model = LocalModels[currentLocalModelIndex] cfg.CurrentModel = chatBody.Model } + localModelsMu.RUnlock() updateStatusLine() // // For non-OpenRouter APIs, use the old logic // go func() { -- cgit v1.2.3