Files
life-echo/api/migrations
penghanyuan 7fe0b70d5c feat: 增强对话代理以检测用户阶段并更新章节排序
- 在 api/agents/conversation_agent.py 中添加 _detect_user_stage 方法,以通过关键词检测用户谈论的人生阶段。
- 在 api/agents/memory_agent.py 中更新章节排序逻辑,使用 STAGE_TO_ORDER 替代 CHAPTER_ORDER。
- 在 api/agents/state_schema.py 中添加方法以获取各阶段的填充情况。
- 在 api/agents/prompts/conversation_prompts.py 中更新对话提示,包含用户阶段检测和整体进度信息。
- 在 api/migrations/fix_chapter_order_index.sql 中添加 SQL 脚本以修复章节 order_index 的问题。
- 更新相关文档和提示以反映新功能。
2026-02-13 21:45:56 +01:00
..

数据库迁移

说明

  • sync_schema_to_models.sql:与当前 api/database/models.py 保持一致的幂等迁移脚本,部署工作流会在每次部署后自动执行。可重复执行,已存在的表/列会跳过。
  • 其余 add_*.sql 为历史增量迁移,可按需单独执行;若已运行过 sync_schema_to_models.sql,通常不必再跑。

手动执行

# 从项目根目录
psql -U <user> -d <database> -f api/migrations/sync_schema_to_models.sql

若使用与 docker-compose 默认不同的数据库用户/库名,可在 GitHub 仓库中配置 SecretsMIGRATION_DB_USERMIGRATION_DB_NAME,工作流将用其执行迁移。