From a816cdca48bd0c4a0818346f4c2b5b793fd646dd Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Fri, 27 Feb 2026 10:18:20 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E9=80=80=E5=87=BA=E5=93=84?= =?utf8?q?=E7=9D=A1bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/thunderbird/src/ThunderBirdModel.cpp | 7 +++++-- code/sdk/zhihui/leiniao/imsl_ln/ln_api_websocket.c | 6 +++++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp index a0cb8b0f9..b03f5b6fe 100644 --- a/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp +++ b/code/sdk/application/wearable/ln/nativeapp/nativeui/thunderbird/src/ThunderBirdModel.cpp @@ -3189,11 +3189,14 @@ extern "C" { ln_ws_end_audio_chat(); // 强制中断音频播放 // AI_ForceInterrupt(); + + //推送结束故事消息 + ln_ws_send_sleep_mode_end_ack(true, "哄睡模式结束"); + // 发送中断消息(通知服务器停止发送音频数据) ln_ws_send_voice_chat_interrupt("退出哄睡"); // 等待一小段时间,确保WebSocket线程处理完中断消息 - //推送结束故事消息 - ln_ws_send_sleep_mode_end_ack(true, "哄睡模式结束"); + // 音频deinit(清理音频资源) do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_AUDIO_DEINIT, NULL, 0); // 等待音频deinit完成,避免在音频清理过程中切换视图 diff --git a/code/sdk/zhihui/leiniao/imsl_ln/ln_api_websocket.c b/code/sdk/zhihui/leiniao/imsl_ln/ln_api_websocket.c index aed988ca4..aedd0e97b 100644 --- a/code/sdk/zhihui/leiniao/imsl_ln/ln_api_websocket.c +++ b/code/sdk/zhihui/leiniao/imsl_ln/ln_api_websocket.c @@ -1880,7 +1880,7 @@ int ln_ws_send_voice_chat_interrupt(const char *reason) } // 检查是否是退出对话场景 - bool is_exit_dialogue = (strcmp(reason, "退出对话") == 0); + bool is_exit_dialogue = (strcmp(reason, "退出对话") == 0 || strcmp(reason, "退出哄睡") == 0); // 检查是否需要在1秒内有数据时触发重连 bool need_reconnect = ln_ws_check_binary_data_interrupt(); @@ -2629,6 +2629,10 @@ static int ln_ws_parse_data_message(const char *json_str, ws_data_msg_t *data_ms data_msg->text_content, data_msg->audio_url, data_msg->audio_duration, data_msg->chat_id); } + if (data_msg->command == WS_CMD_SLEEP_MODE_END) + { + g_story_index=0; + } // 保存原始JSON字符串 data_msg->raw_json = (char*)malloc(strlen(json_str) + 1); if (data_msg->raw_json) { -- 2.17.1