|
|
|
@ -182,6 +182,14 @@ class AgentServiceImpl: NSObject { |
|
|
|
self.callingTool = callingTool |
|
|
|
} |
|
|
|
|
|
|
|
//加载 isInterrupt 状态 |
|
|
|
loadIsInterruptFromCache() |
|
|
|
if let isttsinterrupt = config["isttsinterrupt"] as? String { |
|
|
|
if (isttsinterrupt == "true"){ |
|
|
|
self.isInterrupt = true |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if let serverurl = config["serverurl"] as? String { |
|
|
|
self.serverurl = serverurl |
|
|
|
} |
|
|
|
@ -256,8 +264,7 @@ class AgentServiceImpl: NSObject { |
|
|
|
|
|
|
|
if isInitialized { |
|
|
|
loadChatHistory() |
|
|
|
// 从 UserDefaults 加载 isInterrupt 状态 |
|
|
|
loadIsInterruptFromCache() |
|
|
|
|
|
|
|
} |
|
|
|
LocationService.shared.getCurrentLocation() { location in |
|
|
|
// self.locationInfo = location |
|
|
|
@ -552,7 +559,7 @@ class AgentServiceImpl: NSObject { |
|
|
|
return false |
|
|
|
} |
|
|
|
guard let audioStream = azureAsrHelper?.audioStream else { |
|
|
|
os_log("AI音频流未初始化", log: logger,type: .error) |
|
|
|
// os_log("AI音频流未初始化", log: logger,type: .error) |
|
|
|
return false |
|
|
|
} |
|
|
|
audioStream.saveAudioDataTo(data: audioData) |
|
|
|
@ -1880,9 +1887,12 @@ extension AgentServiceImpl: TtsEventListener { |
|
|
|
restartIdleCheck() |
|
|
|
sendEvent(name: "playback_started", data: ["status": "playback_started"]) |
|
|
|
MusicService.shared.reduceVolume() |
|
|
|
if(isInterrupt){ //播报开始。打断唤醒输入 |
|
|
|
BleService.shared.closeCodec() |
|
|
|
} |
|
|
|
case .playbackCompleted: |
|
|
|
restartIdleCheck() |
|
|
|
if(isInterrupt){ |
|
|
|
if(isInterrupt){//播报结束。打开解码器 |
|
|
|
BleService.shared.openB1Encoder() |
|
|
|
} |
|
|
|
sendEvent(name: "playback_completed", data: ["status": "playback_completed"]) |
|
|
|
|