Chore: status line, linter complaints
This commit is contained in:
20
helpfuncs.go
20
helpfuncs.go
@@ -354,10 +354,15 @@ func makeStatusLine() string {
|
|||||||
}
|
}
|
||||||
// Get model color based on load status for local llama.cpp models
|
// Get model color based on load status for local llama.cpp models
|
||||||
modelColor := getModelColor()
|
modelColor := getModelColor()
|
||||||
statusLine := fmt.Sprintf(indexLineCompletion, boolColors[botRespMode], botRespMode, activeChatName,
|
statusLine := fmt.Sprintf(statusLineTempl, boolColors[botRespMode], botRespMode, activeChatName,
|
||||||
boolColors[cfg.ToolUse], cfg.ToolUse, modelColor, chatBody.Model, boolColors[cfg.SkipLLMResp],
|
boolColors[cfg.ToolUse], cfg.ToolUse, modelColor, chatBody.Model, boolColors[cfg.SkipLLMResp],
|
||||||
cfg.SkipLLMResp, cfg.CurrentAPI, boolColors[isRecording], isRecording, persona,
|
cfg.SkipLLMResp, cfg.CurrentAPI, boolColors[isRecording], isRecording, persona,
|
||||||
botPersona, boolColors[injectRole], injectRole)
|
botPersona)
|
||||||
|
// completion endpoint
|
||||||
|
if !strings.Contains(cfg.CurrentAPI, "chat") {
|
||||||
|
roleInject := fmt.Sprintf(" | role injection [%s:-:b]%v[-:-:-] (alt+7)", boolColors[injectRole], injectRole)
|
||||||
|
statusLine += roleInject
|
||||||
|
}
|
||||||
return statusLine + imageInfo + shellModeInfo
|
return statusLine + imageInfo + shellModeInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -741,7 +746,6 @@ func scanFiles(dir, filter string) []string {
|
|||||||
const maxDepth = 3
|
const maxDepth = 3
|
||||||
const maxFiles = 50
|
const maxFiles = 50
|
||||||
var files []string
|
var files []string
|
||||||
|
|
||||||
var scanRecursive func(currentDir string, currentDepth int, relPath string)
|
var scanRecursive func(currentDir string, currentDepth int, relPath string)
|
||||||
scanRecursive = func(currentDir string, currentDepth int, relPath string) {
|
scanRecursive = func(currentDir string, currentDepth int, relPath string) {
|
||||||
if len(files) >= maxFiles {
|
if len(files) >= maxFiles {
|
||||||
@@ -750,39 +754,33 @@ func scanFiles(dir, filter string) []string {
|
|||||||
if currentDepth > maxDepth {
|
if currentDepth > maxDepth {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
entries, err := os.ReadDir(currentDir)
|
entries, err := os.ReadDir(currentDir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
if len(files) >= maxFiles {
|
if len(files) >= maxFiles {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
name := entry.Name()
|
name := entry.Name()
|
||||||
if strings.HasPrefix(name, ".") {
|
if strings.HasPrefix(name, ".") {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
fullPath := name
|
fullPath := name
|
||||||
if relPath != "" {
|
if relPath != "" {
|
||||||
fullPath = relPath + "/" + name
|
fullPath = relPath + "/" + name
|
||||||
}
|
}
|
||||||
|
|
||||||
if entry.IsDir() {
|
if entry.IsDir() {
|
||||||
// Recursively scan subdirectories
|
// Recursively scan subdirectories
|
||||||
scanRecursive(filepath.Join(currentDir, name), currentDepth+1, fullPath)
|
scanRecursive(filepath.Join(currentDir, name), currentDepth+1, fullPath)
|
||||||
} else {
|
continue
|
||||||
|
}
|
||||||
// Check if file matches filter
|
// Check if file matches filter
|
||||||
if filter == "" || strings.HasPrefix(strings.ToLower(fullPath), strings.ToLower(filter)) {
|
if filter == "" || strings.HasPrefix(strings.ToLower(fullPath), strings.ToLower(filter)) {
|
||||||
files = append(files, fullPath)
|
files = append(files, fullPath)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
scanRecursive(dir, 0, "")
|
scanRecursive(dir, 0, "")
|
||||||
return files
|
return files
|
||||||
}
|
}
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -13,7 +13,7 @@ var (
|
|||||||
selectedIndex = int(-1)
|
selectedIndex = int(-1)
|
||||||
shellMode = false
|
shellMode = false
|
||||||
thinkingCollapsed = false
|
thinkingCollapsed = false
|
||||||
indexLineCompletion = "F12 to show keys help | llm turn: [%s:-:b]%v[-:-:-] (F6) | chat: [orange:-:b]%s[-:-:-] (F1) | toolUseAdviced: [%s:-:b]%v[-:-:-] (ctrl+k) | model: [%s:-:b]%s[-:-:-] (ctrl+l) | skip LLM resp: [%s:-:b]%v[-:-:-] (F10)\nAPI: [orange:-:b]%s[-:-:-] (ctrl+v) | recording: [%s:-:b]%v[-:-:-] (ctrl+r) | writing as: [orange:-:b]%s[-:-:-] (ctrl+q) | bot will write as [orange:-:b]%s[-:-:-] (ctrl+x) | role injection (alt+7) [%s:-:b]%v[-:-:-]"
|
statusLineTempl = "help (F12) | llm turn: [%s:-:b]%v[-:-:-] (F6) | chat: [orange:-:b]%s[-:-:-] (F1) |tool-use: [%s:-:b]%v[-:-:-] (ctrl+k) | model: [%s:-:b]%s[-:-:-] (ctrl+l) | skip LLM resp: [%s:-:b]%v[-:-:-] (F10)\nAPI: [orange:-:b]%s[-:-:-] (ctrl+v) | voice recording: [%s:-:b]%v[-:-:-] (ctrl+r) | writing as: [orange:-:b]%s[-:-:-] (ctrl+q) | bot will write as [orange:-:b]%s[-:-:-] (ctrl+x)"
|
||||||
focusSwitcher = map[tview.Primitive]tview.Primitive{}
|
focusSwitcher = map[tview.Primitive]tview.Primitive{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -388,7 +388,7 @@ func showFileCompletionPopup(filter string) {
|
|||||||
app.SetFocus(widget)
|
app.SetFocus(widget)
|
||||||
}
|
}
|
||||||
|
|
||||||
func updateWidgetColors(theme tview.Theme) {
|
func updateWidgetColors(theme *tview.Theme) {
|
||||||
bgColor := theme.PrimitiveBackgroundColor
|
bgColor := theme.PrimitiveBackgroundColor
|
||||||
fgColor := theme.PrimaryTextColor
|
fgColor := theme.PrimaryTextColor
|
||||||
borderColor := theme.BorderColor
|
borderColor := theme.BorderColor
|
||||||
@@ -476,7 +476,7 @@ func showColorschemeSelectionPopup() {
|
|||||||
tview.Styles = theme
|
tview.Styles = theme
|
||||||
go func() {
|
go func() {
|
||||||
app.QueueUpdateDraw(func() {
|
app.QueueUpdateDraw(func() {
|
||||||
updateWidgetColors(theme)
|
updateWidgetColors(&theme)
|
||||||
})
|
})
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1046,6 +1046,7 @@ func makeFilePicker() *tview.Flex {
|
|||||||
if bracketPos := strings.Index(itemText, " ["); bracketPos != -1 {
|
if bracketPos := strings.Index(itemText, " ["); bracketPos != -1 {
|
||||||
actualItemName = itemText[:bracketPos]
|
actualItemName = itemText[:bracketPos]
|
||||||
}
|
}
|
||||||
|
// nolint: gocritic
|
||||||
if strings.HasPrefix(actualItemName, "../") {
|
if strings.HasPrefix(actualItemName, "../") {
|
||||||
targetDir = path.Dir(currentDisplayDir)
|
targetDir = path.Dir(currentDisplayDir)
|
||||||
} else if strings.HasSuffix(actualItemName, "/") {
|
} else if strings.HasSuffix(actualItemName, "/") {
|
||||||
|
|||||||
1
tui.go
1
tui.go
@@ -835,6 +835,7 @@ func init() {
|
|||||||
lastMsg := chatBody.Messages[len(chatBody.Messages)-1]
|
lastMsg := chatBody.Messages[len(chatBody.Messages)-1]
|
||||||
cleanedText := models.CleanText(lastMsg.Content)
|
cleanedText := models.CleanText(lastMsg.Content)
|
||||||
if cleanedText != "" {
|
if cleanedText != "" {
|
||||||
|
// nolint: errcheck
|
||||||
go orator.Speak(cleanedText)
|
go orator.Speak(cleanedText)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user