From ea351d705495a004b631a2b381b627eaea1915e3 Mon Sep 17 00:00:00 2001 From: xue <2144439972@qq.com> Date: Mon, 1 Dec 2025 18:01:29 +0800 Subject: [PATCH] =?utf8?q?=E4=BF=AE=E5=A4=8D=E8=A7=92=E8=89=B2=E8=AF=B4?= =?utf8?q?=E8=AF=9D=E5=AE=8C=E6=AF=95=E5=AF=BC=E8=87=B4=E7=9A=84=E5=88=A4?= =?utf8?q?=E6=96=AD=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../thunderbird/src/ThunderBirdModel.cpp | 40 ++++++++++++++++--- 1 file changed, 34 insertions(+), 6 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 0e58d992d..726ed6be3 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 @@ -2747,6 +2747,8 @@ extern "C" { if(is_intention_result == 0) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleSleepModeStart: 非意图识别结果,跳转到4"); + // 重置故事模式finished标志,确保每次进入故事模式时标志位是干净的 + m_storyModeFinished = false; ThunderBirdMainView::GetInstance()->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4); //清空文本队列 ClearAudioTextQueue(); @@ -2802,10 +2804,28 @@ extern "C" { { if (finished) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleStoryResponseFinished: 收到故事模式finished=true"); + + // 检查当前文本是否为"正在准备故事...",只有不是默认文本时才认为是真正的finished + ThunderBirdLullabyView *lullabyView = ThunderBirdLullabyView::GetInstance(); + if (lullabyView != nullptr) { + std::string currentText = lullabyView->GetCurrentText(); + if (currentText == "正在准备故事...") { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleStoryResponseFinished: 当前文本为'正在准备故事...',忽略finished信号"); + return; // 忽略这个finished信号 + } + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleStoryResponseFinished: 当前文本为'%s',确认为真正的finished", currentText.c_str()); + } + m_storyModeFinished = true; } } + void ThunderBirdModel::ResetStoryModeFinished(void) + { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::ResetStoryModeFinished: 重置故事模式finished标志"); + m_storyModeFinished = false; + } + void ThunderBirdModel::HandleDialogueResponseFinished(bool finished) { if (finished) { @@ -2992,6 +3012,8 @@ extern "C" { } // 检查是否是故事模式且已finished + // 注意:m_storyModeFinished在HandleStoryResponseFinished中已经通过了文本检查(不是"正在准备故事..."), + // 所以这里不需要再次检查文本,直接结束故事模式即可 if (currentView == THUNDERBIRD_LULLABYVIEW && currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4 && m_storyModeFinished) @@ -3026,10 +3048,14 @@ extern "C" { int16_t currentView = view->GetCurrentView(); int16_t currentSubView = view->GetCurrentSubView(); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioRecordingStart: currentView=%d, currentSubView=%d", currentView, currentSubView); - // 如果当前在对话界面,且不在聆听状态,则跳转到聆听状态 - //如果是哄睡界面,则不进行处理 - if(currentView == THUNDERBIRD_LULLABYVIEW && currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3) + // 如果当前在哄睡界面(包括故事选择界面和故事模式),则不进行处理 + // THUNDERBIRD_LULLABYVIEW_3: 故事选择界面(VAD已关闭) + // THUNDERBIRD_LULLABYVIEW_4: 故事模式(VAD已关闭) + if(currentView == THUNDERBIRD_LULLABYVIEW && + (currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3 || + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4)) { + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioRecordingStart: 在哄睡界面(故事模式),忽略录音开始事件"); return; } if ((currentView == THUNDERBIRD_DIALOGUEVIEW && @@ -3070,9 +3096,11 @@ extern "C" { view->ChangeView(currentView, THUNDERBIRD_DIALOGUEVIEW, ThunderBirdDialogueView::THUNDERBIRD_DIALOGUEVIEW_SPEAKING); } else if (currentView == THUNDERBIRD_LULLABYVIEW && - currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3) { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "录音结束,跳转到故事选择界面"); - view->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4); + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_3 || + currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4) { + // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "录音结束,跳转到故事选择界面"); + // view->ChangeView(currentView, THUNDERBIRD_LULLABYVIEW, ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4); + return; } else{ WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ThunderBirdModel::HandleAudioRecordingEnd: 不满足推送条件 "); -- 2.17.1