mirror of
https://github.com/infiniflow/ragflow.git
synced 2026-06-29 15:31:05 +08:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user