fix: normalize thinking tags in reasoning output

This commit is contained in:
Zhou
2026-06-24 15:45:34 +08:00
committed by Xubin Ren
parent f9afc9389b
commit 523bb928bf
4 changed files with 131 additions and 12 deletions
+5 -2
View File
@@ -34,6 +34,7 @@ from nanobot.utils.helpers import (
extract_reasoning,
find_legal_message_start,
maybe_persist_tool_result,
strip_reasoning_tags,
strip_think,
truncate_text,
)
@@ -778,8 +779,10 @@ class AgentRunner:
async def _thinking(delta: str) -> None:
if not delta:
return
context.streamed_reasoning = True
await hook.emit_reasoning(delta)
delta = strip_reasoning_tags(delta)
if delta:
context.streamed_reasoning = True
await hook.emit_reasoning(delta)
async def _stream_recover() -> None:
await hook.on_stream_end(context, resuming=True)