chore: add ai outfit dependencies

This commit is contained in:
2026-06-18 17:26:16 +08:00
parent a7db9444bd
commit 5fb2f1c8e0
3 changed files with 29 additions and 2 deletions
+25 -2
View File
@@ -57,6 +57,25 @@ pip install PySide6==6.5.3
可选使用 numpy 辅助处理图像数组,但第一阶段不应把 numpy 作为必须依赖,除非实际实现需要。
## Excel 与 HTTP(AI 穿搭)
AI 穿搭模块需要读取/写回 Excel,并通过 HTTP(S) 调用外部 AI 图像接口。该能力属于可选扩展页签,不改变「添加印花」主流程的本地合成能力。
依赖约束:
```text
requests==2.31.0
urllib3==1.26.20
openpyxl==3.1.3
```
版本说明:
- `requests 2.31.0` 是仍支持 Python 3.7 的版本;`requests 2.32.x` 起要求 Python 3.8+。
- `urllib3` 固定在 1.26.x,避免解析到 2.x 后在旧 Python / 旧 Windows 环境中引入兼容风险。
- `openpyxl 3.1.3` 支持 Python 3.7;`openpyxl 3.1.5` 起要求 Python 3.8+,因此不能使用宽泛的 `openpyxl>=3.1,<4` 作为本项目锁定依赖。
- 后续 AI 接口代码不得使用 `verify=False` 关闭 TLS 校验;如使用 `requests.Session`,应显式控制环境凭据读取,避免旧版 `requests` 的已知风险影响生产接口调用。
## 预览交互
预览区建议使用:
@@ -102,8 +121,11 @@ pyinstaller --onedir --windowed main.py
```text
PySide6==6.5.3
shiboken6==6.5.3
Pillow
PyInstaller
Pillow==9.5.0
PyInstaller==5.13.2
requests==2.31.0
urllib3==1.26.20
openpyxl==3.1.3
```
注意:
@@ -111,6 +133,7 @@ PyInstaller
- Python 3.7 已停止官方维护,部分第三方库的新版本不再支持 Python 3.7。
- 实际开发前需要验证 Pillow、PyInstaller 等依赖的最新可用兼容版本。
- 一旦验证通过,应把这些依赖固定为明确版本,避免后续安装环境变化导致打包失败。
- 新增依赖前必须先核对其 `Requires-Python` 元数据,不能只写宽版本范围。
## 文档分工
+3
View File
@@ -2,3 +2,6 @@ PySide6==6.5.3
shiboken6==6.5.3
Pillow==9.5.0
PyInstaller==5.13.2
requests==2.31.0
urllib3==1.26.20
openpyxl==3.1.3
+1
View File
@@ -1045,6 +1045,7 @@
前置阅读:`docs/11-ai-outfit.md`(§3–§9)
- [x] 前置依赖:`requirements.txt` 增加 Python 3.7 兼容的 `requests` / `urllib3` / `openpyxl` 锁定版本,并同步 `docs/03-technical-stack.md`
- [ ] `core/models.py` 新增 `OutfitTask` / `OutfitResult`(纯 dataclass,Python 3.7 兼容,不依赖 PySide6)
- [ ] `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 写法