48 lines
1.7 KiB
Python
48 lines
1.7 KiB
Python
|
|
"""Bundled parameters for chat system prompts (InterviewAgent)."""
|
||
|
|
|
||
|
|
from __future__ import annotations
|
||
|
|
|
||
|
|
from dataclasses import dataclass
|
||
|
|
from typing import Dict, List, Optional
|
||
|
|
|
||
|
|
|
||
|
|
@dataclass
|
||
|
|
class ChatPromptContext:
|
||
|
|
"""访谈轮次构建 `get_guided_conversation_prompt` 所需的字段集合。"""
|
||
|
|
|
||
|
|
current_stage: str
|
||
|
|
empty_slots: List[str]
|
||
|
|
filled_slots: Dict[str, str]
|
||
|
|
user_message: str
|
||
|
|
conversation_turn_total: int = 0
|
||
|
|
same_topic_turns: int = 0
|
||
|
|
all_stages_coverage: Optional[Dict[str, Dict]] = None
|
||
|
|
detected_user_stage: str = ""
|
||
|
|
user_profile_context: str = ""
|
||
|
|
persona: str = "default"
|
||
|
|
memory_evidence_text: str = ""
|
||
|
|
reply_length_mode: str = "standard"
|
||
|
|
background_voice: str = "default"
|
||
|
|
occupation: str = ""
|
||
|
|
|
||
|
|
def guided_system_prompt(self) -> str:
|
||
|
|
"""`user_message` 仅参与启发式,不出现在返回的系统提示文本中。"""
|
||
|
|
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,
|
||
|
|
user_message=self.user_message,
|
||
|
|
conversation_turn_total=self.conversation_turn_total,
|
||
|
|
same_topic_turns=self.same_topic_turns,
|
||
|
|
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,
|
||
|
|
reply_length_mode=self.reply_length_mode,
|
||
|
|
background_voice=self.background_voice,
|
||
|
|
occupation=self.occupation,
|
||
|
|
)
|