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 34e162387..5a050b840 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 @@ -1344,11 +1344,17 @@ class ChatApiStreamCallback: StreamCallback { os_log("收到函数调用: %{public}@", log: agentService.logger, type: .info, name) print("onFunctionCall=functionCall\(functionCall)") + if (name == "exit_interaction") { + agentService.stopRecognition() + } + try agentService.sendEvent(name: "function_call", data: [ "name": name, "arguments": functionCall ]) + + }catch{ print("liwei--------------- AI Call onFunctionCall 异常: \(error)") } @@ -1523,7 +1529,7 @@ class AudioPlayer { } func playStopSound() { -// playSound(named: "stop", fileType: "mp3") + playSound(named: "stop", fileType: "mp3") } func playCallingSound() { diff --git a/local_plugins/azure_speech/ios/azure_speech/Sources/tools/SimpleAudioReceiver.swift b/local_plugins/azure_speech/ios/azure_speech/Sources/tools/SimpleAudioReceiver.swift index dbe76a6e6..da992a1df 100644 --- a/local_plugins/azure_speech/ios/azure_speech/Sources/tools/SimpleAudioReceiver.swift +++ b/local_plugins/azure_speech/ios/azure_speech/Sources/tools/SimpleAudioReceiver.swift @@ -168,7 +168,9 @@ public class SimpleAudioReceiver: NSObject { print("写入数据长度: \(dataToWrite.count)") self.audioDataCallback!.onAudio(dataToWrite) } - try self.pushAudioStream?.write(dataToWrite) + if self.pushAudioStream != nil && self.audioDataCallback == nil { + try self.pushAudioStream?.write(dataToWrite) + } if self.recordfile != nil { // print("写入recordfile数据长度: \(dataToWrite.count)") recordfile?.saveAudioDataToWav(dataToWrite)