summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrail Finder <wohilas@gmail.com>2025-12-23 22:41:21 +0300
committerGrail Finder <wohilas@gmail.com>2025-12-23 22:42:24 +0300
commit3c6f9b624ec4ef6f2e92ddb2ba794a0d8cddd6cf (patch)
treea782fce61c1388b547e274e2e64ebd6829247d57
parentbc49f37dce78f24f62eee1b4d5c8e41a3a38048a (diff)
Fix: last msg duplicationHEADmaster
-rw-r--r--bot.go5
1 files changed, 1 insertions, 4 deletions
diff --git a/bot.go b/bot.go
index 1ad3c94..f2c986f 100644
--- a/bot.go
+++ b/bot.go
@@ -91,11 +91,8 @@ func cleanToolCalls(messages []models.RoleMsg) []models.RoleMsg {
cleaned := make([]models.RoleMsg, 0, len(messages))
for i, msg := range messages {
// recognize the message as the tool call and remove it
- if msg.ToolCallID == "" {
- cleaned = append(cleaned, msg)
- }
// tool call in last msg should stay
- if i == len(messages)-1 {
+ if msg.ToolCallID == "" || i == len(messages)-1 {
cleaned = append(cleaned, msg)
}
}