- Fix dark mode FOUC: apply theme in <head> before first paint, defer
transition-colors to post-init to avoid animated flash on load
- Fix Safari IME Enter bug: defer compositionend reset via setTimeout(0)
- Fix history scroll: use requestAnimationFrame before scrollChatToBottom
- Limit restore turns to min(6, max_turns//3) on restart
- Fix load_messages cutoff to start at turn boundary, preventing orphaned
tool_use/tool_result pairs from being sent to the LLM
- Merge all assistant messages within one user turn into a single bubble;
render tool_calls in history using same CSS as live SSE view
- Handle empty choices list in stream chunks
### Problem Description
When `context` is `None`, it should not be used for assignment operations.
### Solution
Adjusted the code logic to ensure that `context` is not `None` before performing any item assignment.