From 436f9596ee4f7bae60cabb7c3ef4674f6d34f313 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 18 Oct 2025 10:52:56 +0300 Subject: Enha: ragdir --- .gitignore | 1 + tui.go | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/.gitignore b/.gitignore index 8377edb..3cd29c8 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ tags gf-lt gflt chat_exports/*.json +ragimport diff --git a/tui.go b/tui.go index fa9d296..d97a9f3 100644 --- a/tui.go +++ b/tui.go @@ -73,6 +73,7 @@ var ( [yellow]Ctrl+j[white]: if chat agent is char.png will show the image; then any key to return [yellow]Ctrl+a[white]: interrupt tts (needs tts server) [yellow]Ctrl+q[white]: cycle through mentioned chars in chat, to pick persona to send next msg as +[yellow]Ctrl+x[white]: cycle through mentioned chars in chat, to pick persona to send next msg as (for llm) Press Enter to go back ` @@ -900,6 +901,29 @@ func init() { updateStatusLine() return nil } + if event.Key() == tcell.KeyCtrlG { + // cfg.RAGDir is the directory with files to use with RAG + // rag load + // menu of the text files from defined rag directory + files, err := os.ReadDir(cfg.RAGDir) + if err != nil { + logger.Error("failed to read dir", "dir", cfg.RAGDir, "error", err) + if notifyerr := notifyUser("failed to open RAG files dir", err.Error()); notifyerr != nil { + logger.Error("failed to send notification", "error", notifyerr) + } + return nil + } + fileList := []string{} + for _, f := range files { + if f.IsDir() { + continue + } + fileList = append(fileList, f.Name()) + } + chatRAGTable := makeRAGTable(fileList) + pages.AddPage(RAGPage, chatRAGTable, true, true) + return nil + } // cannot send msg in editMode or botRespMode if event.Key() == tcell.KeyEscape && !editMode && !botRespMode { // read all text into buffer -- cgit v1.2.3