From fa06ea19a67b0292619f3372af1f822e03a65341 Mon Sep 17 00:00:00 2001 From: "Apple\\Apple" Date: Mon, 26 May 2025 20:24:04 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20fix(chat):=20optimize=20SSE=20co?= =?UTF-8?q?nnection=20status=20handling?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove unnecessary undefined status check in readystatechange event - Only show disconnection message for actual non-200 status codes - Remove redundant else branch for normal status handling - Prevent false "Connection lost" messages on successful completion --- web/src/pages/Playground/Playground.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/web/src/pages/Playground/Playground.js b/web/src/pages/Playground/Playground.js index b21872dd..718c9d53 100644 --- a/web/src/pages/Playground/Playground.js +++ b/web/src/pages/Playground/Playground.js @@ -239,12 +239,10 @@ const Playground = () => { source.addEventListener('readystatechange', (e) => { if (e.readyState >= 2) { - if (source.status === undefined || source.status !== 200) { + if (source.status !== undefined && source.status !== 200) { source.close(); streamMessageUpdate(t('连接已断开'), 'content'); completeMessage('error'); - } else if (source.status === 200) { - // 正常状态,不需要特殊处理 } } });