Two related fixes for thinking mode streaming: 1. chat_completion_stream.go: When the response channel closes unexpectedly (context cancelled, upstream error) while thinking is in progress, the <think> tag was left unclosed. This caused the stored message to have an incomplete tag, making the frontend show a perpetual "thinking..." state on history reload. Now we emit a closing </think> tag when the channel ends with thinkingStarted=true but thinkingEnded=false. 2. remote_api.go: The thinking Done=true event was only sent when the first answer content chunk arrived. If the model produced only reasoning with no answer (e.g., finish_reason set with empty content), the thinking-done signal was never emitted. Now we also check isDone && state.hasThinking at the end of processStreamDelta to ensure the done event is always sent. |
||
|---|---|---|
| .. | ||
| chat.go | ||
| image_resolve.go | ||
| json_field_extractor.go | ||
| json_field_extractor_test.go | ||
| lkeap.go | ||
| nvidia.go | ||
| ollama.go | ||
| provider_chat.go | ||
| qwen.go | ||
| remote_api.go | ||
| remote_api_test.go | ||
| sse_reader.go | ||