Chore: linter complaints
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -5,7 +5,6 @@ history/
|
|||||||
*.db
|
*.db
|
||||||
config.toml
|
config.toml
|
||||||
sysprompts/*
|
sysprompts/*
|
||||||
!sysprompts/cluedo.json
|
|
||||||
!sysprompts/alice_bob_carl.json
|
!sysprompts/alice_bob_carl.json
|
||||||
history_bak/
|
history_bak/
|
||||||
.aider*
|
.aider*
|
||||||
|
|||||||
@@ -25,13 +25,13 @@ func isASCII(s string) bool {
|
|||||||
|
|
||||||
// stripThinkingFromMsg removes thinking blocks from assistant messages.
|
// stripThinkingFromMsg removes thinking blocks from assistant messages.
|
||||||
// Skips user, tool, and system messages as they may contain thinking examples.
|
// 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 {
|
if !cfg.StripThinkingFromAPI {
|
||||||
return &msg
|
return msg
|
||||||
}
|
}
|
||||||
// Skip user, tool, and system messages - they might contain thinking examples
|
// Skip user, tool, and system messages - they might contain thinking examples
|
||||||
if msg.Role == cfg.UserRole || msg.Role == cfg.ToolRole || msg.Role == "system" {
|
if msg.Role == cfg.UserRole || msg.Role == cfg.ToolRole || msg.Role == "system" {
|
||||||
return &msg
|
return msg
|
||||||
}
|
}
|
||||||
// Strip thinking from assistant messages
|
// Strip thinking from assistant messages
|
||||||
if thinkRE.MatchString(msg.Content) {
|
if thinkRE.MatchString(msg.Content) {
|
||||||
@@ -39,7 +39,7 @@ func stripThinkingFromMsg(msg models.RoleMsg) *models.RoleMsg {
|
|||||||
// Clean up any double newlines that might result
|
// Clean up any double newlines that might result
|
||||||
msg.Content = strings.TrimSpace(msg.Content)
|
msg.Content = strings.TrimSpace(msg.Content)
|
||||||
}
|
}
|
||||||
return &msg
|
return msg
|
||||||
}
|
}
|
||||||
|
|
||||||
// refreshChatDisplay updates the chat display based on current character view
|
// 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)
|
filteredMessages, botPersona := filterMessagesForCurrentCharacter(chatBody.Messages)
|
||||||
messages := make([]string, len(filteredMessages))
|
messages := make([]string, len(filteredMessages))
|
||||||
for i, m := range filteredMessages {
|
for i, m := range filteredMessages {
|
||||||
messages[i] = stripThinkingFromMsg(m).ToPrompt()
|
messages[i] = stripThinkingFromMsg(&m).ToPrompt()
|
||||||
}
|
}
|
||||||
prompt := strings.Join(messages, "\n")
|
prompt := strings.Join(messages, "\n")
|
||||||
// Add multimodal media markers to the prompt text when multimodal data is present
|
// 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,
|
Stream: chatBody.Stream,
|
||||||
}
|
}
|
||||||
for i, msg := range filteredMessages {
|
for i, msg := range filteredMessages {
|
||||||
strippedMsg := *stripThinkingFromMsg(msg)
|
strippedMsg := *stripThinkingFromMsg(&msg)
|
||||||
if strippedMsg.Role == cfg.UserRole {
|
if strippedMsg.Role == cfg.UserRole {
|
||||||
bodyCopy.Messages[i] = strippedMsg
|
bodyCopy.Messages[i] = strippedMsg
|
||||||
bodyCopy.Messages[i].Role = "user"
|
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)
|
filteredMessages, botPersona := filterMessagesForCurrentCharacter(chatBody.Messages)
|
||||||
messages := make([]string, len(filteredMessages))
|
messages := make([]string, len(filteredMessages))
|
||||||
for i, m := range filteredMessages {
|
for i, m := range filteredMessages {
|
||||||
messages[i] = stripThinkingFromMsg(m).ToPrompt()
|
messages[i] = stripThinkingFromMsg(&m).ToPrompt()
|
||||||
}
|
}
|
||||||
prompt := strings.Join(messages, "\n")
|
prompt := strings.Join(messages, "\n")
|
||||||
// strings builder?
|
// strings builder?
|
||||||
@@ -503,7 +503,7 @@ func (ds DeepSeekerChat) FormMsg(msg, role string, resume bool) (io.Reader, erro
|
|||||||
Stream: chatBody.Stream,
|
Stream: chatBody.Stream,
|
||||||
}
|
}
|
||||||
for i, msg := range filteredMessages {
|
for i, msg := range filteredMessages {
|
||||||
strippedMsg := *stripThinkingFromMsg(msg)
|
strippedMsg := *stripThinkingFromMsg(&msg)
|
||||||
if strippedMsg.Role == cfg.UserRole || i == 1 {
|
if strippedMsg.Role == cfg.UserRole || i == 1 {
|
||||||
bodyCopy.Messages[i] = strippedMsg
|
bodyCopy.Messages[i] = strippedMsg
|
||||||
bodyCopy.Messages[i].Role = "user"
|
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)
|
filteredMessages, botPersona := filterMessagesForCurrentCharacter(chatBody.Messages)
|
||||||
messages := make([]string, len(filteredMessages))
|
messages := make([]string, len(filteredMessages))
|
||||||
for i, m := range filteredMessages {
|
for i, m := range filteredMessages {
|
||||||
messages[i] = stripThinkingFromMsg(m).ToPrompt()
|
messages[i] = stripThinkingFromMsg(&m).ToPrompt()
|
||||||
}
|
}
|
||||||
prompt := strings.Join(messages, "\n")
|
prompt := strings.Join(messages, "\n")
|
||||||
// strings builder?
|
// strings builder?
|
||||||
@@ -700,7 +700,7 @@ func (or OpenRouterChat) FormMsg(msg, role string, resume bool) (io.Reader, erro
|
|||||||
Stream: chatBody.Stream,
|
Stream: chatBody.Stream,
|
||||||
}
|
}
|
||||||
for i, msg := range filteredMessages {
|
for i, msg := range filteredMessages {
|
||||||
strippedMsg := *stripThinkingFromMsg(msg)
|
strippedMsg := *stripThinkingFromMsg(&msg)
|
||||||
bodyCopy.Messages[i] = strippedMsg
|
bodyCopy.Messages[i] = strippedMsg
|
||||||
// Standardize role if it's a user role
|
// Standardize role if it's a user role
|
||||||
if bodyCopy.Messages[i].Role == cfg.UserRole {
|
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))
|
imageIndicators = append(imageIndicators, fmt.Sprintf("[orange::i][image: %s][-:-:-]", displayPath))
|
||||||
case map[string]any:
|
case map[string]any:
|
||||||
if partType, exists := p["type"]; exists {
|
if partType, exists := p["type"]; exists {
|
||||||
if partType == "text" {
|
switch partType {
|
||||||
|
case "text":
|
||||||
if textVal, textExists := p["text"]; textExists {
|
if textVal, textExists := p["text"]; textExists {
|
||||||
if textStr, isStr := textVal.(string); isStr {
|
if textStr, isStr := textVal.(string); isStr {
|
||||||
textParts = append(textParts, textStr)
|
textParts = append(textParts, textStr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if partType == "image_url" {
|
case "image_url":
|
||||||
// Handle unmarshaled image content
|
// Handle unmarshaled image content
|
||||||
var displayPath string
|
var displayPath string
|
||||||
if pathVal, pathExists := p["path"]; pathExists {
|
if pathVal, pathExists := p["path"]; pathExists {
|
||||||
|
|||||||
@@ -928,11 +928,12 @@ func makeFilePicker() *tview.Flex {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Update status line based on search state
|
// Update status line based on search state
|
||||||
if searching {
|
switch {
|
||||||
|
case searching:
|
||||||
statusView.SetText("Search: " + searchQuery + "_")
|
statusView.SetText("Search: " + searchQuery + "_")
|
||||||
} else if searchQuery != "" {
|
case searchQuery != "":
|
||||||
statusView.SetText("Current: " + dir + " (filter: " + searchQuery + ")")
|
statusView.SetText("Current: " + dir + " (filter: " + searchQuery + ")")
|
||||||
} else {
|
default:
|
||||||
statusView.SetText("Current: " + dir)
|
statusView.SetText("Current: " + dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
2
tui.go
2
tui.go
@@ -841,7 +841,7 @@ func init() {
|
|||||||
if thinkingCollapsed {
|
if thinkingCollapsed {
|
||||||
status = "collapsed"
|
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)
|
logger.Error("failed to send notification", "error", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user