From 8b162ef34f0755e2224c43499218def16d4b6845 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 17 Jan 2026 11:42:35 +0300 Subject: Enha: change textview chat history based on current user persona --- tables.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tables.go') diff --git a/tables.go b/tables.go index a88b501..4783cf6 100644 --- a/tables.go +++ b/tables.go @@ -119,7 +119,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { return } chatBody.Messages = history - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) activeChatName = selectedChat pages.RemovePage(historyPage) return @@ -142,7 +142,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { } // load last chat chatBody.Messages = loadOldChatOrGetNew() - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) pages.RemovePage(historyPage) return case "update card": @@ -175,7 +175,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { case "move sysprompt onto 1st msg": chatBody.Messages[1].Content = chatBody.Messages[0].Content + chatBody.Messages[1].Content chatBody.Messages[0].Content = rpDefenitionSysMsg - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) activeChatName = selectedChat pages.RemovePage(historyPage) return @@ -546,7 +546,7 @@ func makeAgentTable(agentList []string) *tview.Table { return } // replace textview - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) colorText() updateStatusLine() // sysModal.ClearButtons() @@ -715,7 +715,7 @@ func makeImportChatTable(filenames []string) *tview.Table { colorText() updateStatusLine() // redraw the text in text area - textView.SetText(chatToText(cfg.ShowSys)) + textView.SetText(chatToText(chatBody.Messages, cfg.ShowSys)) pages.RemovePage(historyPage) app.SetFocus(textArea) return -- cgit v1.2.3 From 4af866079c3f21eab12b02c3158567539ca40c50 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Fri, 6 Feb 2026 12:42:06 +0300 Subject: Chore: linter complaints --- tables.go | 65 +++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 31 deletions(-) (limited to 'tables.go') diff --git a/tables.go b/tables.go index 4783cf6..ee2b145 100644 --- a/tables.go +++ b/tables.go @@ -30,7 +30,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { // Add header row (row 0) for c := 0; c < cols; c++ { color := tcell.ColorWhite - headerText := "" + var headerText string switch c { case 0: headerText = "Chat Name" @@ -259,19 +259,20 @@ func makeRAGTable(fileList []string) *tview.Flex { for r := 0; r < rows; r++ { for c := 0; c < cols; c++ { color := tcell.ColorWhite - if c < 1 { + switch { + case c < 1: fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0 tview.NewTableCell(fileList[r]). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else if c == 1 { // Action description column - not selectable + case c == 1: // Action description column - not selectable fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0 tview.NewTableCell("(Action)"). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else { // Action button column - selectable + default: // Action button column - selectable fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0 tview.NewTableCell(actions[c-1]). SetTextColor(color). @@ -406,19 +407,20 @@ func makeLoadedRAGTable(fileList []string) *tview.Flex { for r := 0; r < rows; r++ { for c := 0; c < cols; c++ { color := tcell.ColorWhite - if c < 1 { + switch { + case c < 1: fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0 tview.NewTableCell(fileList[r]). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else if c == 1 { // Action description column - not selectable + case c == 1: // Action description column - not selectable fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0 tview.NewTableCell("(Action)"). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else { // Action button column - selectable + default: // Action button column - selectable fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0 tview.NewTableCell(actions[c-1]). SetTextColor(color). @@ -487,13 +489,14 @@ func makeAgentTable(agentList []string) *tview.Table { for r := 0; r < rows; r++ { for c := 0; c < cols; c++ { color := tcell.ColorWhite - if c < 1 { + switch { + case c < 1: chatActTable.SetCell(r, c, tview.NewTableCell(agentList[r]). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else if c == 1 { + case c == 1: if actions[c-1] == "filepath" { cc, ok := sysMap[agentList[r]] if !ok { @@ -510,7 +513,7 @@ func makeAgentTable(agentList []string) *tview.Table { tview.NewTableCell(actions[c-1]). SetTextColor(color). SetAlign(tview.AlignCenter)) - } else { + default: chatActTable.SetCell(r, c, tview.NewTableCell(actions[c-1]). SetTextColor(color). @@ -600,13 +603,14 @@ func makeCodeBlockTable(codeBlocks []string) *tview.Table { if len(codeBlocks[r]) < 30 { previewLen = len(codeBlocks[r]) } - if c < 1 { + switch { + case c < 1: table.SetCell(r, c, tview.NewTableCell(codeBlocks[r][:previewLen]). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else { + default: table.SetCell(r, c, tview.NewTableCell(actions[c-1]). SetTextColor(color). @@ -671,13 +675,14 @@ func makeImportChatTable(filenames []string) *tview.Table { for r := 0; r < rows; r++ { for c := 0; c < cols; c++ { color := tcell.ColorWhite - if c < 1 { + switch { + case c < 1: chatActTable.SetCell(r, c, tview.NewTableCell(filenames[r]). SetTextColor(color). SetAlign(tview.AlignCenter). SetSelectable(false)) - } else { + default: chatActTable.SetCell(r, c, tview.NewTableCell(actions[c-1]). SetTextColor(color). @@ -861,25 +866,23 @@ func makeFilePicker() *tview.Flex { currentStackPos = len(dirStack) - 1 statusView.SetText("Current: " + newDir) }) - } else { + } else if hasAllowedExtension(name) { // Only show files that have allowed extensions (from config) - if hasAllowedExtension(name) { - // Capture the file name for the closure to avoid loop variable issues - fileName := name - fullFilePath := path.Join(dir, fileName) - listView.AddItem(fileName+" [gray](File)[-]", "", 0, func() { - selectedFile = fullFilePath + // Capture the file name for the closure to avoid loop variable issues + fileName := name + fullFilePath := path.Join(dir, fileName) + listView.AddItem(fileName+" [gray](File)[-]", "", 0, func() { + selectedFile = fullFilePath + statusView.SetText("Selected: " + selectedFile) + // Check if the file is an image + if isImageFile(fileName) { + // For image files, offer to attach to the next LLM message + statusView.SetText("Selected image: " + selectedFile) + } else { + // For non-image files, display as before statusView.SetText("Selected: " + selectedFile) - // Check if the file is an image - if isImageFile(fileName) { - // For image files, offer to attach to the next LLM message - statusView.SetText("Selected image: " + selectedFile) - } else { - // For non-image files, display as before - statusView.SetText("Selected: " + selectedFile) - } - }) - } + } + }) } } statusView.SetText("Current: " + dir) -- cgit v1.2.3 From 67733ad8dd0151f700e9e43748fb1700101fe651 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Mon, 9 Feb 2026 10:11:56 +0300 Subject: Enha: add bool to apply card --- tables.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'tables.go') diff --git a/tables.go b/tables.go index ee2b145..740b7c8 100644 --- a/tables.go +++ b/tables.go @@ -206,7 +206,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { } // Update sysMap with fresh card data sysMap[agentName] = newCard - applyCharCard(newCard) + applyCharCard(newCard, false) startNewChat() pages.RemovePage(historyPage) return -- cgit v1.2.3 From 3f4d8a946775cfba6fc6d0ac7ade30b310bb883b Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Mon, 9 Feb 2026 11:29:47 +0300 Subject: Fix (f1): load from the card --- tables.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'tables.go') diff --git a/tables.go b/tables.go index 740b7c8..59220be 100644 --- a/tables.go +++ b/tables.go @@ -206,8 +206,8 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table { } // Update sysMap with fresh card data sysMap[agentName] = newCard - applyCharCard(newCard, false) - startNewChat() + // fetching sysprompt and first message anew from the card + startNewChat(false) pages.RemovePage(historyPage) return default: @@ -543,7 +543,7 @@ func makeAgentTable(agentList []string) *tview.Table { // notification := fmt.Sprintf("chat: %s; action: %s", selectedChat, tc.Text) switch tc.Text { case "load": - if ok := charToStart(selected); !ok { + if ok := charToStart(selected, true); !ok { logger.Warn("no such sys msg", "name", selected) pages.RemovePage(agentPage) return -- cgit v1.2.3