summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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)
}
}