From 71649db3b065a5e355b536362bab048e931c745b Mon Sep 17 00:00:00 2001 From: buua436 Date: Fri, 5 Jun 2026 13:21:26 +0800 Subject: [PATCH] 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 ``, 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) --- api/db/services/dialog_service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/db/services/dialog_service.py b/api/db/services/dialog_service.py index 0662e8d48f..8d282baa77 100644 --- a/api/db/services/dialog_service.py +++ b/api/db/services/dialog_service.py @@ -1478,6 +1478,7 @@ def _next_think_delta(state: _ThinkStreamState) -> str: remainder = delta_ans[len("") :] if remainder: state.post_think_text = remainder + state.last_idx = len(full_text) return "" state.last_idx = len(full_text)