diff --git a/frontend/src/hooks/useVisionSession.ts b/frontend/src/hooks/useVisionSession.ts index 36d0cef..0e56558 100644 --- a/frontend/src/hooks/useVisionSession.ts +++ b/frontend/src/hooks/useVisionSession.ts @@ -438,12 +438,7 @@ export function useVisionSession(accessToken?: string | null) { // 未连接时:自动连接,消息加入待发队列 if (statusRef.current !== "connected") { pendingMessagesRef.current.push({ text: text.trim(), requestId }); - // 添加用户消息到 UI(立即反馈) - setMessages((prev) => [ - ...prev, - { role: "user", content: text.trim(), timestamp: Date.now() }], - ); - // 自动连接 WebSocket + // 自动连接 WebSocket(消息在连接成功后由 flush 统一添加到 UI,避免重复) connect(accessToken || undefined); return; }