opencompletion.com/templates
russell@unturf.com e50fe6e830
streaming: forward reasoning_content to client as separate channel
Qwen3.x / Deepseek-R1 / o1 stream model thinking via
delta.reasoning_content during SSE; the final answer arrives later via
delta.content. Both server streaming paths (OpenAI client + llama-cpp
Python lib) now extract reasoning_content per chunk and emit it via the
same socketio "message_chunk" event with a `reasoning_content` field
(distinct from `content`). Reasoning is forwarded but NOT accumulated
into the buffer that persists to the DB — it's transient model-private
state, not part of the saved message.

Frontend (templates/chat.html): the message_chunk handler dispatches
on payload shape. On `reasoning_content`: lazy-create a
<details class="message-thinking"> block at the top of the message
wrapper, append text, return early (no buffer/markdown render). On
`content`: if a thinking block exists and is still open, auto-collapse
it to "thinking (click to expand)" before standard content rendering.

If a response never thinks, no thinking DOM element is created — no
visual artefact at all. Compatible with all existing message_chunk
listeners; reasoning_content is purely additive.
2026-05-25 14:49:43 -04:00
..
auth.html Redesign user interface across all pages (#42) 2025-11-12 09:24:49 -05:00
base.html Fix socket.io connection for reverse proxy deployments 2026-02-23 19:19:42 -05:00
browse.html Fix theme flash and add logout to profile page 2025-11-30 10:00:48 -05:00
chat.html streaming: forward reasoning_content to client as separate channel 2026-05-25 14:49:43 -04:00
index.html Add Open Graph and Twitter Card meta tags for social sharing 2025-12-15 08:17:01 -05:00
profile.html Fix theme flash and add logout to profile page 2025-11-30 10:00:48 -05:00
search.html Redesign user interface across all pages (#42) 2025-11-12 09:24:49 -05:00