From 7e1a255ff2403c17a7d64a768e509d2c1e23e984 Mon Sep 17 00:00:00 2001 From: geyun <1556375442@qq.com> Date: Sun, 25 Jan 2026 21:47:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20=E8=BE=93=E5=87=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.html | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/index.html b/index.html index 469153b..15cfe5d 100755 --- a/index.html +++ b/index.html @@ -1679,6 +1679,8 @@ const from = params.get("from"); let token = params.get("token");//app的token let localtoken = params.get("localtoken");//公众号的localtoken + + // app会得到token; // 手机端会验证token @@ -2565,20 +2567,65 @@ const getAiResponse = async (img) => { }); } catch (err) { loadingDiv.textContent = "请求中断"; + if (controller) { + controller.abort(); + controller = null; + } + sendBtnImg.classList.remove('none'); + stopBtn.forEach(e => { + e.classList.add('none') + }) return; } if (!res?.body) { loadingDiv.textContent = "无响应"; + document.querySelectorAll('.thinking-loading').forEach(el=>el.classList.add('no-after')); return; } + if (!res) { + + + if (sendBtnImg.classList.contains("none")) { + sendBtnImg.classList.remove('none'); + } + stopBtn.forEach(e => { + if (!e.classList.contains('none')) { + e.classList.add('none') + } + + }) + document.querySelectorAll('.thinking-loading').forEach(el=>el.classList.add('no-after')); + + return null; + } + if (res.status === 400) { + document.querySelectorAll('.thinking-loading').forEach(el=>el.classList.add('no-after')); + if (controller) { + controller.abort(); + controller = null; + } + if (sendBtnImg.classList.contains("none")) { + sendBtnImg.classList.remove('none'); + + } + stopBtn.forEach(e => { + if (!e.classList.contains("none")) { + e.classList.add('none') + } + }) + showpop(); + return; + } + // ========================= // SSE 读取 // ========================= const reader = res.body.getReader(); const decoder = new TextDecoder("utf-8"); let buffer = ""; + showPop(userId); while (true) { const { done, value } = await reader.read();