diff --git a/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift b/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift index e8aeebc20..6a3fdbdc6 100644 --- a/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift +++ b/local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift @@ -2190,7 +2190,11 @@ extension AgentServiceImpl: AzureAsrHelper.ContinuousRecognizeCallback { if currsessionAsrId.isEmpty { currsessionAsrId = sessionid } - recognitionResult += text + var processedText = text + if recognitionResult.isEmpty { + processedText = processedText.replacingOccurrences(of: "^[,。?、!, . ? !]+", with: "", options: .regularExpression) + } + recognitionResult += processedText if (currentRecognitionMode == "push_to_talk") { //按住说话 var data: [String: Any] = [ "sessionid": currsessionAsrId, diff --git a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/XunFeiAsrHelper.swift b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/XunFeiAsrHelper.swift index 9f8dbdde2..3ec31244c 100644 --- a/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/XunFeiAsrHelper.swift +++ b/local_plugins/azure_speech/ios/azure_speech/Sources/azure_speech/XunFeiAsrHelper.swift @@ -220,6 +220,7 @@ class XunFeiAsrHelper: NSObject, URLSessionWebSocketDelegate { } if ls && wordCount == 0 && punctuationCount == 1 { + callback?.onSessionStopped(sessionid: currentSessionId) return }