Browse Source

修复退出ai聊天界面 是音乐恢复问题

newdev_shunjiawei
liwei1dao 10 months ago
parent
commit
608955662a
  1. 2
      local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt
  2. 4
      local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift

2
local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt

@ -1210,7 +1210,7 @@ object AgentService : CoroutineScope {
if (name == "exit_interaction") { if (name == "exit_interaction") {
BleService.closeCodec() BleService.closeCodec()
stopRecognition() stopRecognition()
}else if (name == "qqmusic_pause" || name == "music_pause"){ }else if (name == "qqmusic_pause" || name == "qqmusic_stop" || name == "music_pause" || name == "music_close"){
isplaymusic = false isplaymusic = false
} }
Log.d(TAG, "liwei--------------- AI Call onFunctionCall iscallingTool:$iscallingTool callingToolText:$callingToolText") Log.d(TAG, "liwei--------------- AI Call onFunctionCall iscallingTool:$iscallingTool callingToolText:$callingToolText")

4
local_plugins/agent_service/ios/agent_service/Sources/agent_service/AgentServiceImpl.swift

@ -39,7 +39,7 @@ class AgentServiceImpl: NSObject {
private var config: [String: Any] = [:] private var config: [String: Any] = [:]
// 添加音乐播放状态记录 // 添加音乐播放状态记录
private var wasMusicPlayingBeforeRecognition: Bool = false public var wasMusicPlayingBeforeRecognition: Bool = false
private var isSpeaking: Bool = false private var isSpeaking: Bool = false
@ -1811,6 +1811,8 @@ class ChatApiStreamCallback: StreamCallback {
// 关闭编码器 (设备侧) // 关闭编码器 (设备侧)
BleService.shared.closeCodec() BleService.shared.closeCodec()
agentService.stopRecognition() agentService.stopRecognition()
}else if (name == "qqmusic_pause" || name == "qqmusic_stop" || name == "music_pause" || name == "music_close"){ //
agentService.wasMusicPlayingBeforeRecognition = false
} }
try agentService.sendEvent(name: "function_call", data: [ try agentService.sendEvent(name: "function_call", data: [

Loading…
Cancel
Save