fix: stray <|end_of_solution|> marker left in the reply (#31436)

When a model wraps its answer in <|begin_of_solution|> and <|end_of_solution|>, only the opening marker was removed. The closing marker stayed visible in the reply and was saved with the message, and anything the model wrote after it was glued onto the answer. Now both markers are removed and text after the answer shows up as a normal part of the reply.

Fixes #31434
This commit is contained in:
Classic298 2026-09-26 05:19:09 +02:00 • committed by GitHub
parent 25604d7070
commit fe8b30438a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4540,7 +4540,7 @@ async def streaming_chat_response_handler(response, ctx):
last_type = output[-1].get('type', '') if output else ''
if last_type == 'message':
if last_type == 'message' and output[-1].get('_tag_type') != content_type:
# Use the output item's own text for tag detection
item = output[-1]
item_text = get_last_text(output)