From 3c6f9b624ec4ef6f2e92ddb2ba794a0d8cddd6cf Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Tue, 23 Dec 2025 22:41:21 +0300 Subject: Fix: last msg duplication --- bot.go | 5 +---- 1 file changed, 1 insertion(+), 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) } } -- cgit v1.2.3