diff --git a/main/digital-human/index.html b/main/digital-human/index.html
index cfb72637f..d633dc7f4 100644
--- a/main/digital-human/index.html
+++ b/main/digital-human/index.html
@@ -155,7 +155,7 @@
-
+
diff --git a/main/digital-human/js/app.js b/main/digital-human/js/app.js
index 09ab35063..62f758da0 100644
--- a/main/digital-human/js/app.js
+++ b/main/digital-human/js/app.js
@@ -304,7 +304,10 @@ class App {
log(`正在发送图片到视觉分析接口: ${url}`, 'info');
const deviceId = document.getElementById('deviceMac')?.value || '';
- const clientId = document.getElementById('clientId')?.value || 'web_test_client';
+ const clientId = document.getElementById('clientId')?.value || '';
+ if (!deviceId || !clientId) {
+ throw new Error('视觉分析失败:请填写设备MAC与客户端ID,两者需与设备上报的一致');
+ }
const formData = new FormData();
formData.append('question', question);
diff --git a/main/xiaozhi-server/core/api/vision_handler.py b/main/xiaozhi-server/core/api/vision_handler.py
index c3e683cfe..587c08cf7 100644
--- a/main/xiaozhi-server/core/api/vision_handler.py
+++ b/main/xiaozhi-server/core/api/vision_handler.py
@@ -29,14 +29,7 @@ class VisionHandler(BaseHandler):
def _verify_auth_token(self, request) -> Tuple[bool, Optional[str]]:
"""验证认证token"""
- # 测试模式:允许特定测试令牌或跳过验证
auth_header = request.headers.get("Authorization", "")
- client_id = request.headers.get("Client-Id", "")
-
- # 允许测试客户端跳过认证
- if client_id == "web_test_client":
- device_id = request.headers.get("Device-Id", "test_device")
- return True, device_id
if not auth_header.startswith("Bearer "):
return False, None
@@ -155,7 +148,7 @@ class VisionHandler(BaseHandler):
)
finally:
if response:
- self._add_cors_headers(response)
+ self._add_cors_headers(response, request)
return response
async def handle_get(self, request):
@@ -178,5 +171,5 @@ class VisionHandler(BaseHandler):
content_type="application/json",
)
finally:
- self._add_cors_headers(response)
+ self._add_cors_headers(response, request)
return response