From 12292681a996aa5b20d776323af922679a8a7bf9 Mon Sep 17 00:00:00 2001 From: luozheng <1732036298@qq.com> Date: Thu, 10 Jul 2025 10:15:23 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96tts=E6=92=AD=E6=94=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../fd230app/nativeui/aivoice/src/AiVoiceModel.cpp | 7 ++++--- .../fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp | 2 +- 2 files changed, 5 insertions(+), 4 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 11585bc1d..286d86136 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoiceModel.cpp @@ -755,7 +755,7 @@ namespace OHOS { const std::string punctuation = ",。!?;:))”、"; // 要替换的中文标点 const char replacement = ','; // 替换为英文逗号 - const size_t MAX_SEGMENT_LENGTH = 120; // 最大分段长度 + const size_t MAX_SEGMENT_LENGTH = 90; // 最大分段长度 const size_t MIN_SEGMENT_LENGTH = 1; // 最小发送长度(可调整) if (accumulatedText.empty()) @@ -1568,7 +1568,8 @@ namespace OHOS } if (get_bk_websocket_tts_tick() == 0) // 代表可以发录音文本 { - AiVoiceModel::GetInstance().ProcessTextByPunctuation(); + if (AiVoiceModel::GetInstance().GetInit_4gai_task()) + AiVoiceModel::GetInstance().ProcessTextByPunctuation(); } else { @@ -1630,7 +1631,7 @@ namespace OHOS // 检查定时器是否存在 if (g_ai4g_is_start_tts_play_Handle != nullptr) { - WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "stop_ai4g_tts_play_timer"); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "stop_ai4g_tts_play_timer"); osTimerStop(g_ai4g_is_start_tts_play_Handle); // 删除定时器并置为 nullptr osStatus_t ret = osTimerDelete(g_ai4g_is_start_tts_play_Handle); 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 27c3b0c45..852d99f02 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/aivoice/src/AiVoicePresenter.cpp @@ -405,8 +405,8 @@ namespace OHOS if (model->GetSelect4gorbt() == AI_SELECT_4G) { AiVoiceModel::GetInstance().stop_ai4g_tts_play_timer(); - uapi_UI_start_asr(); usleep(50000); + uapi_UI_start_asr(); ChangeViewAndLogicOperator(AIVOICE_RETURN_RESULT_TEXT_VIEWID, AIVOICE_AIMODE_CONNECTING); return true; } -- 2.17.1