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:41:21 +0300
commit29becaa8c83c8dff8af7623ca71e8021319887ab (patch)
tree3b5d9ecea329445b6855467a779c7270b8497df0
parent7ac85a6d7eba37c7f04d359bf64aef0f1f6bece0 (diff)
Fix: last msg duplication
-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)
}
}