From bc2fdb23d5d6bb02c02bd14f70460739d416e474 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 26 Jun 2025 16:20:36 +0800 Subject: [PATCH] =?utf8?q?4GAI=E6=B7=BB=E5=8A=A0=E9=87=8D=E8=BF=9E?= =?utf8?q?=E9=80=BB=E8=BE=91=EF=BC=8C=E5=BE=85=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../nativeui/aivoice/src/AiVoiceModel.cpp | 22 ++++++++++++++----- .../nativeui/aivoice/src/AiVoicePresenter.cpp | 4 ++-- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp index a2ca19cda..cca2e5473 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -676,7 +676,7 @@ namespace OHOS WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "停止录音"); if (GetSelect4gorbt() == AI_SELECT_4G) // 选的是4G需要关闭asr { - uapi_stop_asr(); + // uapi_stop_asr(); stop_AudioCaptureProcess_AI(); } else if (GetSelect4gorbt() == AI_SELECT_BT) @@ -1153,11 +1153,7 @@ namespace OHOS { if (view_ != nullptr && p_AiVoicePresenter != nullptr) { - uint8_t asr_state = 0; - uint8_t chat_state = 0; - asr_state = get_ai_asr_service_init_flag(); - chat_state = get_ai_chat_service_init_flag(); - if (asr_state == 1 && chat_state == 1) + if (AiVoiceModel::GetInstance().GetInit_4gai_task()) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "4gAi服务初始化成功"); bool state = true; @@ -1345,6 +1341,20 @@ namespace OHOS bool AiVoiceModel::GetInit_4gai_task(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "AiVoiceModel::GetInit_4gai_task %d", init_4gai_task); + uint8_t asr_state = 0; + uint8_t chat_state = 0; + uint8_t tts_state = 0; + asr_state = get_ai_asr_service_init_flag(); + chat_state = get_ai_chat_service_init_flag(); + tts_state = get_ai_tts_server_init_flag(); + if (asr_state == 1 && chat_state == 1 && tts_state == 1) + { + init_4gai_task = true; + } + else + { + init_4gai_task = false; + } return init_4gai_task; } diff --git a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp index 23835cdac..15c5307f4 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -469,9 +469,9 @@ namespace OHOS { // 通过4G调用大模型 model->SetSelect4gorbt(AI_SELECT_4G); - init_ai_task(); if (!model->GetInit_4gai_task()) { + init_ai_task(); model->start_ai4g_connect_timer(); ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_4GSERVICECON_VIEW); // LOADING } @@ -505,9 +505,9 @@ namespace OHOS { // 通过4G调用大模型 model->SetSelect4gorbt(AI_SELECT_4G); - init_ai_task(); if (!model->GetInit_4gai_task()) { + init_ai_task(); model->start_ai4g_connect_timer(); ChangeViewAndLogicOperator(AIVOICE_STARTCHAT_VIEWID, AIVOICE_4GSERVICECON_VIEW); // LOADING } -- 2.17.1