fix(stream): robust reasoning/content split + flush un-tagged output

The incremental </think> search missed tags split across tokens, inverting
reasoning/content classification. Detect the first </think> on the full
buffer and track the content boundary as a byte offset. If the model never
closes </think>, flush the buffered text as content so clients always
receive the response. Chat UI now renders reasoning_content too.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
asepharyana
2026-08-03 11:03:26 +07:00
co-authored by Claude Opus 5
parent b636496497
commit 7cec411cba
4 changed files with 134 additions and 50 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
pub mod use_cases;
pub use use_cases::{
build_prompt, build_sampler, clean_text, parse_tool_calls, split_stream_chunk, validate_model,
SamplerParams,
build_prompt, build_sampler, clean_text, parse_tool_calls, split_stream_chunk, strip_markup,
validate_model, SamplerParams,
};