feat(接口4): 精简输出为固定6个英文字段,缩短提示词

- face_features.py:_PROMPT 只问6项特征(+有无人脸),analyze_features
  只返回6个英文字段;无人脸返回 None(不再依赖 has_face 在外部判定)
- gateway/app.py:无脸判定改为 feats is None,去掉 has_face import
- app.py / docs / test_interface4.html:Swagger/文档/示例/测试页同步

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
xsl
2026-06-18 22:19:00 +08:00
co-authored by Claude Sonnet 4.6
parent be81567261
commit 28a6062fea
6 changed files with 30 additions and 48 deletions
+3 -7
View File
@@ -653,13 +653,10 @@ async def hair_grow_b(
---
由**火山方舟 豆包视觉模型**分析,返回一大批面部特征(脸型/眉形/眼型/肤色/三庭五眼/四季色彩季型/
量感/轮廓/基因风格/性别…几十项),**英文优先字段 + doubao 中文字段并存**。
由**火山方舟 豆包视觉模型**分析,返回**固定 6 个英文字段**。
**返回格式**`data.features` 为一个 **JSON 字符串**(不是对象),需要在客户端 `JSON.parse()` 后使用。
英文优先字段(其余中文字段同时返回):
| 字段 | 说明 |
|------|------|
| face_shape | 脸形(如"鹅蛋脸" |
@@ -669,7 +666,7 @@ async def hair_grow_b(
| gender | 性别(""/"" |
| gene_style | 基因风格(如"自然型" |
> 字段不固定、可随时增删,客户端按需取用。无人脸返回 `1001`。
> 无人脸返回 `1001`。
""",
responses={
200: {
@@ -681,7 +678,7 @@ async def hair_grow_b(
"message": "success",
"request_id": "mock-request-id",
"data": {
"features": '{"图片是否有人脸":"有人","脸型":"鹅蛋脸","眉形":"平眉","面部年龄":"18-25岁","四季色彩季型":"冷夏型","基因风格":"少年型","性别":"","face_shape":"鹅蛋脸","eyebrow_shape":"平眉","facial_age":"18-25岁","dynamic_static_type":"静态型","gender":"","gene_style":"少年型"}',
"features": '{"face_shape":"鹅蛋脸","eyebrow_shape":"平眉","facial_age":"18-25岁","dynamic_static_type":"静态型","gender":"","gene_style":"少年型"}',
},
}
}
@@ -706,7 +703,6 @@ async def face_features(
# 网关不会把本接口转发到 worker,故此处仅留 Mock 占位、保持 worker 无外网依赖。
features = json.dumps(
{
"_note": "接口4 由网关实现,worker 此响应为占位 Mock",
"face_shape": "鹅蛋脸", "eyebrow_shape": "平眉", "facial_age": "18-25岁",
"dynamic_static_type": "静态型", "gender": "", "gene_style": "少年型",
},