- 在 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 的问题。 - 更新相关文档和提示以反映新功能。
16 lines
1.1 KiB
SQL
16 lines
1.1 KiB
SQL
-- 修复章节 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';
|