fix(gateway): 补齐鉴权测试页并保持旧接口兼容
This commit is contained in:
+2
-2
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user