mirror of
https://github.com/zhayujie/chatgpt-on-wechat.git
synced 2026-03-04 07:43:46 +08:00
fix: improve web UI stability and conversation history restore
- 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
This commit is contained in:
@@ -574,7 +574,7 @@ class AgentStreamExecutor:
|
||||
raise Exception(f"{error_msg} (Status: {status_code}, Code: {error_code}, Type: {error_type})")
|
||||
|
||||
# Parse chunk
|
||||
if isinstance(chunk, dict) and "choices" in chunk:
|
||||
if isinstance(chunk, dict) and chunk.get("choices"):
|
||||
choice = chunk["choices"][0]
|
||||
delta = choice.get("delta", {})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user