Refactor: rag to sep package

This commit is contained in:
Grail Finder
2025-01-05 20:51:31 +03:00
parent 4736e43631
commit b822b3a161
6 changed files with 282 additions and 248 deletions

8
tui.go
View File

@@ -5,6 +5,7 @@ import (
"elefant/pngmeta"
"fmt"
"os"
"path"
"strconv"
"strings"
"time"
@@ -169,8 +170,9 @@ func makeRAGTable(fileList []string) *tview.Table {
// notification := fmt.Sprintf("chat: %s; action: %s", fpath, tc.Text)
switch tc.Text {
case "load":
if err := loadRAG(fpath); err != nil {
logger.Error("failed to read history file", "chat", fpath)
fpath = path.Join(cfg.RAGDir, fpath)
if err := ragger.LoadRAG(fpath); err != nil {
logger.Error("failed to embed file", "chat", fpath, "error", err)
pages.RemovePage(RAGPage)
return
}
@@ -228,7 +230,7 @@ func colorText() {
}
func updateStatusLine() {
position.SetText(fmt.Sprintf(indexLine, botRespMode, cfg.AssistantRole, activeChatName, cfg.RAGEnabled))
position.SetText(fmt.Sprintf(indexLine, botRespMode, cfg.AssistantRole, activeChatName, cfg.RAGEnabled, cfg.EmbedURL))
}
func initSysCards() ([]string, error) {