Files
life-echo/api/app/agents/chat/prompt_context.py
Kevin 064ad2161d refactor(eval+memoir):精简内部评测路由与服务,composite/对话摘要与 judge 能力补强
- 访谈:新增 interview_state_hints,联动 orchestrator 与提示词
- 回忆录:story_pipeline_sync/state/memory/post_commit 与 Celery 任务调整
- 基建:开发用 celery broker、compose/development 脚本、依赖注入
- eval-web:移除数据集/实验/版本等页面与流式轮询,突出 Playground
- 文档与单测同步
2026-04-08 21:36:12 +08:00

52 lines
1.9 KiB
Python

"""Bundled parameters for chat system prompts (InterviewAgent)."""
from __future__ import annotations
from dataclasses import dataclass
from typing import Dict, List, Optional
from app.agents.state_schema import KnownFact, PersonaThread
@dataclass
class ChatPromptContext:
"""访谈轮次构建 `get_guided_conversation_prompt` 所需的字段集合。"""
current_stage: str
empty_slots: List[str]
filled_slots: Dict[str, str]
all_stages_coverage: Optional[Dict[str, Dict]] = None
detected_user_stage: str = ""
user_profile_context: str = ""
persona: str = "default"
memory_evidence_text: str = ""
background_voice: str = "default"
occupation: str = ""
profile_birth_year: int | None = None
profile_era_place: str = ""
known_facts: List[KnownFact] | None = None
persona_threads: List[PersonaThread] | None = None
recent_questions: List[str] | None = None
def guided_system_prompt(self) -> str:
"""用户原话仅以对话历史 + HumanMessage 注入模型。"""
from app.agents.chat.prompts_conversation import get_guided_conversation_prompt
return get_guided_conversation_prompt(
current_stage=self.current_stage,
empty_slots=self.empty_slots,
filled_slots=self.filled_slots,
all_stages_coverage=self.all_stages_coverage,
detected_user_stage=self.detected_user_stage,
user_profile_context=self.user_profile_context,
persona=self.persona,
memory_evidence_text=self.memory_evidence_text,
background_voice=self.background_voice,
occupation=self.occupation,
profile_birth_year=self.profile_birth_year,
profile_era_place=self.profile_era_place,
known_facts=self.known_facts or [],
persona_threads=self.persona_threads or [],
recent_questions=self.recent_questions or [],
)