From c0ec82b579f09af020bc236eb84fa6b22d68823b Mon Sep 17 00:00:00 2001 From: Grail Finder Date: Fri, 26 Dec 2025 10:01:49 +0300 Subject: Chore: only table switch for auto clean tool calls --- bot.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'bot.go') diff --git a/bot.go b/bot.go index f2c986f..8b5a889 100644 --- a/bot.go +++ b/bot.go @@ -88,6 +88,10 @@ func cleanNullMessages(messages []models.RoleMsg) []models.RoleMsg { } func cleanToolCalls(messages []models.RoleMsg) []models.RoleMsg { + // If AutoCleanToolCallsFromCtx is false, keep tool call messages in context + if cfg != nil && !cfg.AutoCleanToolCallsFromCtx { + return consolidateConsecutiveAssistantMessages(messages) + } cleaned := make([]models.RoleMsg, 0, len(messages)) for i, msg := range messages { // recognize the message as the tool call and remove it @@ -731,7 +735,7 @@ func cleanChatBody() { for i, msg := range chatBody.Messages { logger.Debug("cleanChatBody: before clean", "index", i, "role", msg.Role, "content_len", len(msg.Content), "has_content", msg.HasContent(), "tool_call_id", msg.ToolCallID) } - // TODO: consider case where we keep tool requests + // Tool request cleaning is now configurable via AutoCleanToolCallsFromCtx (default false) // /completion msg where part meant for user and other part tool call chatBody.Messages = cleanToolCalls(chatBody.Messages) chatBody.Messages = cleanNullMessages(chatBody.Messages) -- cgit v1.2.3