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 的问题。 - 更新相关文档和提示以反映新功能。
This commit is contained in:
@@ -13,7 +13,7 @@ from .prompts import (
|
||||
get_chapter_classification_prompt,
|
||||
get_text_rewrite_prompt,
|
||||
CHAPTER_CATEGORIES,
|
||||
CHAPTER_ORDER
|
||||
STAGE_TO_ORDER,
|
||||
)
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
@@ -176,7 +176,7 @@ class MemoryAgent:
|
||||
"summary": result.get("summary", ""),
|
||||
"image_suggestions": result.get("image_suggestions", []),
|
||||
"category": category,
|
||||
"order_index": CHAPTER_ORDER.index(category) if category in CHAPTER_ORDER else 999
|
||||
"order_index": STAGE_TO_ORDER.get(category, 999)
|
||||
}
|
||||
|
||||
return updated_chapters
|
||||
|
||||
Reference in New Issue
Block a user