From b37b123ea730ffd8e4423988c465579431cc787e Mon Sep 17 00:00:00 2001 From: piexian <64474352+piexian@users.noreply.github.com> Date: Wed, 4 Feb 2026 06:07:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=89=B9=E9=87=8F?= =?UTF-8?q?=E5=88=B7=E6=96=B0=20SSE=20=E8=BF=9E=E6=8E=A5=E8=AE=A4=E8=AF=81?= =?UTF-8?q?=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - batch-sse.js: 传递 api_key 前去除 Bearer 前缀 - 根因: admin-auth.js 返回的 apiKey 包含 Bearer 前缀,但后端期望原始 key --- app/static/common/batch-sse.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/static/common/batch-sse.js b/app/static/common/batch-sse.js index 036a6a9..1d953d9 100644 --- a/app/static/common/batch-sse.js +++ b/app/static/common/batch-sse.js @@ -1,7 +1,9 @@ (function (global) { function openBatchStream(taskId, apiKey, handlers = {}) { if (!taskId) return null; - const url = `/api/v1/admin/batch/${taskId}/stream?api_key=${encodeURIComponent(apiKey || '')}`; + // Strip "Bearer " prefix if present - query param expects raw key + const rawKey = apiKey && apiKey.startsWith('Bearer ') ? apiKey.slice(7) : apiKey; + const url = `/api/v1/admin/batch/${taskId}/stream?api_key=${encodeURIComponent(rawKey || '')}`; const es = new EventSource(url); es.onmessage = (e) => {