feat: 创建 LobsterDiary 模型,支持数据库存储日记

- 创建 LobsterDiary 模型
  * 关联龙虾(ForeignKey)
  * 日期、标题、内容
  * 分类(成才之路/工作记忆/技术笔记)
  * 标签(JSONField)
  * Embedding 字段(预留 RAG 支持)
  * 数据库索引优化

- 数据库迁移
  * 添加 LobsterDiary 表
  * 添加索引:lobster+date, category+date, date

- 导入脚本
  * 创建 import_diaries 管理命令
  * 导入飞行侠的成才之路日记(3 篇)

- 更新 API
  * /api/lobsters/<id>/diary/dates/ - 从数据库查询
  * /api/lobsters/<id>/diary/<date>/ - 从数据库读取

- PostgreSQL 配置模板
  * settings_postgresql.py
  * 准备好 PostgreSQL 迁移

技术栈:SQLite(当前) → PostgreSQL(未来)
RAG 支持:预留 embedding 字段,未来可扩展

🗄️ 日记正式进入数据库时代!
This commit is contained in:
2026-04-03 17:38:18 +08:00
parent 689851e762
commit 24e4ca2c82
7 changed files with 330 additions and 28 deletions