Your lightweight open-source personal agent.
Python agent-frameworkai-agentai-agentschatbotchatopsdiscord-botllm-agentsllmslocal-llmmcpmodel-context-protocolmulti-agentopenai-compatibleopenclawpersonal-ai-assistantpythonself-hostedtelegram-bot-ai-assistantwebuiworkflow-automation
refactor: trim thinking tag helper setup
chengyongrua584ffe92dfe
diff --git a/nanobot/utils/helpers.py b/nanobot/utils/helpers.pyindex 32824aafc..a0577dca5 100644--- a/nanobot/utils/helpers.py+++ b/nanobot/utils/helpers.py@@ -70,12 +70,8 @@ def _tag_regex(tags: tuple[str, ...]) -> str:_THINKING_TAGS = ("think", "thinking", "thought")-_INLINE_SELF_CLOSING_PRESERVED_TAGS = frozenset({"think", "thought"})-_INLINE_SELF_CLOSING_THINKING_TAGS = tuple(- tag for tag in _THINKING_TAGS if tag not in _INLINE_SELF_CLOSING_PRESERVED_TAGS-)_THINKING_TAG = _tag_regex(_THINKING_TAGS)-_INLINE_SELF_CLOSING_THINKING_TAG = _tag_regex(_INLINE_SELF_CLOSING_THINKING_TAGS)+_INLINE_SELF_CLOSING_THINKING_TAG = r"(?:thinking)"_THINKING_TAG_PREFIX = "|".join(sorted({re.escape(tag[:i]) for tag in _THINKING_TAGS for i in range(1, len(tag) + 1)},@@ -145,7 +141,6 @@ def strip_reasoning_tags(text: object) -> str:"""Remove wrapper tags from text that is already known to be reasoning."""if not isinstance(text, str):return ""- text = re.sub(rf"^\s*(?:{_PARTIAL_THINKING_TAG})$", "", text)text = re.sub(rf"^\s*<{_THINKING_TAG}/>\s*", "", text)text = re.sub(rf"\s*<{_THINKING_TAG}/>\s*$", "", text)text = re.sub(rf"^\s*<{_THINKING_TAG}>\s*", "", text)