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();
{
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) {
}
// 检查是否是故事模式且已finished
+ // 注意:m_storyModeFinished在HandleStoryResponseFinished中已经通过了文本检查(不是"正在准备故事..."),
+ // 所以这里不需要再次检查文本,直接结束故事模式即可
if (currentView == THUNDERBIRD_LULLABYVIEW &&
currentSubView == ThunderBirdLullabyView::THUNDERBIRD_LULLABYVIEW_4 &&
m_storyModeFinished)
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 &&
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: 不满足推送条件 ");