From 15d1c3a42d3ca7cec74d7a1bbb3f18598f22d099 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 6 Jan 2026 16:08:08 +0800 Subject: [PATCH] =?UTF-8?q?style(agent=5Fservice):=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E4=BB=A3=E7=A0=81=E7=BC=A9=E8=BF=9B=E5=92=8C=E6=A0=BC=E5=BC=8F?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../agent_service/AgentService.kt | 72 +++++++++---------- 1 file changed, 36 insertions(+), 36 deletions(-) diff --git a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt index 4068b7255..fedf86d19 100644 --- a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt +++ b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt @@ -741,8 +741,8 @@ object AgentService : CoroutineScope { } var text = result - if(text.isNotEmpty()) - { + if(text.isNotEmpty()) + { text = text.replace(Regex("^[,。?、!, . ? !]+"), "") recognitionResult += text } @@ -752,45 +752,45 @@ object AgentService : CoroutineScope { } if (recognitionResult.isNotEmpty()) { - if (currentRecognitionMode == "push_to_talk") { //按住说话 - sendEvent( - "recognizing", mapOf( - "sessionid" to currsessionAsrId, - "text" to recognitionResult, - "language" to detectedLanguage + if (currentRecognitionMode == "push_to_talk") { //按住说话 + sendEvent( + "recognizing", mapOf( + "sessionid" to currsessionAsrId, + "text" to recognitionResult, + "language" to detectedLanguage + ) ) - ) - }else{ - pendingProcessJob?.cancel() - sendEvent( - "recognizing", mapOf( - "sessionid" to currsessionAsrId, - "text" to recognitionResult, - "language" to detectedLanguage + }else{ + pendingProcessJob?.cancel() + sendEvent( + "recognizing", mapOf( + "sessionid" to currsessionAsrId, + "text" to recognitionResult, + "language" to detectedLanguage + ) ) - ) - pendingProcessJob = launch { - delay(1500) - sendEvent( - "recognition_result", mapOf( - "sessionid" to currsessionAsrId, - "text" to recognitionResult, - "language" to detectedLanguage + pendingProcessJob = launch { + delay(1500) + sendEvent( + "recognition_result", mapOf( + "sessionid" to currsessionAsrId, + "text" to recognitionResult, + "language" to detectedLanguage + ) ) - ) - recognitionResult = "" - currsessionAsrId = "" - - processWithChatApi(currsessionAsrId, recognitionResult) - + recognitionResult = "" + currsessionAsrId = "" + + processWithChatApi(currsessionAsrId, recognitionResult) + + } } } - } - else - { - Log.d(TAG, "liwei-------- onResult: $sessionid $result $currentRecognitionMode 空字符串") - } - // } + else + { + Log.d(TAG, "liwei-------- onResult: $sessionid $result $currentRecognitionMode 空字符串") + } + } _hasSpeechDetected.set(false) restartIdleCheck()