Enha: ragdir

This commit is contained in:
Grail Finder
2025-10-18 10:52:56 +03:00
parent 2e1b018a45
commit 436f9596ee
2 changed files with 25 additions and 0 deletions

1
.gitignore vendored
View File

@@ -12,3 +12,4 @@ tags
gf-lt
gflt
chat_exports/*.json
ragimport

24
tui.go
View File

@@ -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