Chore: linter complaints

This commit is contained in:
Grail Finder
2026-02-06 12:42:06 +03:00
parent 478a505869
commit 4af866079c
12 changed files with 98 additions and 91 deletions

View File

@@ -30,7 +30,7 @@ func makeChatTable(chatMap map[string]models.Chat) *tview.Table {
// Add header row (row 0)
for c := 0; c < cols; c++ {
color := tcell.ColorWhite
headerText := ""
var headerText string
switch c {
case 0:
headerText = "Chat Name"
@@ -259,19 +259,20 @@ func makeRAGTable(fileList []string) *tview.Flex {
for r := 0; r < rows; r++ {
for c := 0; c < cols; c++ {
color := tcell.ColorWhite
if c < 1 {
switch {
case c < 1:
fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0
tview.NewTableCell(fileList[r]).
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else if c == 1 { // Action description column - not selectable
case c == 1: // Action description column - not selectable
fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0
tview.NewTableCell("(Action)").
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else { // Action button column - selectable
default: // Action button column - selectable
fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0
tview.NewTableCell(actions[c-1]).
SetTextColor(color).
@@ -406,19 +407,20 @@ func makeLoadedRAGTable(fileList []string) *tview.Flex {
for r := 0; r < rows; r++ {
for c := 0; c < cols; c++ {
color := tcell.ColorWhite
if c < 1 {
switch {
case c < 1:
fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0
tview.NewTableCell(fileList[r]).
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else if c == 1 { // Action description column - not selectable
case c == 1: // Action description column - not selectable
fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0
tview.NewTableCell("(Action)").
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else { // Action button column - selectable
default: // Action button column - selectable
fileTable.SetCell(r+1, c, // +1 to account for the exit row at index 0
tview.NewTableCell(actions[c-1]).
SetTextColor(color).
@@ -487,13 +489,14 @@ func makeAgentTable(agentList []string) *tview.Table {
for r := 0; r < rows; r++ {
for c := 0; c < cols; c++ {
color := tcell.ColorWhite
if c < 1 {
switch {
case c < 1:
chatActTable.SetCell(r, c,
tview.NewTableCell(agentList[r]).
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else if c == 1 {
case c == 1:
if actions[c-1] == "filepath" {
cc, ok := sysMap[agentList[r]]
if !ok {
@@ -510,7 +513,7 @@ func makeAgentTable(agentList []string) *tview.Table {
tview.NewTableCell(actions[c-1]).
SetTextColor(color).
SetAlign(tview.AlignCenter))
} else {
default:
chatActTable.SetCell(r, c,
tview.NewTableCell(actions[c-1]).
SetTextColor(color).
@@ -600,13 +603,14 @@ func makeCodeBlockTable(codeBlocks []string) *tview.Table {
if len(codeBlocks[r]) < 30 {
previewLen = len(codeBlocks[r])
}
if c < 1 {
switch {
case c < 1:
table.SetCell(r, c,
tview.NewTableCell(codeBlocks[r][:previewLen]).
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else {
default:
table.SetCell(r, c,
tview.NewTableCell(actions[c-1]).
SetTextColor(color).
@@ -671,13 +675,14 @@ func makeImportChatTable(filenames []string) *tview.Table {
for r := 0; r < rows; r++ {
for c := 0; c < cols; c++ {
color := tcell.ColorWhite
if c < 1 {
switch {
case c < 1:
chatActTable.SetCell(r, c,
tview.NewTableCell(filenames[r]).
SetTextColor(color).
SetAlign(tview.AlignCenter).
SetSelectable(false))
} else {
default:
chatActTable.SetCell(r, c,
tview.NewTableCell(actions[c-1]).
SetTextColor(color).
@@ -861,25 +866,23 @@ func makeFilePicker() *tview.Flex {
currentStackPos = len(dirStack) - 1
statusView.SetText("Current: " + newDir)
})
} else {
} else if hasAllowedExtension(name) {
// Only show files that have allowed extensions (from config)
if hasAllowedExtension(name) {
// Capture the file name for the closure to avoid loop variable issues
fileName := name
fullFilePath := path.Join(dir, fileName)
listView.AddItem(fileName+" [gray](File)[-]", "", 0, func() {
selectedFile = fullFilePath
// Capture the file name for the closure to avoid loop variable issues
fileName := name
fullFilePath := path.Join(dir, fileName)
listView.AddItem(fileName+" [gray](File)[-]", "", 0, func() {
selectedFile = fullFilePath
statusView.SetText("Selected: " + selectedFile)
// Check if the file is an image
if isImageFile(fileName) {
// For image files, offer to attach to the next LLM message
statusView.SetText("Selected image: " + selectedFile)
} else {
// For non-image files, display as before
statusView.SetText("Selected: " + selectedFile)
// Check if the file is an image
if isImageFile(fileName) {
// For image files, offer to attach to the next LLM message
statusView.SetText("Selected image: " + selectedFile)
} else {
// For non-image files, display as before
statusView.SetText("Selected: " + selectedFile)
}
})
}
}
})
}
}
statusView.SetText("Current: " + dir)