fix(editor): harden review API edges

This commit is contained in:
xin61
2026-07-07 13:59:33 +08:00
parent 193047b3dc
commit 0aa568636d
6 changed files with 77 additions and 24 deletions
+4 -1
View File
@@ -41,8 +41,9 @@ epub_review_sessions/
- text chapter: `kind: "text"``parts``row_count``touched_count``marked_count`
- image chapter: `kind: "image"``images``parts: []``row_count: 0`
- 统计字段同时保留总数和细分:`chapter_count``text_chapter_count``image_chapter_count``image_count``asset_count`
- part 标题默认使用 `part0000` 形式,真实标题可保留在 `source_title`
- 插图通过 `/api/asset/<entry>` 读取,必须继续使用 `extracted_path()` 防止路径穿越
- 插图通过 `/api/asset/<entry>` 读取,必须继续使用 `extracted_path()` 防止路径穿越;只把 raster 图片纳入 `/api/structure``/api/asset` 白名单,不能任意读取解包目录文件
章节来源优先级:
@@ -89,6 +90,7 @@ GPT 能力是可选增强,不应影响离线审校。
- API Key 优先读取 `gpt_config.json`,也支持环境变量 `OPENAI_API_KEY`
- `/api/gpt/config` 不得返回 API Key。
- 未配置 Key 时,重翻接口应返回可读错误,不影响编辑保存。
- 重翻请求不得临时覆盖 `base_url``model` 后继续复用已保存密钥;要更换端点或模型必须先保存配置,避免把密钥发往未确认端点。
单段重翻流程:
@@ -134,6 +136,7 @@ Prompt 硬规则:
- `/api/structure`
- `/api/gpt/config`
- 首个插图 `/api/asset/...` 返回 200 且浏览器可显示
- 非白名单或非 raster asset 不能被 `/api/asset/...` 读取
- 目录按钮、检索按钮、隐藏侧栏、点击段落打开右侧面板
- 阅读段落下方没有编号和“快速编辑/快速标记”
- 未配置 API Key 时重翻返回清晰错误