From d2642b66f8ef2f18c6d9b4443cfe8e2b1ffd8350 Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Tue, 16 Jun 2026 21:15:19 +0800 Subject: [PATCH] save code --- gateway/app.py | 11 ++++++----- restart.sh | 19 +++++++++++++++++++ static/test_interface4.html | 7 +++---- 3 files changed, 28 insertions(+), 9 deletions(-) create mode 100755 restart.sh diff --git a/gateway/app.py b/gateway/app.py index fe65caf..bc19f79 100644 --- a/gateway/app.py +++ b/gateway/app.py @@ -271,11 +271,12 @@ async def face_features( img_bytes = None if image_file: raw = await image_file.read() - if len(raw) > 1_000_000: - return JSONResponse(status_code=200, content={ - "code": 1006, "message": "文件超出 1 MB 限制", - "request_id": f"gw-{_uuid.uuid4().hex[:8]}", "data": None, - }) + # TODO: 临时取消限制,后续恢复 + # if len(raw) > 1_000_000: + # return JSONResponse(status_code=200, content={ + # "code": 1006, "message": "文件超出 1 MB 限制", + # "request_id": f"gw-{_uuid.uuid4().hex[:8]}", "data": None, + # }) img_bytes = raw elif image_base64: b64 = image_base64 diff --git a/restart.sh b/restart.sh new file mode 100755 index 0000000..92a9431 --- /dev/null +++ b/restart.sh @@ -0,0 +1,19 @@ +#!/bin/bash +# 重启网关 + worker 服务 +set -e + +cd "$(dirname "$0")" + +echo "=== 重启网关 ===" +sudo systemctl restart hair-gateway +sudo systemctl status hair-gateway --no-pager -l | head -8 + +echo "" +echo "=== 网关池状态 ===" +sleep 3 +curl -s http://127.0.0.1:8080/gateway-health 2>/dev/null || echo "⚠ 网关未就绪" + +echo "" +echo "=== 重启 worker(GPU 机)===" +echo "如需重启 GPU worker,请登录 GPU 机器执行:" +echo " sudo systemctl restart hair" diff --git a/static/test_interface4.html b/static/test_interface4.html index 2968fa0..ef117a7 100644 --- a/static/test_interface4.html +++ b/static/test_interface4.html @@ -61,7 +61,7 @@

🔬 接口4 — 用户特征分析 测试

-

POST /api/v1/face/features  |  上传照片 → 火山方舟豆包视觉模型 → 42项面部特征  |  data.features 为 JSON 字符串

+

POST /api/v1/face/features  |  上传照片 → AI视觉模型 → 42项面部特征  |  data.features 为 JSON 字符串

@@ -70,7 +70,7 @@
-
JPG/PNG ≤1MB 正面照  |  调用火山方舟豆包视觉模型,耗时约数秒
+
JPG/PNG 正面照  |  调用AI视觉模型,耗时约数秒
@@ -123,11 +123,10 @@ function setStatus(t, type) { const b=$('statusBar'); b.textContent=t; b.classNa async function submitTest() { const f = $('imageFile').files[0]; if (!f) { setStatus('请选择图片', 'error'); return; } - if (f.size > 1_000_000) { setStatus('文件超过 1 MB', 'error'); return; } $('imgPreview').innerHTML = 'preview'; $('submitBtn').disabled = true; $('submitBtn').textContent = '⏳ 分析中...'; - setStatus('⏳ 调用豆包视觉模型...', 'info'); $('resultsArea').classList.add('hidden'); + setStatus('⏳ 调用AI视觉模型...', 'info'); $('resultsArea').classList.add('hidden'); const fd = new FormData(); fd.append('image_file', f); try {