From ae333eaff45224f227b36812ff465de3618657ef Mon Sep 17 00:00:00 2001 From: tanlongsheng <252620078@qq.com> Date: Sat, 20 Dec 2025 10:48:12 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9ios=E8=AE=AF=E9=A3=9E?= =?UTF-8?q?=E8=AF=AD=E9=9F=B3=E8=AF=86=E5=88=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Sources/agent_service/AgentServiceImpl.swift | 6 +++++- .../azure_speech/Sources/azure_speech/XunFeiAsrHelper.swift | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) 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 }