diff --git a/static/integration.html b/static/integration.html index 52c346d..e83a35e 100644 --- a/static/integration.html +++ b/static/integration.html @@ -72,6 +72,7 @@
multipart/form-dataimage_file(文件上传)/ image_url(URL)/ image_base64(base64 + 前缀)image_base64 传图会膨胀约 33%,编码前原图建议 ≤1.4MB。手机直拍照片通常 3~8MB,上传前务必先压缩(如最长边缩到 1500px、JPEG 质量 80)。image_url 方式图片在远端,不受此限制统一响应结构:
@@ -190,22 +191,23 @@ const { code, data } = await res.json();/api/v1/face/features上传照片 → 火山方舟豆包视觉模型分析 → 返回固定 6 项面部特征(脸型/眉形/面部年龄/动静类型/性别/基因风格)。
+上传照片 → 火山方舟豆包视觉模型分析 → 返回固定 7 项面部特征(脸型/眉形/面部年龄/动静类型/性别/基因风格/轮廓类型)。
入参:image_file / image_url / image_base64 三选一。无其他参数。
data 字段
| 字段 | 类型 | 说明 |
|---|---|---|
features | string | JSON 字符串(不是对象!客户端需 JSON.parse())。解析后得到固定 6 个英文字段 |
features | string | JSON 字符串(不是对象!客户端需 JSON.parse())。解析后得到固定 7 个英文字段 |
features 字段(固定返回 6 个):
+features 字段(固定返回 7 个):
| 字段 | 说明 | 字段 | 说明 |
|---|---|---|---|
| face_shape | 脸型 | eyebrow_shape | 眉形 |
| facial_age | 面部年龄区间 | gender | 性别 |
| dynamic_static_type | 动静类型 | gene_style | 基因风格 |
| contour_type | 轮廓类型(轮廓偏曲/轮廓适中/轮廓偏直) | — | — |
const res = await fetch('https://hair.xiangsilian.com/api/v1/face/features', {
@@ -309,6 +311,7 @@ console.log(features.gene_style); // "自然型"
X-Internal-Token(/api/* 路径鉴权)注:1004 仍在使用(接口2/5 的 gender 校验);接口7(grow-v2)已弃用,请改用接口2。
+⚠ HTTP 层错误不是业务 JSON:业务错误(code≠0)一律返回 HTTP 200;但请求体超 2MB 时 nginx 直接返回 413(HTML 错误页)、网关不可用时返回 502/504。客户端务必先判断 HTTP 状态码,非 200 时不要 res.json(),否则会报 Unexpected token '<'(把 HTML 当 JSON 解析)。
完整 API 文档:/docs(Swagger UI) diff --git a/static/test_face_shape.html b/static/test_face_shape.html index 9954556..743fc51 100644 --- a/static/test_face_shape.html +++ b/static/test_face_shape.html @@ -130,7 +130,6 @@