From fffe5ac34fc62d57744c1d916baf0b2e7f10e2d8 Mon Sep 17 00:00:00 2001 From: Acbox Date: Wed, 8 Apr 2026 22:50:07 +0800 Subject: [PATCH] fix(web): start WS/SSE connections even when bot has no sessions When a new bot had no sessions, initialize() returned early without starting WebSocket, message events SSE, or local stream SSE. This caused the first conversation to hang because stream events had no delivery channel to reach the frontend. --- apps/web/src/store/chat-list.ts | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/web/src/store/chat-list.ts b/apps/web/src/store/chat-list.ts index afd7c9b4..13e668e2 100644 --- a/apps/web/src/store/chat-list.ts +++ b/apps/web/src/store/chat-list.ts @@ -842,13 +842,13 @@ export const useChatStore = defineStore('chat', () => { messageEventsSince = '' sessionId.value = null replaceMessages([]) - return + } else { + const activeSessionId = sessionId.value && visible.some((s) => s.id === sessionId.value) + ? sessionId.value + : visible[0]!.id + sessionId.value = activeSessionId + await loadMessages(bid, activeSessionId) } - const activeSessionId = sessionId.value && visible.some((s) => s.id === sessionId.value) - ? sessionId.value - : visible[0]!.id - sessionId.value = activeSessionId - await loadMessages(bid, activeSessionId) startWebSocket(bid) startMessageEvents(bid) startLocalStream(bid)