- 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.
41 lines
1.4 KiB
Python
41 lines
1.4 KiB
Python
"""
|
||
访谈 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 prompt;default 返回空串。"""
|
||
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)
|