From 5839bc68e0efb4362ff03eeb8e210b278b4ce3df Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Fri, 19 Dec 2025 14:41:10 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=8D=8F=E8=AE=AE=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunqiinnovation/agent_service/AgentService.kt | 10 ++++------ .../Sources/agent_service/AgentServiceImpl.swift | 10 +++++----- 2 files changed, 9 insertions(+), 11 deletions(-) diff --git a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt index acbd4f4f1..7c7bb967c 100644 --- a/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt +++ b/local_plugins/agent_service/android/src/main/kotlin/com/yunqiinnovation/agent_service/AgentService.kt @@ -383,7 +383,7 @@ object AgentService : CoroutineScope { restartIdleCheck() sendEvent("tts_started", mapOf("status" to "started")) // 停止气泡音,避免与TTS同时播放 - // audioPlayer?.stopAudio() + } TtsEventType.SYNTHESIS_COMPLETED -> { @@ -404,7 +404,7 @@ object AgentService : CoroutineScope { restartIdleCheck() sendEvent("playback_started", mapOf("status" to "playback_started")) // 确保气泡音已停止,避免与TTS播放重叠 - // audioPlayer?.stopAudio() + audioPlayer?.stopAudio() if(_isInterrupt.get()){ BleService.closeCodec() } @@ -1119,7 +1119,7 @@ object AgentService : CoroutineScope { if (reply && token.isNotEmpty()) { // 发送流式回复token sendEvent("assistant_token", mapOf("sessionid" to sessionid,"token" to token)) - audioPlayer?.stopAudio() + // audioPlayer?.stopAudio() } } catch (e: Exception) { Log.e(TAG, "liwei--------------- AI Call onToken 异常", e) @@ -1231,9 +1231,7 @@ object AgentService : CoroutineScope { try { Log.d( TAG, - "liwei--------------- AI Call onFunctionCallResult ${sessionid}:${functionCallResult.toString()}", - - ) + "liwei--------------- AI Call onFunctionCallResult ${sessionid}:${functionCallResult.toString()}",) audioPlayer?.stopAudio() val name = functionCall.get("name") as String; val resultmap = autoHandleFcunCallResult(name, functionCallResult); 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 bc5c8bcab..e8aeebc20 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 @@ -1701,9 +1701,9 @@ class ChatApiStreamCallback: StreamCallback { return } - if (token != "" && responseBuilder.isEmpty) { //关闭声音 - try agentService.audioPlayer?.stopAwaitSound() - } +// if (token != "" && responseBuilder.isEmpty) { //关闭声音 +// try agentService.audioPlayer?.stopAwaitSound() +// } responseBuilder += token if speakResponse && reply && broadcast{ @@ -1892,8 +1892,7 @@ extension AgentServiceImpl: TtsEventListener { isSpeaking = true restartIdleCheck() sendEvent(name: "tts_started", data: ["status": "started"]) - // audioPlayer?.stopAwaitSound() - + case .synthesisCompleted: isSpeaking = false restartIdleCheck() @@ -1902,6 +1901,7 @@ extension AgentServiceImpl: TtsEventListener { case .playbackStarted: restartIdleCheck() sendEvent(name: "playback_started", data: ["status": "playback_started"]) + audioPlayer?.stopAwaitSound() MusicService.shared.reduceVolume() if(isInterrupt){ //播报开始。打断唤醒输入 BleService.shared.closeCodec()