diff options
| author | Grail Finder <wohilas@gmail.com> | 2025-12-23 22:41:21 +0300 |
|---|---|---|
| committer | Grail Finder <wohilas@gmail.com> | 2025-12-23 22:41:21 +0300 |
| commit | 29becaa8c83c8dff8af7623ca71e8021319887ab (patch) | |
| tree | 3b5d9ecea329445b6855467a779c7270b8497df0 | |
| parent | 7ac85a6d7eba37c7f04d359bf64aef0f1f6bece0 (diff) | |
Fix: last msg duplication
| -rw-r--r-- | bot.go | 5 |
1 files changed, 1 insertions, 4 deletions
@@ -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) } } |
