wangzhibo
10 天以前 220e4fab27b7f419b3e89e2f2d28ae789aac09d7
xiaozhi-esp32-server/main/xiaozhi-server/core/handle/receiveAudioHandle.py
@@ -25,7 +25,7 @@
        if not hasattr(conn, "vad_resume_task") or conn.vad_resume_task.done():
            conn.vad_resume_task = asyncio.create_task(resume_vad_detection(conn))
        return
    # 服务端AEC:仅对话类模式允许打断。复读/跟读/翻译时喇叭回声不能当成插话。
    # 服务端AEC:仅对话类模式允许打断。泛听/跟读/翻译时喇叭回声不能当成插话。
    if conn.client_aec and have_voice:
        if (
            conn.client_is_speaking
@@ -107,7 +107,7 @@
    mode = getattr(conn, "interaction_mode", "CHAT")
    # 菜单 TTS 里的「跟读/复读机/翻译」不能当成切 App;退出聊天口令仍要生效
    # 菜单 TTS 里的「跟读/泛听/翻译」不能当成切 App;退出聊天口令仍要生效
    if conn.client_is_speaking and getattr(conn, "awaiting_voice_app_choice", False):
        mapped = match_voice_switch(actual_text)
        if mapped and mapped[0] == "chat":
@@ -162,7 +162,7 @@
        return
    if mode == "PLAY_AUDIO":
        conn.logger.bind(tag=TAG).info("复读机模式忽略上行对话")
        conn.logger.bind(tag=TAG).info("泛听模式忽略上行对话")
        return
    if mode == "SHADOWING":
@@ -250,6 +250,10 @@
async def check_bind_device(conn: "ConnectionHandler"):
    conn.last_bind_prompt_time = time.time()
    if getattr(conn, "tts", None) is None:
        conn.logger.bind(tag=TAG).error("TTS未就绪,无法播放绑定码")
        return
    if conn.bind_code:
        # 确保bind_code是6位数字
        if len(conn.bind_code) != 6: