summaryrefslogtreecommitdiff
path: root/tui.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-02-01 16:32:36 +0300
committerGrail Finder <wohilas@gmail.com>2025-02-01 16:32:36 +0300
commit84c94ecea34753f246bdfd51f6ff989281e873e3 (patch)
tree3e4330ed00811cd46299968af69e6f3671316aa6 /tui.go
parent336451340b86ba1f713b47d44225df61058f5a8f (diff)
Feat: switch between completion and chat api
Diffstat (limited to 'tui.go')
-rw-r--r--tui.go24
1 files changed, 19 insertions, 5 deletions
diff --git a/tui.go b/tui.go
index 53d1c10..4bb3f08 100644
--- a/tui.go
+++ b/tui.go
@@ -3,7 +3,6 @@ package main
import (
"elefant/models"
"elefant/pngmeta"
- "elefant/rag"
"fmt"
"os"
"strconv"
@@ -41,7 +40,7 @@ var (
// help text
helpText = `
[yellow]Esc[white]: send msg
-[yellow]PgUp/Down[white]: switch focus
+[yellow]PgUp/Down[white]: switch focus between input and chat widgets
[yellow]F1[white]: manage chats
[yellow]F2[white]: regen last
[yellow]F3[white]: delete last msg
@@ -50,13 +49,16 @@ var (
[yellow]F6[white]: interrupt bot resp
[yellow]F7[white]: copy last msg to clipboard (linux xclip)
[yellow]F8[white]: copy n msg to clipboard (linux xclip)
-[yellow]F10[white]: manage loaded rag files
+[yellow]F10[white]: manage loaded rag files (that already in vector db)
[yellow]F11[white]: switch RAGEnabled boolean
[yellow]F12[white]: show this help page
[yellow]Ctrl+s[white]: load new char/agent
[yellow]Ctrl+e[white]: export chat to json file
[yellow]Ctrl+n[white]: start a new chat
[yellow]Ctrl+c[white]: close programm
+[yellow]Ctrl+p[white]: props edit form (min-p, dry, etc.)
+[yellow]Ctrl+v[white]: switch between /completion and /chat api (if provided in config)
+[yellow]Ctrl+r[white]: menu of files that can be loaded in vector db (RAG)
Press Enter to go back
`
@@ -87,7 +89,7 @@ func colorText() {
}
func updateStatusLine() {
- position.SetText(fmt.Sprintf(indexLine, botRespMode, cfg.AssistantRole, activeChatName, cfg.RAGEnabled, cfg.ToolUse, currentModel))
+ position.SetText(fmt.Sprintf(indexLine, botRespMode, cfg.AssistantRole, activeChatName, cfg.RAGEnabled, cfg.ToolUse, currentModel, cfg.CurrentAPI))
}
func initSysCards() ([]string, error) {
@@ -473,6 +475,19 @@ func init() {
startNewChat()
return nil
}
+ if event.Key() == tcell.KeyCtrlV {
+ // switch between /chat and /completion api
+ prevAPI := cfg.CurrentAPI
+ newAPI := cfg.APIMap[cfg.CurrentAPI]
+ if newAPI == "" {
+ // do not switch
+ return nil
+ }
+ cfg.APIMap[newAPI] = prevAPI
+ cfg.CurrentAPI = newAPI
+ updateStatusLine()
+ return nil
+ }
if event.Key() == tcell.KeyCtrlS {
// switch sys prompt
labels, err := initSysCards()
@@ -505,7 +520,6 @@ func init() {
}
fileList = append(fileList, f.Name())
}
- rag.LongJobStatusCh <- "first msg"
chatRAGTable := makeRAGTable(fileList)
pages.AddPage(RAGPage, chatRAGTable, true, true)
return nil