Yaojia Wang
c675a74f1d
feat(backend): AI 对话聊天记录 repo + append/list 端点(AC-2)
在 C2 扩(AC-1) `ai_messages` 表上落 AC-2 后端(计划 §3):
- repo `SqlAiMessageRepo`:批 append(seq=批内 0 基位置、同 thread_id、只 flush)
+ `list_for_chapter` newest-first(created_at DESC, seq DESC)、chapter_no 过滤含
项目级 NULL union、可选 kind、limit/offset。
- schemas `ai_messages.py`:批级 append 信封 + Literal 枚举权威(kind/role)+ content
200k 上限 + meta 序列化兜底。
- 端点 `POST/GET /projects/{id}/ai-messages`(tag ai-messages,已注册):显式记录写入,
五个生成端点保持只读不变(守 #3);项目 404、校验 422、POST 端点提交。
- 注入缝 `get_ai_message_repo`。
TDD:repo 真 pg 单测(seq/定序/union/分页/flush-only)9 passed;端点集成测试
(round-trip/union/kind/404/422×5/commit 边界)12 passed。门禁全绿:ruff/format/mypy
238 files/alembic check 无漂移/pytest 992 passed;新模块 cov router+schemas 100% / repo 97%。
2026-07-09 16:54:52 +02:00
..
2026-07-06 17:08:38 +02:00
2026-07-09 16:54:52 +02:00
2026-07-08 13:08:19 +02:00
2026-06-18 11:38:28 +02:00
2026-06-21 19:32:24 +02:00
2026-07-06 17:08:38 +02:00
2026-07-08 08:47:13 +02:00
2026-06-23 19:01:11 +02:00
2026-06-18 11:38:28 +02:00
2026-06-18 14:21:17 +02:00
2026-06-21 19:32:24 +02:00
2026-06-18 14:21:17 +02:00
2026-07-06 17:24:16 +02:00
2026-06-20 10:39:58 +02:00
2026-06-20 11:31:59 +02:00
2026-06-23 18:04:10 +02:00
2026-07-08 12:34:06 +02:00
2026-07-06 14:29:43 +02:00
2026-06-18 14:21:17 +02:00
2026-06-18 14:21:17 +02:00
2026-07-06 15:59:49 +02:00
2026-07-06 17:08:38 +02:00
2026-06-22 18:28:04 +02:00
2026-07-08 07:04:42 +02:00
2026-06-25 12:53:03 +02:00
2026-06-20 10:39:58 +02:00
2026-07-06 17:08:38 +02:00
2026-07-08 12:39:31 +02:00
2026-06-22 20:37:55 +02:00