diff --git a/face_features.py b/face_features.py index d8fc797..eda031b 100644 --- a/face_features.py +++ b/face_features.py @@ -103,6 +103,16 @@ def analyze_features(image_bytes: bytes = None, image_url: str = None): {"type": "image_url", "image_url": {"url": url}}, {"type": "text", "text": _PROMPT}, ], + # 【SDK原生支持的标准参数,绝对不报错】 + max_tokens=1024, # 限制输出长度,模型秒回 + temperature=0, # 固定输出,无随机采样,提速+结果稳定 + stream=False, # 关闭流式,单次返回结果更快 + # 【官方正确写法】扩展参数必须放在extra_body中传递 + extra_body={ + "thinking": { + "type": "disabled" # 【核心提速】彻底关闭深度思考模式,提速50%+,官方标准格式{insert\_element\_1\_} + } + } }], ) text = resp.choices[0].message.content diff --git a/gateway/app.py b/gateway/app.py index 9d95d09..b58a24d 100644 --- a/gateway/app.py +++ b/gateway/app.py @@ -196,6 +196,7 @@ async def index(): "if3_hair_grow_b": "/static/test_interface3.html", "if4_features": "/static/test_interface4.html", "if5_hairline": "/static/test_interface5.html", + "if6_measure_v2": "/static/test_interface6.html", "if7_hair_grow_v2": "/static/test_interface7.html", }, } diff --git a/static/integration.html b/static/integration.html index 9048afb..f5a7367 100644 --- a/static/integration.html +++ b/static/integration.html @@ -56,6 +56,7 @@ 接口3 接口4 接口5 + 接口6 接口7 错误码 在线测试 @@ -235,6 +236,35 @@ console.log(features['四季色彩季型']); // "冷夏型"(中文字段也保 + +
/api/v1/face/measure-v2 v2基于接口1的变体。上传正面照 → 返回标注 PNG + 三庭七眼数据。与接口1 的差异:
+face_total_height_cm = 上+中+下庭入参
+| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
| image_file / image_url / image_base64 | — | 三选一 | 用户正面照 |
data 字段
+| 字段 | 类型 | 说明 |
|---|---|---|
annotated_image_url | string | 标注 PNG URL(仅标注图层,透明底) |
face_total_height_cm | number | 面部总高度(cm)= 三庭之和 |
four_courts | object | 三庭:upper/middle/lower,各含 _cm 和 ratios(无 top_court) |
seven_eyes | object | 七眼:eye_width/face_width/inter_eye_distance |
landmarks | object | 4 个关键点:hairline/brow_center/nose_bottom/chin_tip(无 hair_top) |
/api/v1/hair/grow-v2 v2diff --git a/static/test_interface6.html b/static/test_interface6.html new file mode 100644 index 0000000..ff81b1a --- /dev/null +++ b/static/test_interface6.html @@ -0,0 +1,274 @@ + + +
+ + +POST /api/v1/face/measure-v2 | 去顶庭 · 竖线发际线→下巴 · 无头部端线
+face_total_height_cm = 上+中+下庭