From b2c86989264f329bcd102eee7de5d91649643215 Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Sat, 16 Nov 2024 16:19:27 +0300 Subject: Feat: add msg index --- bot.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'bot.go') diff --git a/bot.go b/bot.go index 5522a20..8a09e24 100644 --- a/bot.go +++ b/bot.go @@ -162,6 +162,7 @@ func chatRound(userMsg, role string, tv *tview.TextView) { botRespMode = true reader := formMsg(chatBody, userMsg, role) go sendMsgToLLM(reader) + fmt.Fprintf(tv, fmt.Sprintf("(%d) ", len(chatBody.Messages))) fmt.Fprintf(tv, assistantIcon) respText := strings.Builder{} out: @@ -171,6 +172,7 @@ out: // fmt.Printf(chunk) fmt.Fprintf(tv, chunk) respText.WriteString(chunk) + tv.ScrollToEnd() case <-streamDone: break out } @@ -179,7 +181,6 @@ out: chatBody.Messages = append(chatBody.Messages, models.MessagesStory{ Role: assistantRole, Content: respText.String(), }) - // TODO: // bot msg is done; // now check it for func call logChat(chatFileLoaded, chatBody.Messages) @@ -299,7 +300,7 @@ func chatToTextSlice(showSys bool) []string { if !showSys && (msg.Role != assistantRole && msg.Role != userRole) { continue } - resp[i] = msg.ToText() + resp[i] = msg.ToText(i) } return resp } -- cgit v1.2.3