Browse Source

修改讯飞语音识别

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

Loading…
Cancel
Save