Skip to content

Commit 3863f4d

Browse files
committed
fix: 修复 batch stream 认证失败问题 (去掉 Bearer 前缀)
1 parent 3f897b9 commit 3863f4d

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

app/static/common/batch-sse.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
(function (global) {
22
function openBatchStream(taskId, apiKey, handlers = {}) {
33
if (!taskId) return null;
4-
const url = `/api/v1/admin/batch/${taskId}/stream?api_key=${encodeURIComponent(apiKey || '')}`;
4+
// 去掉 Bearer 前缀,后端期望纯 api_key
5+
const cleanKey = apiKey ? apiKey.replace(/^Bearer\s+/i, '') : '';
6+
const url = `/api/v1/admin/batch/${taskId}/stream?api_key=${encodeURIComponent(cleanKey)}`;
57
const es = new EventSource(url);
68

79
es.onmessage = (e) => {

app/static/config/config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,10 @@ const LOCALE_MAP = {
3939
"dynamic_statsig": { title: "动态指纹", desc: "是否启用动态生成 Statsig 值。" },
4040
"filter_tags": { title: "过滤标签", desc: "自动过滤 Grok 响应中的特殊标签。" },
4141
"timeout": { title: "超时时间", desc: "请求 Grok 服务的超时时间(秒)。" },
42-
"base_proxy_url": { title: "基础代理 URL", desc: "代理请求到 Grok 官网的基础服务地址。" },
43-
"asset_proxy_url": { title: "资源代理 URL", desc: "代理请求到 Grok 官网的静态资源(图片/视频)地址。" },
42+
"api_base": { title: "API 反代地址", desc: "替换 grok.com 的反向代理地址,如 Cloudflare Worker URL。" },
43+
"asset_base": { title: "资源反代地址", desc: "替换 assets.grok.com 的反向代理地址。" },
44+
"base_proxy_url": { title: "HTTP 代理", desc: "HTTP/SOCKS5 代理地址,用于请求 Grok API。" },
45+
"asset_proxy_url": { title: "资源代理", desc: "HTTP/SOCKS5 代理地址,用于请求静态资源。" },
4446
"cf_clearance": { title: "CF Clearance", desc: "Cloudflare 验证 Cookie,用于验证 Cloudflare 的验证。" },
4547
"max_retry": { title: "最大重试", desc: "请求 Grok 服务失败时的最大重试次数。" },
4648
"retry_status_codes": { title: "重试状态码", desc: "触发重试的 HTTP 状态码列表。" }

0 commit comments

Comments
 (0)