feat(chat): server-side interview turn plan (mode, anchor slot, snippet)
- Add plan_interview_turn: emotion_first / memoir_push / follow_user_only - Inject hard directive block at top of guided system prompt - Pass stage_switched_this_turn from ChatOrchestrator after stage detection - Log interview_turn_plan for observability; add unit tests
This commit is contained in:
@@ -5,6 +5,7 @@ from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from typing import Dict, List, Optional
|
||||
|
||||
from app.agents.chat.interview_turn_plan import InterviewTurnPlan
|
||||
from app.agents.state_schema import KnownFact, PersonaThread
|
||||
|
||||
|
||||
@@ -27,11 +28,20 @@ class ChatPromptContext:
|
||||
known_facts: List[KnownFact] | None = None
|
||||
persona_threads: List[PersonaThread] | None = None
|
||||
recent_questions: List[str] | None = None
|
||||
turn_plan: InterviewTurnPlan | None = None
|
||||
|
||||
def guided_system_prompt(self) -> str:
|
||||
"""用户原话仅以对话历史 + HumanMessage 注入模型。"""
|
||||
from app.agents.chat.interview_turn_plan import (
|
||||
format_interview_turn_directive_block,
|
||||
)
|
||||
from app.agents.chat.prompts_conversation import get_guided_conversation_prompt
|
||||
|
||||
directive = (
|
||||
format_interview_turn_directive_block(self.turn_plan)
|
||||
if self.turn_plan is not None
|
||||
else ""
|
||||
)
|
||||
return get_guided_conversation_prompt(
|
||||
current_stage=self.current_stage,
|
||||
empty_slots=self.empty_slots,
|
||||
@@ -48,4 +58,5 @@ class ChatPromptContext:
|
||||
known_facts=self.known_facts or [],
|
||||
persona_threads=self.persona_threads or [],
|
||||
recent_questions=self.recent_questions or [],
|
||||
turn_directive_block=directive,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user