summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md9
-rw-r--r--main.go2
-rw-r--r--tui.go34
3 files changed, 39 insertions, 6 deletions
diff --git a/README.md b/README.md
index cfbe3a5..5547d1d 100644
--- a/README.md
+++ b/README.md
@@ -15,20 +15,21 @@
- define tools and sys prompt for them to be used; +
- add system prompt without tools (for mistral); +
- option to switch between predefined sys prompts; +
-- sqlite for the bot memory;
+- sqlite for the bot memory; +
+- rename current chat; +
- fullscreen textarea option (bothersome to implement);
- consider adding use /completion of llamacpp, since openai endpoint clearly has template|format issues;
- change temp, min-p and other params from tui;
- help page with all key bindings;
-- rename current chat;
+- default config file (api url, path to sysprompts, path to log, limits, etc);
### FIX:
- bot responding (or haninging) blocks everything; +
- programm requires history folder, but it is .gitignore; +
- at first run chat table does not exist; run migrations sql on startup; +
- Tab is needed to copy paste text into textarea box, use shift+tab to switch focus; (changed tp pgup) +
-- delete last msg: can have unexpected behavior (deletes what appears to be two messages if last bot msg was not generated (should only delete icon in that case));
-- empty input to continue bot msg gens new msg index and bot icon;
- sometimes bots put additional info around the tool call, have a regexp to match tool call; +
- remove all panics from code; +
+- delete last msg: can have unexpected behavior (deletes what appears to be two messages if last bot msg was not generated (should only delete icon in that case));
+- empty input to continue bot msg gens new msg index and bot icon;
- new chat replaces old ones in db;
diff --git a/main.go b/main.go
index 46cb42c..12575f0 100644
--- a/main.go
+++ b/main.go
@@ -11,7 +11,7 @@ var (
editMode = false
botMsg = "no"
selectedIndex = int(-1)
- indexLine = "Esc: send msg; PgUp/Down: switch focus; F1: manage chats; F2: regen last; F3:delete last msg; F4: edit msg; F5: toggle system; F6: interrupt bot resp; bot resp mode: %v; current chat: %s"
+ indexLine = "F12 to show keys help; bot resp mode: %v; current chat: %s"
focusSwitcher = map[tview.Primitive]tview.Primitive{}
)
diff --git a/tui.go b/tui.go
index ba12e6d..9984a07 100644
--- a/tui.go
+++ b/tui.go
@@ -17,11 +17,26 @@ var (
editArea *tview.TextArea
textView *tview.TextView
position *tview.TextView
+ helpView *tview.TextView
flex *tview.Flex
chatActModal *tview.Modal
sysModal *tview.Modal
indexPickWindow *tview.InputField
renameWindow *tview.InputField
+ helpText = `
+[yellow]Esc[white]: send msg
+[yellow]PgUp/Down[white]: switch focus
+[yellow]F1[white]: manage chats
+[yellow]F2[white]: regen last
+[yellow]F3[white]: delete last msg
+[yellow]F4[white]: edit msg
+[yellow]F5[white]: toggle system
+[yellow]F6[white]: interrupt bot resp
+[yellow]F7[white]: copy msg to clipboard (linux xclip)
+[yellow]Ctrl+s[white]: choose/replace system prompt
+
+Press Enter to go back
+`
)
func init() {
@@ -74,7 +89,7 @@ func init() {
chatBody.Messages = defaultStarter
textView.SetText(chatToText(showSystemMsgs))
newChat := &models.Chat{
- ID: id,
+ ID: id + 1,
Name: fmt.Sprintf("%v_%v", "new", time.Now().Unix()),
Msgs: string(defaultStarterBytes),
}
@@ -209,6 +224,18 @@ func init() {
return event
})
//
+ helpView = tview.NewTextView().SetDynamicColors(true).SetText(helpText).SetDoneFunc(func(key tcell.Key) {
+ pages.RemovePage("helpView")
+ return
+ })
+ helpView.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
+ switch event.Key() {
+ case tcell.KeyEsc, tcell.KeyEnter:
+ return event
+ }
+ return nil
+ })
+ //
textArea.SetMovedFunc(updateStatusLine)
updateStatusLine()
textView.SetText(chatToText(showSystemMsgs))
@@ -271,6 +298,11 @@ func init() {
pages.AddPage("getIndex", indexPickWindow, true, true)
return nil
}
+ if event.Key() == tcell.KeyF12 {
+ // help window cheatsheet
+ pages.AddPage("helpView", helpView, true, true)
+ return nil
+ }
if event.Key() == tcell.KeyCtrlE {
textArea.SetText("pressed ctrl+e", true)
return nil