feat: add outfit task models

This commit is contained in:
2026-06-18 17:30:18 +08:00
parent 5fb2f1c8e0
commit 382797cfea
2 changed files with 29 additions and 1 deletions
+28
View File
@@ -149,6 +149,34 @@ class VisibilityResult:
error: str = "" error: str = ""
# ---------------------------------------------------------------------------
# AI 穿搭
# ---------------------------------------------------------------------------
@dataclass
class OutfitTask:
"""AI 穿搭单行任务。
row_index: Excel 行号(从 1 开始,便于写回 D/E/F 列)。
status: 待处理 / 生成中 / 完成 / 失败 / 跳过。
"""
row_index: int
title: str
product_id: str
garment_path: str
status: str = "待处理"
@dataclass
class OutfitResult:
"""AI 穿搭单行生成结果。"""
task: OutfitTask
success: bool
output_path: str = ""
error: str = ""
attempts: int = 0
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# 合成结果 # 合成结果
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
+1 -1
View File
@@ -1046,7 +1046,7 @@
前置阅读:`docs/11-ai-outfit.md`(§3–§9) 前置阅读:`docs/11-ai-outfit.md`(§3–§9)
- [x] 前置依赖:`requirements.txt` 增加 Python 3.7 兼容的 `requests` / `urllib3` / `openpyxl` 锁定版本,并同步 `docs/03-technical-stack.md` - [x] 前置依赖:`requirements.txt` 增加 Python 3.7 兼容的 `requests` / `urllib3` / `openpyxl` 锁定版本,并同步 `docs/03-technical-stack.md`
- [ ] `core/models.py` 新增 `OutfitTask` / `OutfitResult`(纯 dataclass,Python 3.7 兼容,不依赖 PySide6) - [x] `core/models.py` 新增 `OutfitTask` / `OutfitResult`(纯 dataclass,Python 3.7 兼容,不依赖 PySide6)
- [ ] `services/excel_service.py`:读行 → `List[OutfitTask]`、写回 D/E/F、占用检测、跳过「完成」/按设置重试「失败」/空字段安全跳过、每行即存 - [ ] `services/excel_service.py`:读行 → `List[OutfitTask]`、写回 D/E/F、占用检测、跳过「完成」/按设置重试「失败」/空字段安全跳过、每行即存
- [ ] `services/ai_image_service.py`:移植旧项目 `ImageApiClient`(多模型、多请求格式 `chat/gemini/images/images_edits`、传图 data-url、递归取图、URL 归一化、字段校验);注意 PEP585 类型注解改 Python 3.7 写法 - [ ] `services/ai_image_service.py`:移植旧项目 `ImageApiClient`(多模型、多请求格式 `chat/gemini/images/images_edits`、传图 data-url、递归取图、URL 归一化、字段校验);注意 PEP585 类型注解改 Python 3.7 写法
- [ ] `core/ai_outfit.py`:单行生成纯逻辑编排(提示词渲染 + 调用 + 保存 JPG + 产出 `OutfitResult`) - [ ] `core/ai_outfit.py`:单行生成纯逻辑编排(提示词渲染 + 调用 + 保存 JPG + 产出 `OutfitResult`)