feat(api+app): 对话阶段化、回忆录流水线与客户端会话体验

- DB: segments 用户输入文本(Alembic 0002)
- Chat: 阶段检测/阶段提示/回复限制,编排与访谈/画像 prompts 调整
- Memoir: 忠实度检查 agent,叙事与分类等链路更新
- Core: agent 日志、Alembic 启动、LangChain/日志/配置等
- Story: time_hints;Memory 检索与相关测试
- Expo: 助手头像、会话页与消息拆分、实时会话与文案/i18n
- Docs/scripts/tests: 迁移脚本、LLM JSON/记忆检索文档、新增单测
This commit is contained in:
Kevin
2026-03-26 12:13:36 +08:00
parent 49b089354c
commit a3f61fcc0f
94 changed files with 3332 additions and 672 deletions

View File

@@ -71,6 +71,8 @@ def get_profile_extraction_prompt(
return f"""请从以下内容中提取用户已提到的基础资料信息。{dialogue_section}用户本轮回答:
"{user_message}"
**JSON 输出**:接口已启用 `response_format=json_object`DeepSeek JSON 模式),你必须只输出一个合法 JSON 对象。
需要提取的字段(只提取确实在对话中出现过的):
{missing_names}
@@ -96,6 +98,7 @@ def get_profile_followup_prompt(
filled_fields: Dict[str, str],
user_message: str,
nickname: str = "",
interview_stage_hint: str = "",
) -> str:
"""在收集资料过程中的跟进提问"""
missing_names = [
@@ -110,13 +113,19 @@ def get_profile_followup_prompt(
filled_str = "\n".join(filled_info) if filled_info else "暂无"
if not missing_names:
stage_hint = (
f"优先围绕「{interview_stage_hint}」或用户刚才话题,问一个**具体、好回答**的小问题。"
if interview_stage_hint
else "问一个与**用户刚才关注点**或人生故事相关的**具体、好回答**的问题作为开场。"
)
return f"""你是「岁月知己」。用户的基本信息已经收集完毕:
{filled_str}
用户刚才说:"{user_message}"
请对用户的回答做出温暖的回应,然后自然地过渡到人生故事的访谈。
可以说类似"了解了!那我们现在开始聊聊你的人生故事吧"这样的话,然后问一个关于童年的问题作为开场。
可以说类似了解了!那我们现在开始聊聊你的人生故事吧」这样的话;{stage_hint}
**不要**默认只问童年,除非用户刚才聊的正是童年。
回复格式:多条消息用 [SPLIT] 分隔。
直接输出你要说的话:"""