summaryrefslogtreecommitdiff
path: root/tables.go
diff options
context:
space:
mode:
Diffstat (limited to 'tables.go')
-rw-r--r--tables.go106
1 files changed, 53 insertions, 53 deletions
diff --git a/tables.go b/tables.go
index 0f22321..c4c97b9 100644
--- a/tables.go
+++ b/tables.go
@@ -267,59 +267,59 @@ func makeRAGTable(fileList []string) *tview.Flex {
return ragflex
}
-func makeLoadedRAGTable(fileList []string) *tview.Table {
- actions := []string{"delete"}
- rows, cols := len(fileList), len(actions)+1
- fileTable := tview.NewTable().
- SetBorders(true)
- for r := 0; r < rows; r++ {
- for c := 0; c < cols; c++ {
- color := tcell.ColorWhite
- if c < 1 {
- fileTable.SetCell(r, c,
- tview.NewTableCell(fileList[r]).
- SetTextColor(color).
- SetAlign(tview.AlignCenter))
- } else {
- fileTable.SetCell(r, c,
- tview.NewTableCell(actions[c-1]).
- SetTextColor(color).
- SetAlign(tview.AlignCenter))
- }
- }
- }
- fileTable.Select(0, 0).SetFixed(1, 1).SetDoneFunc(func(key tcell.Key) {
- if key == tcell.KeyEsc || key == tcell.KeyF1 {
- pages.RemovePage(RAGPage)
- return
- }
- if key == tcell.KeyEnter {
- fileTable.SetSelectable(true, true)
- }
- }).SetSelectedFunc(func(row int, column int) {
- defer pages.RemovePage(RAGPage)
- tc := fileTable.GetCell(row, column)
- tc.SetTextColor(tcell.ColorRed)
- fileTable.SetSelectable(false, false)
- fpath := fileList[row]
- // notification := fmt.Sprintf("chat: %s; action: %s", fpath, tc.Text)
- switch tc.Text {
- case "delete":
- if err := ragger.RemoveFile(fpath); err != nil {
- logger.Error("failed to delete file", "filename", fpath, "error", err)
- return
- }
- if err := notifyUser("chat deleted", fpath+" was deleted"); err != nil {
- logger.Error("failed to send notification", "error", err)
- }
- return
- default:
- // pages.RemovePage(RAGPage)
- return
- }
- })
- return fileTable
-}
+// func makeLoadedRAGTable(fileList []string) *tview.Table {
+// actions := []string{"delete"}
+// rows, cols := len(fileList), len(actions)+1
+// fileTable := tview.NewTable().
+// SetBorders(true)
+// for r := 0; r < rows; r++ {
+// for c := 0; c < cols; c++ {
+// color := tcell.ColorWhite
+// if c < 1 {
+// fileTable.SetCell(r, c,
+// tview.NewTableCell(fileList[r]).
+// SetTextColor(color).
+// SetAlign(tview.AlignCenter))
+// } else {
+// fileTable.SetCell(r, c,
+// tview.NewTableCell(actions[c-1]).
+// SetTextColor(color).
+// SetAlign(tview.AlignCenter))
+// }
+// }
+// }
+// fileTable.Select(0, 0).SetFixed(1, 1).SetDoneFunc(func(key tcell.Key) {
+// if key == tcell.KeyEsc || key == tcell.KeyF1 {
+// pages.RemovePage(RAGPage)
+// return
+// }
+// if key == tcell.KeyEnter {
+// fileTable.SetSelectable(true, true)
+// }
+// }).SetSelectedFunc(func(row int, column int) {
+// defer pages.RemovePage(RAGPage)
+// tc := fileTable.GetCell(row, column)
+// tc.SetTextColor(tcell.ColorRed)
+// fileTable.SetSelectable(false, false)
+// fpath := fileList[row]
+// // notification := fmt.Sprintf("chat: %s; action: %s", fpath, tc.Text)
+// switch tc.Text {
+// case "delete":
+// if err := ragger.RemoveFile(fpath); err != nil {
+// logger.Error("failed to delete file", "filename", fpath, "error", err)
+// return
+// }
+// if err := notifyUser("chat deleted", fpath+" was deleted"); err != nil {
+// logger.Error("failed to send notification", "error", err)
+// }
+// return
+// default:
+// // pages.RemovePage(RAGPage)
+// return
+// }
+// })
+// return fileTable
+// }
func makeAgentTable(agentList []string) *tview.Table {
actions := []string{"load"}