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. |
||
|---|---|---|
| .. | ||
| auth.html | ||
| base.html | ||
| browse.html | ||
| chat.html | ||
| index.html | ||
| profile.html | ||
| search.html | ||