Chore: linter complaints
This commit is contained in:
9
llm.go
9
llm.go
@@ -3,10 +3,10 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"errors"
|
||||||
"gf-lt/models"
|
"gf-lt/models"
|
||||||
"io"
|
"io"
|
||||||
"strings"
|
"strings"
|
||||||
"fmt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var imageAttachmentPath string // Global variable to track image attachment for next message
|
var imageAttachmentPath string // Global variable to track image attachment for next message
|
||||||
@@ -98,7 +98,7 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro
|
|||||||
multimodalData = append(multimodalData, parts[1])
|
multimodalData = append(multimodalData, parts[1])
|
||||||
} else {
|
} else {
|
||||||
logger.Error("invalid image data URL format", "url", imageURL)
|
logger.Error("invalid image data URL format", "url", imageURL)
|
||||||
return nil, fmt.Errorf("invalid image data URL format")
|
return nil, errors.New("invalid image data URL format")
|
||||||
}
|
}
|
||||||
imageAttachmentPath = "" // Clear the attachment after use
|
imageAttachmentPath = "" // Clear the attachment after use
|
||||||
}
|
}
|
||||||
@@ -143,9 +143,12 @@ func (lcp LCPCompletion) FormMsg(msg, role string, resume bool) (io.Reader, erro
|
|||||||
// This is required by llama.cpp multimodal models so they know where to insert media
|
// This is required by llama.cpp multimodal models so they know where to insert media
|
||||||
if len(multimodalData) > 0 {
|
if len(multimodalData) > 0 {
|
||||||
// Add a media marker for each item in the multimodal data
|
// Add a media marker for each item in the multimodal data
|
||||||
|
var sb strings.Builder
|
||||||
|
sb.WriteString(prompt)
|
||||||
for range multimodalData {
|
for range multimodalData {
|
||||||
prompt += " <__media__>" // llama.cpp default multimodal marker
|
sb.WriteString(" <__media__>") // llama.cpp default multimodal marker
|
||||||
}
|
}
|
||||||
|
prompt = sb.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.Debug("checking prompt for /completion", "tool_use", cfg.ToolUse,
|
logger.Debug("checking prompt for /completion", "tool_use", cfg.ToolUse,
|
||||||
|
|||||||
7
tools.go
7
tools.go
@@ -596,13 +596,6 @@ var globalTodoList = TodoList{
|
|||||||
Items: []TodoItem{},
|
Items: []TodoItem{},
|
||||||
}
|
}
|
||||||
|
|
||||||
func getTodoList() TodoList {
|
|
||||||
return globalTodoList
|
|
||||||
}
|
|
||||||
|
|
||||||
func setTodoList(todoList TodoList) {
|
|
||||||
globalTodoList = todoList
|
|
||||||
}
|
|
||||||
|
|
||||||
// Todo Management Tools
|
// Todo Management Tools
|
||||||
func todoCreate(args map[string]string) []byte {
|
func todoCreate(args map[string]string) []byte {
|
||||||
|
|||||||
6
tui.go
6
tui.go
@@ -37,7 +37,6 @@ var (
|
|||||||
agentPage = "agentPage"
|
agentPage = "agentPage"
|
||||||
editMsgPage = "editMsgPage"
|
editMsgPage = "editMsgPage"
|
||||||
roleEditPage = "roleEditPage"
|
roleEditPage = "roleEditPage"
|
||||||
indexPage = "indexPage"
|
|
||||||
helpPage = "helpPage"
|
helpPage = "helpPage"
|
||||||
renamePage = "renamePage"
|
renamePage = "renamePage"
|
||||||
RAGPage = "RAGPage"
|
RAGPage = "RAGPage"
|
||||||
@@ -563,7 +562,8 @@ func init() {
|
|||||||
SetLabel("Enter new role: ").
|
SetLabel("Enter new role: ").
|
||||||
SetPlaceholder("e.g., user, assistant, system, tool").
|
SetPlaceholder("e.g., user, assistant, system, tool").
|
||||||
SetDoneFunc(func(key tcell.Key) {
|
SetDoneFunc(func(key tcell.Key) {
|
||||||
if key == tcell.KeyEnter {
|
switch key {
|
||||||
|
case tcell.KeyEnter:
|
||||||
newRole := roleEditWindow.GetText()
|
newRole := roleEditWindow.GetText()
|
||||||
if newRole == "" {
|
if newRole == "" {
|
||||||
if err := notifyUser("edit", "no role provided"); err != nil {
|
if err := notifyUser("edit", "no role provided"); err != nil {
|
||||||
@@ -578,7 +578,7 @@ func init() {
|
|||||||
colorText()
|
colorText()
|
||||||
pages.RemovePage(roleEditPage)
|
pages.RemovePage(roleEditPage)
|
||||||
}
|
}
|
||||||
} else if key == tcell.KeyEscape {
|
case tcell.KeyEscape:
|
||||||
pages.RemovePage(roleEditPage)
|
pages.RemovePage(roleEditPage)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user