T-579 内置默认AI提示词
This commit is contained in:
+11
-1
@@ -3,7 +3,7 @@ id: T-579
|
||||
title: 打包版内置默认标题和封面提示词,首次运行自动写入用户 data
|
||||
phase: 8
|
||||
deps: [T-524, T-538, T-540]
|
||||
status: TODO
|
||||
status: DONE
|
||||
created: 2026-07-10
|
||||
---
|
||||
|
||||
@@ -60,3 +60,13 @@ created: 2026-07-10
|
||||
- 不提交 `data/config.json`、`data/config/cmhub.json`、`data/cmshopee.db`、`data/images/`、`data/chrome_user_data_dir/`、`data/logs/`。
|
||||
- 不改 AI/cmhub 请求协议、生成并发、DB schema、Excel、Shopee/CDP 更新流程。
|
||||
- 不在升级时覆盖用户已经修改过的提示词。
|
||||
|
||||
## 执行记录
|
||||
|
||||
- 2026-07-10:完成 T-579。
|
||||
- 新增 `app/default_prompts/` 默认提示词资源包,内置当前已验证使用的标题提示词和封面模板 `papa1`;发布前已扫描常见密钥关键词,未发现 API Key、Cookie、token、密码等密钥类内容。
|
||||
- `app/prompts.py` 新增 `ensure_default_prompts()`:用户 `data/title_prompt.txt` 缺失或为空时写入默认标题提示词;用户 `data/prompts/cover/` 没有模板时写入默认封面模板;已有用户提示词或模板时不覆盖。
|
||||
- `app/gui/tabs/generate.py` 在②AI生成页读取提示词前执行默认提示词初始化,保证全新用户首次打开即可看到默认标题提示词和 `papa1` 封面模板。
|
||||
- `cmshopee.spec` 改为通过 `collect_data_files("app.default_prompts")` 收集内置默认提示词文本;仍不打包 release 根目录的 `data/`、`title_prompt.txt`、`prompts/`、DB、配置、图片、日志或登录态。
|
||||
- 测试:`tests/test_prompts.py` 覆盖默认提示词播种和不覆盖用户提示词;`tests/test_gui.py` 覆盖②AI生成页全新用户自动回显默认提示词;`tests/test_packaging.py` 覆盖 PyInstaller spec 收集默认资源。
|
||||
- 验证通过:`py -3.10 -m unittest tests.test_prompts tests.test_gui tests.test_packaging`、`python -m ruff check app tests main.py`、`py -3.10 -m compileall app main.py`、`py -3.10 -m unittest discover -s tests`(319 tests)、`git diff --check`。
|
||||
|
||||
Reference in New Issue
Block a user