fix: prevent duplicated post-think text (#15651)

### What problem does this PR solve?
This fixes duplicated post-think text in streamed chat responses. When
the model emits text immediately after `</think>`, the stream state now
advances its cursor correctly so the same visible prefix is not emitted
twice.

### Type of change
- [x] Bug Fix (non-breaking change which fixes an issue)
This commit is contained in:
buua436
2026-06-05 13:21:26 +08:00
committed by GitHub
parent f6ff862a24
commit 71649db3b0

View File

@@ -1478,6 +1478,7 @@ def _next_think_delta(state: _ThinkStreamState) -> str:
remainder = delta_ans[len("</think>") :]
if remainder:
state.post_think_text = remainder
state.last_idx = len(full_text)
return "</think>"
state.last_idx = len(full_text)