From 6b7e78a8e0034cfa3248ab9b8cadd7e71fbf7cb7 Mon Sep 17 00:00:00 2001 From: flobo3 Date: Thu, 9 Apr 2026 17:51:29 +0300 Subject: [PATCH] fix: strip blocks from Gemma 4 and similar models --- nanobot/utils/helpers.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/nanobot/utils/helpers.py b/nanobot/utils/helpers.py index 1f14cb36e..3b4f9f25a 100644 --- a/nanobot/utils/helpers.py +++ b/nanobot/utils/helpers.py @@ -15,9 +15,12 @@ from loguru import logger def strip_think(text: str) -> str: - """Remove blocks and any unclosed trailing tag.""" + """Remove thinking blocks and any unclosed trailing tag.""" text = re.sub(r"[\s\S]*?", "", text) text = re.sub(r"[\s\S]*$", "", text) + # Gemma 4 and similar models use ... blocks + text = re.sub(r"[\s\S]*?", "", text) + text = re.sub(r"[\s\S]*$", "", text) return text.strip()