fix: 跨端消息同步 — 用户消息广播 + 会话隔离 + 去重
后端: handleChatMessage 将用户消息通过 broadcastToUser 广播给同用户所有设备 协议: ClientMessage 新增 ClientMsgID 字段用于跨端去重 前端: 发送消息时携带 client_msg_id,收到回显时跳过本地已添加的消息 前端: handleServerMessage 新增 session_id 过滤,防止不同会话消息串扰 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -24,6 +24,7 @@ type ClientMessage struct {
|
||||
ClientID string `json:"client_id,omitempty"` // 客户端唯一标识 (多端区分)
|
||||
DeviceName string `json:"device_name,omitempty"` // 设备备注名称
|
||||
UserAgent string `json:"user_agent,omitempty"` // 浏览器 UA
|
||||
ClientMsgID string `json:"client_msg_id,omitempty"` // 客户端消息ID (跨端去重)
|
||||
}
|
||||
|
||||
// ReviewMessage 审查后的结构化消息(动作/聊天分离)
|
||||
|
||||
Reference in New Issue
Block a user