Files
life-echo/api/migrations/fix_chapter_order_index.sql
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

16 lines
1.1 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- 修复章节 order_index 为 999 的问题
-- 原因STAGE_KEYWORDS 使用简化阶段名career, belief
-- 但 CHAPTER_ORDER 使用详细分类名career_early, beliefs导致查找失败回退到 999
-- 根据 category 字段修复 order_index
UPDATE chapters SET order_index = 0 WHERE order_index = 999 AND category = 'childhood';
UPDATE chapters SET order_index = 1 WHERE order_index = 999 AND category = 'education';
UPDATE chapters SET order_index = 2 WHERE order_index = 999 AND category = 'career';
UPDATE chapters SET order_index = 2 WHERE order_index = 999 AND category = 'career_early';
UPDATE chapters SET order_index = 3 WHERE order_index = 999 AND category = 'career_achievement';
UPDATE chapters SET order_index = 4 WHERE order_index = 999 AND category = 'career_challenge';
UPDATE chapters SET order_index = 5 WHERE order_index = 999 AND category = 'family';
UPDATE chapters SET order_index = 6 WHERE order_index = 999 AND category = 'belief';
UPDATE chapters SET order_index = 6 WHERE order_index = 999 AND category = 'beliefs';
UPDATE chapters SET order_index = 7 WHERE order_index = 999 AND category = 'summary';