Browse Source

修改讯飞语音识别

weicu
tanlongsheng 10 months ago
parent
commit
7d778e06f3
  1. 8
      local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt

8
local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt

@ -715,7 +715,7 @@ object AgentService : CoroutineScope {
}
override fun onResult(sessionid:String,result: String, detectedLanguage: String) {
Log.d(TAG, "liwei-------- onResult: $sessionid ")
Log.d(TAG, "liwei-------- onResult: $sessionid $result $currentRecognitionMode")
if (result.isNotEmpty()&&isKeepResult==true) {//加入是否结束要输出最后的结果判读
// 保存识别结果
if (currsessionAsrId.isEmpty()) {
@ -779,7 +779,7 @@ object AgentService : CoroutineScope {
override fun onSessionStopped(sessionid:String) {
Log.d(TAG, "liwei-------- onSessionStopped: $sessionid")
Log.d(TAG, "liwei-------- onSessionStopped: $sessionid $currsessionAsrId $recognitionResult $currentRecognitionMode")
if (currentRecognitionMode == "push_to_talk") { //按住说话
if (recognitionResult.isNotEmpty()){
sendEvent(
@ -854,14 +854,14 @@ object AgentService : CoroutineScope {
azureAsrHelper?.stopContinuousRecognition()
stopIdleCheck()
// 重置识别模式
currentRecognitionMode = "normal"
// currentRecognitionMode = "normal"
return
} catch (e: Exception) {
Log.e(TAG, "停止语音识别异常: ${e.message}")
_isRecognitionActive.set(false)
stopIdleCheck()
// 重置识别模式
currentRecognitionMode = "normal"
// currentRecognitionMode = "normal"
return
}
}

Loading…
Cancel
Save