Chore: linter complaints
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,7 +5,6 @@ history/
|
||||
*.db
|
||||
config.toml
|
||||
sysprompts/*
|
||||
!sysprompts/cluedo.json
|
||||
!sysprompts/alice_bob_carl.json
|
||||
history_bak/
|
||||
.aider*
|
||||
|
||||
@@ -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
|
||||
|
||||
12
llm.go
12
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 {
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
2
tui.go
2
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
|
||||
|
||||
Reference in New Issue
Block a user