Преглед изворни кода

🔧 fix(chat): optimize SSE connection status handling

- 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
Apple\Apple пре 9 месеци
родитељ
комит
fa06ea19a6
1 измењених фајлова са 1 додато и 3 уклоњено
  1. 1 3
      web/src/pages/Playground/Playground.js

+ 1 - 3
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) {
-          // 正常状态,不需要特殊处理
         }
       }
     });