Files
life-echo/api/app/agents/chat/personas.py
Kevin 2fded6fbd9 refactor(chat): AI-native prompts, remove interview heuristics
- Drop interview_reply_length and utterance_substance; always run stage LLM
  and memory retrieval when enabled; trim Settings fields and .env.example.
- Replace guided/opening prompts with compact fact blocks plus unified
  behavior guidance; slim background_voice and persona to tone hints.
- InterviewAgent uses fixed chat_interview max_tokens/chars/segments.

Also includes stacked work: profile followup/extract path, evaluation rubric
and judge schema updates, transcript SPLIT handling in execution service,
user export markdown split tests, and golden case fixture.
2026-04-06 22:23:46 +08:00

41 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"""
访谈 Agent 可配置性格Persona仅影响语气不替代事实边界与槽位约束。
"""
from __future__ import annotations
from typing import Final
# 与 settings.chat_interview_persona 及文档保持一致
VALID_INTERVIEW_PERSONAS: Final[frozenset[str]] = frozenset(
{"default", "warm_listener", "curious_guide"}
)
def normalize_interview_persona(raw: str | None) -> str:
"""未知或空值回退 default避免部署拼写错误导致空提示。"""
key = (raw or "default").strip().lower()
if key in VALID_INTERVIEW_PERSONAS:
return key
return "default"
def get_interview_persona_tone_hint(persona: str) -> str:
"""一句访谈性格提示,融入主 system promptdefault 返回空串。"""
key = normalize_interview_persona(persona)
if key == "default":
return ""
if key == "warm_listener":
return "偏倾听与承接,语气柔和、少打断;不审问感,一次最多一个具体问题。"
return "爱把人往一个具体细节里带;短句像微信,一次最多一个具体问题,不重复上文已清楚的事。"
def get_interview_persona_block(persona: str) -> str:
"""兼容旧名:返回空串,请改用 get_interview_persona_tone_hint。"""
return ""
def get_opening_persona_line(persona: str) -> str:
"""兼容旧名:与访谈轮次共用一句性格提示。"""
return get_interview_persona_tone_hint(persona)