From c12311da999be4cafba5d41075ee8108567511db Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Wed, 18 Feb 2026 08:42:05 +0300 Subject: Chore: linter complaints --- .gitignore | 1 - helpfuncs.go | 8 ++++---- llm.go | 12 ++++++------ models/models.go | 5 +++-- tables.go | 7 ++++--- tui.go | 2 +- 6 files changed, 18 insertions(+), 17 deletions(-) diff --git a/.gitignore b/.gitignore index 472ea7d..a9c7d3f 100644 --- a/.gitignore +++ b/.gitignore @@ -5,7 +5,6 @@ history/ *.db config.toml sysprompts/* -!sysprompts/cluedo.json !sysprompts/alice_bob_carl.json history_bak/ .aider* diff --git a/helpfuncs.go b/helpfuncs.go index 810b577..9cfb662 100644 --- a/helpfuncs.go +++ b/helpfuncs.go @@ -25,13 +25,13 @@ func isASCII(s string) bool { // stripThinkingFromMsg removes thinking blocks from assistant messages. // Skips user, tool, and system messages as they may contain thinking examples. -func stripThinkingFromMsg(msg models.RoleMsg) *models.RoleMsg { +func stripThinkingFromMsg(msg *models.RoleMsg) *models.RoleMsg { if !cfg.StripThinkingFromAPI { - return &msg + return msg } // Skip user, tool, and system messages - they might contain thinking examples if msg.Role == cfg.UserRole || msg.Role == cfg.ToolRole || msg.Role == "system" { - return &msg + return msg } // Strip thinking from assistant messages if thinkRE.MatchString(msg.Content) { @@ -39,7 +39,7 @@ func stripThinkingFromMsg(msg models.RoleMsg) *models.RoleMsg { // Clean up any double newlines that might result msg.Content = strings.TrimSpace(msg.Content) } - return &msg + return msg } // refreshChatDisplay updates the chat display based on current character view diff --git a/llm.go b/llm.go index 7cce713..a648364 100644 --- a/llm.go +++ b/llm.go @@ -165,7 +165,7 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro filteredMessages, botPersona := filterMessagesForCurrentCharacter(chatBody.Messages) messages := make([]string, len(filteredMessages)) for i, m := range filteredMessages { - messages[i] = stripThinkingFromMsg(m).ToPrompt() + messages[i] = stripThinkingFromMsg(&m).ToPrompt() } prompt := strings.Join(messages, "\n") // Add multimodal media markers to the prompt text when multimodal data is present @@ -328,7 +328,7 @@ func (op LCPChat) FormMsg(msg, role string, resume bool) (io.Reader, error) { Stream: chatBody.Stream, } for i, msg := range filteredMessages { - strippedMsg := *stripThinkingFromMsg(msg) + strippedMsg := *stripThinkingFromMsg(&msg) if strippedMsg.Role == cfg.UserRole { bodyCopy.Messages[i] = strippedMsg bodyCopy.Messages[i].Role = "user" @@ -413,7 +413,7 @@ func (ds DeepSeekerCompletion) FormMsg(msg, role string, resume bool) (io.Reader filteredMessages, botPersona := filterMessagesForCurrentCharacter(chatBody.Messages) messages := make([]string, len(filteredMessages)) for i, m := range filteredMessages { - messages[i] = stripThinkingFromMsg(m).ToPrompt() + messages[i] = stripThinkingFromMsg(&m).ToPrompt() } prompt := strings.Join(messages, "\n") // strings builder? @@ -503,7 +503,7 @@ func (ds DeepSeekerChat) FormMsg(msg, role string, resume bool) (io.Reader, erro Stream: chatBody.Stream, } for i, msg := range filteredMessages { - strippedMsg := *stripThinkingFromMsg(msg) + strippedMsg := *stripThinkingFromMsg(&msg) if strippedMsg.Role == cfg.UserRole || i == 1 { bodyCopy.Messages[i] = strippedMsg bodyCopy.Messages[i].Role = "user" @@ -579,7 +579,7 @@ func (or OpenRouterCompletion) FormMsg(msg, role string, resume bool) (io.Reader filteredMessages, botPersona := filterMessagesForCurrentCharacter(chatBody.Messages) messages := make([]string, len(filteredMessages)) for i, m := range filteredMessages { - messages[i] = stripThinkingFromMsg(m).ToPrompt() + messages[i] = stripThinkingFromMsg(&m).ToPrompt() } prompt := strings.Join(messages, "\n") // strings builder? @@ -700,7 +700,7 @@ func (or OpenRouterChat) FormMsg(msg, role string, resume bool) (io.Reader, erro Stream: chatBody.Stream, } for i, msg := range filteredMessages { - strippedMsg := *stripThinkingFromMsg(msg) + strippedMsg := *stripThinkingFromMsg(&msg) bodyCopy.Messages[i] = strippedMsg // Standardize role if it's a user role if bodyCopy.Messages[i].Role == cfg.UserRole { diff --git a/models/models.go b/models/models.go index 13c024e..8f42795 100644 --- a/models/models.go +++ b/models/models.go @@ -206,13 +206,14 @@ func (m *RoleMsg) ToText(i int) string { imageIndicators = append(imageIndicators, fmt.Sprintf("[orange::i][image: %s][-:-:-]", displayPath)) case map[string]any: if partType, exists := p["type"]; exists { - if partType == "text" { + switch partType { + case "text": if textVal, textExists := p["text"]; textExists { if textStr, isStr := textVal.(string); isStr { textParts = append(textParts, textStr) } } - } else if partType == "image_url" { + case "image_url": // Handle unmarshaled image content var displayPath string if pathVal, pathExists := p["path"]; pathExists { diff --git a/tables.go b/tables.go index 239811c..086bdf7 100644 --- a/tables.go +++ b/tables.go @@ -928,11 +928,12 @@ func makeFilePicker() *tview.Flex { } } // Update status line based on search state - if searching { + switch { + case searching: statusView.SetText("Search: " + searchQuery + "_") - } else if searchQuery != "" { + case searchQuery != "": statusView.SetText("Current: " + dir + " (filter: " + searchQuery + ")") - } else { + default: statusView.SetText("Current: " + dir) } } diff --git a/tui.go b/tui.go index 2883511..0413a83 100644 --- a/tui.go +++ b/tui.go @@ -841,7 +841,7 @@ func init() { if thinkingCollapsed { status = "collapsed" } - if err := notifyUser("thinking", fmt.Sprintf("Thinking blocks %s", status)); err != nil { + if err := notifyUser("thinking", "Thinking blocks "+status); err != nil { logger.Error("failed to send notification", "error", err) } return nil -- cgit v1.2.3