fix(gateway): 补齐鉴权测试页并保持旧接口兼容

This commit is contained in:
xsl
2026-11-07 21:11:17 +08:00
parent 51baf96d78
commit c7add84d91
11 changed files with 100 additions and 22 deletions
+2 -2
View File
@@ -141,7 +141,7 @@ def _local_face_shape(image_bytes: bytes = None, image_url: str = None) -> str:
return shape
def analyze_features(image_bytes: bytes = None, image_url: str = None):
def analyze_features(image_bytes: bytes = None, image_url: str = None, *, accept_age_alias=False):
"""豆包分析 6 项特征 + 本机 MediaPipe 覆盖 face_shape。
Returns: dict —— 7 个英文字段(face_shape/eyebrow_shape/facial_age/
@@ -177,7 +177,7 @@ def analyze_features(image_bytes: bytes = None, image_url: str = None):
return None
# 豆包 5 项 + 本地脸型覆盖
feats = {en: raw[zh] for zh, en in _KEY_MAP.items() if zh in raw}
if "facial_age" not in feats and "面部年龄区间" in raw:
if accept_age_alias and "facial_age" not in feats and "面部年龄区间" in raw:
feats["facial_age"] = raw["面部年龄区间"]
try:
feats["face_shape"] = _local_face_shape(image_bytes, image_url)