feat: AI套图分层方案 + Gemini集成 - 4种图案类型处理 + 正片叠底 + 宽高比 + 模型选择

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-02-07 16:59:56 +08:00
parent 12395d8eca
commit dae906aba7
277 changed files with 15009 additions and 19922 deletions

112
PltService/README.md Normal file
View File

@@ -0,0 +1,112 @@
# PLT 裁片处理微服务
独立的 PLT 文件处理服务,可部署到阿里云 SAE。
## 本地运行
```bash
# 安装依赖
pip install -r requirements.txt
# 启动服务
python main.py
```
服务启动后访问http://localhost:8080
## Docker 构建
```bash
# 构建镜像
docker build -t plt-service:latest .
# 运行容器
docker run -p 8080:8080 plt-service:latest
```
## 部署到阿里云 SAE
### 1. 构建并推送镜像到阿里云容器镜像服务
```bash
# 登录阿里云容器镜像服务
docker login --username=<你的阿里云账号> registry.cn-hangzhou.aliyuncs.com
# 构建镜像
docker build -t registry.cn-hangzhou.aliyuncs.com/<命名空间>/plt-service:v1.0 .
# 推送镜像
docker push registry.cn-hangzhou.aliyuncs.com/<命名空间>/plt-service:v1.0
```
### 2. 在 SAE 创建应用
1. 进入阿里云 SAE 控制台
2. 创建应用 → 选择"镜像部署"
3. 填写镜像地址:`registry.cn-hangzhou.aliyuncs.com/<命名空间>/plt-service:v1.0`
4. 配置规格:
- CPU: 2核
- 内存: 4GB
- 最小实例数: 0无请求时不收费
- 最大实例数: 5
5. 完成创建
### 3. 配置公网访问
在 SAE 应用详情 → 基本信息 → SLB 设置 → 添加公网 SLB
## API 接口
### 健康检查
```
GET /health
```
### 处理 PLT 文件
```
POST /process
Content-Type: multipart/form-data
参数:
- file: PLT 文件
- size_labels: 尺码标签,如 ["S","M","L","XL","2XL"]
- dpi: 输出分辨率(默认 150
- rotation: 旋转角度0/90/-90/180
```
响应示例:
```json
{
"success": true,
"total_groups": 5,
"groups": [
{
"group_id": 1,
"pieces": [
{
"size": "S",
"image_base64": "data:image/png;base64,...",
"width_px": 500,
"height_px": 300,
"width_cm": 25.5,
"height_cm": 15.3,
"center_x_cm": 12.75,
"center_y_cm": 7.65,
"left_cm": 0,
"top_cm": 0
}
]
}
]
}
```
## 费用估算(阿里云 SAE
| 场景 | 费用 |
|------|------|
| 处理 1 个 PLT30秒 | ¥0.04 |
| 每天 100 个 PLT | ¥4/天 |
| 无请求时 | ¥0最小实例设为0 |