feat: support old title placeholder in title prompts
This commit is contained in:
@@ -1500,3 +1500,11 @@
|
||||
- 测试:`tests/test_ai.py` 覆盖 curl 参数、URL 不进 argv、SSRF 校验先于 subprocess、curl 失败回退 requests、无 curl 自动回退 requests;现有 cmhub 测试 helper 显式关闭 curl,避免单测误连真实网络。`tests/test_appconfig.py` 覆盖 `download_with_curl` 默认值和归一。
|
||||
- 文档:同步 `docs/06-tasks.md`、`docs/04-architecture.md`、`docs/api.md`、`docs/cmhub-integration-design.md`、`docs/packaging.md` 和 `docs/current-state.md`。
|
||||
- 验证:`py -3.10 -m unittest discover -s tests -p "test_ai.py"` 通过(38 tests);`py -3.10 -m unittest discover -s tests -p "test_appconfig.py"` 通过(16 tests);`python -m ruff check app tests main.py` 通过;`py -3.10 -m compileall app main.py` 通过;`git diff --check` 通过;`py -3.10 -m unittest discover -s tests` 通过(250 tests)。
|
||||
|
||||
## 【2026-07-08】T-549 · 标题提示词支持 `{旧标题}` 占位符
|
||||
|
||||
- 需求:②AI生成的标题提示词支持在光标处插入 `{旧标题}`,并在生成标题时按当前任务旧标题替换;不支持 `{商品id}`、`{店铺}`、`{新标题}` 等其它标题变量。
|
||||
- 代码:`app/gui/tabs/generate.py` 在标题提示词区新增「插入旧标题」按钮,点击后把 `{旧标题}` 插入 `title_prompt_edit` 当前光标位置。`app/ai.py` 新增统一标题 prompt 组装 helper,direct 与 cmhub 共享:提示词含 `{旧标题}` 时替换当前旧标题且不重复追加旧标题块;不含时保持旧行为自动追加「旧标题:...」;两种情况都保留「请只返回新标题,不要解释。」输出约束,其它 `{...}` 原样保留。
|
||||
- 测试:`tests/test_ai.py` 覆盖 direct/cmhub 两路径的 `{旧标题}` 替换、旧标题不重复追加、旧行为兼容和其它占位符保留;`tests/test_gui.py` 覆盖「插入旧标题」按钮和光标插入行为。
|
||||
- 文档:`docs/06-tasks.md` 将 T-549 标为 DONE;同步 `docs/04-architecture.md`、`docs/api.md`、`docs/routes.md`、`docs/cmhub-integration-design.md` 和 `docs/current-state.md`。
|
||||
- 验证:`python -m ruff check app tests main.py` 通过;`py -3.10 -m compileall app main.py` 通过;`git diff --check` 通过;`py -3.10 -m unittest discover -s tests` 通过(252 tests)。
|
||||
|
||||
Reference in New Issue
Block a user