新增语音输入(mcp_asr)与健康检查服务标识
语音输入:输入框为空时发送键变麦克风,进入语音模式后按住说话、松手转写并发送;套壳 App 走原生录音桥,浏览器走 MediaRecorder(需 HTTPS)。转写在 mcp_asr,经 /api/asr/transcribe 直达,不经过模型、不消耗 token。 /api/health 增加 service/api/auth_required 字段并设 no-store,供套壳 App 校验手填的服务器地址;免认证路径容忍尾斜杠,避免 /api/health/ 被中间件 401。 接线与文档:compose 新增 mcp_asr;init.sh 默认复用 BIGMODEL_KEY 作为 ASR_API_KEY;README/AGENTS/mcp 文档同步。版本 2.3.0 → 2.4.0。
This commit is contained in:
+4
-1
@@ -73,7 +73,10 @@ function basicAuthUser(req, users) {
|
||||
// ---------- 免认证路径(登录页自身需要的资源) ----------
|
||||
const PUBLIC_EXACT = new Set(['/login', '/logout', '/api/login', '/api/logout', '/api/login_restore', '/api/health']);
|
||||
function isPublicPath(p) {
|
||||
if (PUBLIC_EXACT.has(p)) return true;
|
||||
// 尾斜杠容忍:客户端手动填服务器地址常多带一个 `/`(拼成 `/api/health/`),
|
||||
// Express 路由本身能匹配,但这里若不规范化,中间件会先回 401——地址明明是对的却报未登录。
|
||||
const norm = p.length > 1 ? p.replace(/\/+$/, '') : p;
|
||||
if (PUBLIC_EXACT.has(norm)) return true;
|
||||
if (p.startsWith('/css/')) return true; // 登录页复用 style.css
|
||||
if (p === '/favicon.ico') return true;
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user