summaryrefslogtreecommitdiff
path: root/bot.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2024-11-16 16:19:27 +0300
committerGrail Finder <wohilas@gmail.com>2024-11-16 16:19:27 +0300
commitb2c86989264f329bcd102eee7de5d91649643215 (patch)
tree133f3cbac06534846544236e6177ec69a526ba7d /bot.go
parent1fe807de8eff13c41c8c7dd1dd6f4c4efca21244 (diff)
Feat: add msg index
Diffstat (limited to 'bot.go')
-rw-r--r--bot.go5
1 files changed, 3 insertions, 2 deletions
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
}