fix: remove SSE connection failure notice timer

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-15 14:35:05 +08:00
parent 6ef78ca54f
commit b86c29c6a4

View File

@@ -1844,8 +1844,6 @@ export function ChatProvider({ children }: { children: ReactNode }) {
let eventSource: EventSource | null = null;
let reconnectTimer: ReturnType<typeof setTimeout> | null = null;
let sseNoticeTimer: ReturnType<typeof setTimeout> | null = null;
let sseNoticeShown = false;
const connect = () => {
if (eventSource) eventSource.close();
@@ -1869,12 +1867,6 @@ export function ChatProvider({ children }: { children: ReactNode }) {
connect();
sseNoticeTimer = setTimeout(() => {
if (cancelled || sseNoticeShown) return;
sseNoticeShown = true;
addSystemMessageRef.current("无法连接实时事件流,请确认 WebUI 已启动且穿透域名可访问");
}, 12_000);
return () => {
cancelled = true;
window.removeEventListener("resize", onResize);
@@ -1882,7 +1874,6 @@ export function ChatProvider({ children }: { children: ReactNode }) {
window.visualViewport?.removeEventListener("scroll", syncViewportHeight);
window.removeEventListener("orientationchange", syncViewportHeight);
if (reconnectTimer) clearTimeout(reconnectTimer);
if (sseNoticeTimer) clearTimeout(sseNoticeTimer);
eventSource?.close();
};
}, []);