1.修改提示词与说话人注入,减少模型每次回答都带着说话人信息
This commit is contained in:
DaGou12138
2026-07-08 14:12:16 +08:00
parent 209fd3fbc8
commit 04c10ef225
3 changed files with 10 additions and 5 deletions
+7 -2
View File
@@ -92,7 +92,8 @@ class Dialogue:
return result
def get_llm_dialogue_with_memory(
self, memory_str: str = None, voiceprint_config: dict = None
self, memory_str: str = None, voiceprint_config: dict = None,
current_speaker: str = None,
) -> List[Dict[str, str]]:
# 构建对话
dialogue = []
@@ -145,8 +146,12 @@ class Dialogue:
# 追加说话人信息
try:
speakers = voiceprint_config.get("speakers", [])
if speakers:
current_speaker_name = (current_speaker or "").strip()
if speakers or (current_speaker_name and current_speaker_name != "未知说话人"):
dynamic_part += "\n<speakers_info>"
# 当前说话人置于块首,确保弱模型也能稳定获取身份
if current_speaker_name and current_speaker_name != "未知说话人":
dynamic_part += f"\n当前说话人:{current_speaker_name}"
for speaker_str in speakers:
try:
parts = speaker_str.split(",", 2)