diff options
author | Grail Finder <wohilas@gmail.com> | 2024-12-05 18:36:05 +0300 |
---|---|---|
committer | Grail Finder <wohilas@gmail.com> | 2024-12-05 18:36:05 +0300 |
commit | 990e0695c582c2c8d647c258cde0342ac14e3a75 (patch) | |
tree | f773fa8cbd7b86e5cd62517d7d6bb4aebb179bd2 /bot.go | |
parent | b9a5c681a6620d9cf68e42fc4ec15d860f50ecd1 (diff) |
Enha: add agent to chat history; gen-regen diff
Diffstat (limited to 'bot.go')
-rw-r--r-- | bot.go | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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 { |