summaryrefslogtreecommitdiff
path: root/bot.go
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2024-12-05 18:36:05 +0300
committerGrail Finder <wohilas@gmail.com>2024-12-05 18:36:05 +0300
commit990e0695c582c2c8d647c258cde0342ac14e3a75 (patch)
treef773fa8cbd7b86e5cd62517d7d6bb4aebb179bd2 /bot.go
parentb9a5c681a6620d9cf68e42fc4ec15d860f50ecd1 (diff)
Enha: add agent to chat history; gen-regen diff
Diffstat (limited to 'bot.go')
-rw-r--r--bot.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/bot.go b/bot.go
index 2179fd3..6ff579d 100644
--- a/bot.go
+++ b/bot.go
@@ -102,7 +102,7 @@ func sendMsgToLLM(body io.Reader) {
}
}
-func chatRound(userMsg, role string, tv *tview.TextView) {
+func chatRound(userMsg, role string, tv *tview.TextView, regen bool) {
botRespMode = true
reader := formMsg(chatBody, userMsg, role)
if reader == nil {
@@ -110,7 +110,7 @@ func chatRound(userMsg, role string, tv *tview.TextView) {
return
}
go sendMsgToLLM(reader)
- if userMsg != "" { // no need to write assistant icon since we continue old message
+ if userMsg != "" && !regen { // no need to write assistant icon since we continue old message
fmt.Fprintf(tv, "(%d) ", len(chatBody.Messages))
fmt.Fprint(tv, cfg.AssistantIcon)
}
@@ -158,12 +158,12 @@ func findCall(msg string, tv *tview.TextView) {
f, ok := fnMap[fc.Name]
if !ok {
m := fc.Name + "%s is not implemented"
- chatRound(m, cfg.ToolRole, tv)
+ chatRound(m, cfg.ToolRole, tv, false)
return
}
resp := f(fc.Args...)
toolMsg := fmt.Sprintf("tool response: %+v", string(resp))
- chatRound(toolMsg, cfg.ToolRole, tv)
+ chatRound(toolMsg, cfg.ToolRole, tv, false)
}
func chatToTextSlice(showSys bool) []string {