Feat: add help page
This commit is contained in:
@@ -15,20 +15,21 @@
|
|||||||
- define tools and sys prompt for them to be used; +
|
- define tools and sys prompt for them to be used; +
|
||||||
- add system prompt without tools (for mistral); +
|
- add system prompt without tools (for mistral); +
|
||||||
- option to switch between predefined sys prompts; +
|
- 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);
|
- fullscreen textarea option (bothersome to implement);
|
||||||
- consider adding use /completion of llamacpp, since openai endpoint clearly has template|format issues;
|
- consider adding use /completion of llamacpp, since openai endpoint clearly has template|format issues;
|
||||||
- change temp, min-p and other params from tui;
|
- change temp, min-p and other params from tui;
|
||||||
- help page with all key bindings;
|
- help page with all key bindings;
|
||||||
- rename current chat;
|
- default config file (api url, path to sysprompts, path to log, limits, etc);
|
||||||
|
|
||||||
### FIX:
|
### FIX:
|
||||||
- bot responding (or haninging) blocks everything; +
|
- bot responding (or haninging) blocks everything; +
|
||||||
- programm requires history folder, but it is .gitignore; +
|
- programm requires history folder, but it is .gitignore; +
|
||||||
- at first run chat table does not exist; run migrations sql on startup; +
|
- 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) +
|
- 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; +
|
- sometimes bots put additional info around the tool call, have a regexp to match tool call; +
|
||||||
- remove all panics from code; +
|
- 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;
|
- new chat replaces old ones in db;
|
||||||
|
|||||||
2
main.go
2
main.go
@@ -11,7 +11,7 @@ var (
|
|||||||
editMode = false
|
editMode = false
|
||||||
botMsg = "no"
|
botMsg = "no"
|
||||||
selectedIndex = int(-1)
|
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{}
|
focusSwitcher = map[tview.Primitive]tview.Primitive{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
34
tui.go
34
tui.go
@@ -17,11 +17,26 @@ var (
|
|||||||
editArea *tview.TextArea
|
editArea *tview.TextArea
|
||||||
textView *tview.TextView
|
textView *tview.TextView
|
||||||
position *tview.TextView
|
position *tview.TextView
|
||||||
|
helpView *tview.TextView
|
||||||
flex *tview.Flex
|
flex *tview.Flex
|
||||||
chatActModal *tview.Modal
|
chatActModal *tview.Modal
|
||||||
sysModal *tview.Modal
|
sysModal *tview.Modal
|
||||||
indexPickWindow *tview.InputField
|
indexPickWindow *tview.InputField
|
||||||
renameWindow *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() {
|
func init() {
|
||||||
@@ -74,7 +89,7 @@ func init() {
|
|||||||
chatBody.Messages = defaultStarter
|
chatBody.Messages = defaultStarter
|
||||||
textView.SetText(chatToText(showSystemMsgs))
|
textView.SetText(chatToText(showSystemMsgs))
|
||||||
newChat := &models.Chat{
|
newChat := &models.Chat{
|
||||||
ID: id,
|
ID: id + 1,
|
||||||
Name: fmt.Sprintf("%v_%v", "new", time.Now().Unix()),
|
Name: fmt.Sprintf("%v_%v", "new", time.Now().Unix()),
|
||||||
Msgs: string(defaultStarterBytes),
|
Msgs: string(defaultStarterBytes),
|
||||||
}
|
}
|
||||||
@@ -209,6 +224,18 @@ func init() {
|
|||||||
return event
|
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)
|
textArea.SetMovedFunc(updateStatusLine)
|
||||||
updateStatusLine()
|
updateStatusLine()
|
||||||
textView.SetText(chatToText(showSystemMsgs))
|
textView.SetText(chatToText(showSystemMsgs))
|
||||||
@@ -271,6 +298,11 @@ func init() {
|
|||||||
pages.AddPage("getIndex", indexPickWindow, true, true)
|
pages.AddPage("getIndex", indexPickWindow, true, true)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
if event.Key() == tcell.KeyF12 {
|
||||||
|
// help window cheatsheet
|
||||||
|
pages.AddPage("helpView", helpView, true, true)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
if event.Key() == tcell.KeyCtrlE {
|
if event.Key() == tcell.KeyCtrlE {
|
||||||
textArea.SetText("pressed ctrl+e", true)
|
textArea.SetText("pressed ctrl+e", true)
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
Reference in New Issue
Block a user