[Bugfix][Parser] Emit buffered post-reasoning text when no tool parser is configured (#58911)

Signed-off-by: Dhairyashil R G <18738735+dhairyashilRG@users.noreply.github.com>
Signed-off-by: sfeng33 <4florafeng@gmail.com>
Co-authored-by: sfeng33 <4florafeng@gmail.com>
This commit is contained in:
Dhairyashil R G
2026-10-07 23:21:51 +00:00
committed by GitHub
co-authored by sfeng33
parent 4ac5a36a8e
commit d6fe5dca68
2 changed files with 83 additions and 2 deletions
+11 -2
View File
@@ -904,8 +904,17 @@ class DelegatingParser(Parser):
(delta_message.content if delta_message else None) or ""
) + ((flush_delta.content if flush_delta else None) or "")
if self._engine_based:
if delta_message and self._tool_parser is not None:
delta_message.content = None
if self._tool_parser is not None:
# The tool-call phase below consumes current_text.
if delta_message:
delta_message.content = None
elif current_text:
# No tool phase follows to consume the flushed text,
# and the engine is not fed again after the
# transition, so emit it as content here.
if delta_message is None:
delta_message = DeltaMessage()
delta_message.content = current_text
else:
delta_text = current_text