diff --git a/main/xiaozhi-server/core/handle/receiveAudioHandle.py b/main/xiaozhi-server/core/handle/receiveAudioHandle.py index 504669b85..333bd481c 100644 --- a/main/xiaozhi-server/core/handle/receiveAudioHandle.py +++ b/main/xiaozhi-server/core/handle/receiveAudioHandle.py @@ -54,13 +54,9 @@ async def startToChat(conn: "ConnectionHandler", text): actual_content = data["content"] conn.logger.bind(tag=TAG).info(f"解析到说话人信息: {speaker_name}") - # 仅在该说话人首次出现时保留 {"speaker":...} JSON,让模型自然称呼一次; - # 后续轮降为纯文本,避免每轮重复出现名字诱导模型反复称呼 - if speaker_name not in conn.introduced_speakers: - conn.introduced_speakers.add(speaker_name) - actual_text = text - else: - actual_text = actual_content + # Mantém o JSON completo contendo o speaker para a LLM sempre identificar quem fala + actual_text = text + except (json.JSONDecodeError, KeyError): # 如果解析失败,继续使用原始文本 pass