diff options
-rw-r--r-- | README.md | 9 | ||||
-rw-r--r-- | bot.go | 9 | ||||
-rw-r--r-- | tui.go | 16 |
3 files changed, 14 insertions, 20 deletions
@@ -17,11 +17,12 @@ - option to switch between predefined sys prompts; + - sqlite for the bot memory; + - rename current chat; + +- help page with all key bindings; + - 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; - default config file (api url, path to sysprompts, path to log, limits, etc); +- export whole chat into a json file; ### FIX: - bot responding (or haninging) blocks everything; + @@ -30,6 +31,6 @@ - Tab is needed to copy paste text into textarea box, use shift+tab to switch focus; (changed tp pgup) + - 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; +- new chat replaces old ones in db; + +- empty input to continue bot msg gens new msg index and bot icon; + +- 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)) (should use regen instead of delete in that case); @@ -122,11 +122,14 @@ func chatRound(userMsg, role string, tv *tview.TextView) { botRespMode = true reader := formMsg(chatBody, userMsg, role) if reader == nil { - return // any notification in that case? + logger.Error("empty reader from msgs", "role", role) + return } go sendMsgToLLM(reader) - fmt.Fprintf(tv, fmt.Sprintf("(%d) ", len(chatBody.Messages))) - fmt.Fprintf(tv, assistantIcon) + if userMsg != "" { // no need to write assistant icon since we continue old message + fmt.Fprintf(tv, fmt.Sprintf("(%d) ", len(chatBody.Messages))) + fmt.Fprintf(tv, assistantIcon) + } respText := strings.Builder{} out: for { @@ -62,12 +62,7 @@ func init() { AddItem(textArea, 0, 10, true). AddItem(position, 0, 1, false) updateStatusLine := func() { - fromRow, fromColumn, toRow, toColumn := textArea.GetCursor() - if fromRow == toRow && fromColumn == toColumn { - position.SetText(fmt.Sprintf(indexLine, botRespMode, activeChatName)) - } else { - position.SetText(fmt.Sprintf("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; Row: [yellow]%d[white], Column: [yellow]%d[white] - [red]To[white] Row: [yellow]%d[white], To Column: [yellow]%d; bot resp mode: %v", fromRow, fromColumn, toRow, toColumn, botRespMode)) - } + position.SetText(fmt.Sprintf(indexLine, botRespMode, activeChatName)) } chatOpts := []string{"cancel", "new", "rename current"} chatList, err := loadHistoryChats() @@ -260,11 +255,10 @@ func init() { go chatRound("", userRole, textView) return nil } - if event.Key() == tcell.KeyF3 { + if event.Key() == tcell.KeyF3 && !botRespMode { // delete last msg chatBody.Messages = chatBody.Messages[:len(chatBody.Messages)-1] textView.SetText(chatToText(showSystemMsgs)) - botRespMode = false // hmmm; is that correct? return nil } if event.Key() == tcell.KeyF4 { @@ -314,8 +308,7 @@ func init() { } // cannot send msg in editMode or botRespMode if event.Key() == tcell.KeyEscape && !editMode && !botRespMode { - fromRow, fromColumn, _, _ := textArea.GetCursor() - position.SetText(fmt.Sprintf(indexLine, fromRow, fromColumn, botRespMode)) + position.SetText(fmt.Sprintf(indexLine, botRespMode, activeChatName)) // read all text into buffer msgText := textArea.GetText() if msgText != "" { @@ -333,9 +326,6 @@ func init() { return nil } if isASCII(string(event.Rune())) && !botRespMode { - // botRespMode = false - // fromRow, fromColumn, _, _ := textArea.GetCursor() - // position.SetText(fmt.Sprintf(indexLine, fromRow, fromColumn, botRespMode)) return event } return event |