From 9be2e3a239a4a174f7e0dce31c218bf253082280 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Mon, 26 May 2025 14:24:26 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E5=AF=BC=E8=88=AA?= =?UTF-8?q?=E5=92=8C=E6=89=93=E5=8C=85=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/modules/agent/controllers/agent_controller.dart | 2 +- pubspec.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/modules/agent/controllers/agent_controller.dart b/lib/modules/agent/controllers/agent_controller.dart index b2a387879..41529d8ea 100644 --- a/lib/modules/agent/controllers/agent_controller.dart +++ b/lib/modules/agent/controllers/agent_controller.dart @@ -456,7 +456,7 @@ class AgentController extends GetxController { final start = metaResult["card_navigation"]["start"] as String; final end = metaResult["card_navigation"]["end"] as String; // Logger.i(TAG, 'liwei-------- 打开导航页面: $start $end '); - Future.delayed(Duration(milliseconds: 1500), () { + Future.delayed(Duration(milliseconds: 2000), () { // Logger.i(TAG, 'liwei-------- 打开导航页面: $start $end '); // 2秒后执行的代码 openNavigation(start, end, ""); diff --git a/pubspec.yaml b/pubspec.yaml index f32b631d5..fd7ad853a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -25,7 +25,7 @@ dependencies: web_socket_channel: ^3.0.2 flutter_dotenv: ^5.1.0 synchronized: ^3.1.0 - intl: ^0.20.2 + intl: ^0.19.0 crypto: ^3.0.3 flutter_tts: ^4.2.2 logger: ^2.0.2+1 From 1777658bf99be11853d7480b80bfa6b08272f804 Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Tue, 27 May 2025 17:34:12 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/yunqiinnovation/open_ai_service/OpenAIService.kt | 6 +++--- .../open_ai_service/SystemFunctionHandler.kt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/OpenAIService.kt b/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/OpenAIService.kt index d5464724e..b04b9a0ab 100644 --- a/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/OpenAIService.kt +++ b/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/OpenAIService.kt @@ -679,7 +679,7 @@ class OpenAIService(private val context: Context? = null) : CoroutineScope { } } } - Log.d(TAG, "liwei---------------------- AI发起工具调用: tool=$toolCallsArray") + Log.i(TAG, "liwei---------------------- AI发起工具调用: tool=$toolCallsArray") } } @@ -706,7 +706,7 @@ class OpenAIService(private val context: Context? = null) : CoroutineScope { put("arguments", firstToolCall.arguments) put("id", firstToolCall.id) } - Log.d(TAG, "liwei---------------------- 工具调用: id=${firstToolCall.id}, name=${firstToolCall.name} arguments=${firstToolCall.arguments}") + Log.i(TAG, "liwei---------------------- 工具调用: id=${firstToolCall.id}, name=${firstToolCall.name} arguments=${firstToolCall.arguments}") // 通知上层工具调用事件 callback.onFunctionCall(functionCall) @@ -734,7 +734,7 @@ class OpenAIService(private val context: Context? = null) : CoroutineScope { val context = resultObj.optString("context", "工具调用失败").let { if (it.isNullOrEmpty()) "工具调用失败" else it } - Log.d(TAG, "liwei----------------------- mcp工具调用完成: name=${firstToolCall.name}, context=$context") + Log.i(TAG, "liwei----------------------- mcp工具调用完成: name=${firstToolCall.name}, context=$context") // 将结果发送回OpenAI继续对话 sendFunctionCallResult( diff --git a/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/SystemFunctionHandler.kt b/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/SystemFunctionHandler.kt index d56f3d77d..931e29810 100644 --- a/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/SystemFunctionHandler.kt +++ b/local_plugins/open_ai_service/android/src/main/kotlin/com/yunqiinnovation/open_ai_service/SystemFunctionHandler.kt @@ -332,8 +332,8 @@ class SystemFunctionHandler(private val context: Context) { */ private fun registerMediaPlayFunction(client: MCPClient) { client.registerLocalFunction( - "media_play", - "播放媒体", + "media_resume", + "继续媒体播放", JSONObject(""" { "type": "object", From 1571d2e8d86720a4ec113bd47aa5b9a87b27e27f Mon Sep 17 00:00:00 2001 From: liwei1dao Date: Thu, 29 May 2025 09:55:48 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=B8=8A=E4=BC=A0=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E8=BF=87=E6=BB=A4=E4=B8=8D=E6=92=AD=E6=8A=A5=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yunqiinnovation/azure_speech/AzureTtsHelper.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureTtsHelper.kt b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureTtsHelper.kt index 70227503f..b08fb0d50 100644 --- a/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureTtsHelper.kt +++ b/local_plugins/azure_speech/android/src/main/kotlin/com/yunqiinnovation/azure_speech/AzureTtsHelper.kt @@ -243,7 +243,15 @@ class AzureTtsHelper(private val context: Context) : ITtsService { )) } } - + //清洗播报语音内容 + fun cleanTextForTTS(text: String): String { + return text + .replace(Regex("https?://\\S+"), "") // 移除 URL + .replace(Regex("[\\p{Punct}]"), "") // 可选:移除标点符号(你可能不想全部移除) + .replace(Regex("[\uD83C-\uDBFF\uDC00-\uDFFF]+"), "") // 移除 emoji 表情 + .replace(Regex("\\s+"), " ") // 多个空格合并 + .trim() + } /** * 设置语音参数 */ @@ -372,8 +380,7 @@ class AzureTtsHelper(private val context: Context) : ITtsService { } lastSpeakTime = currentTime - val currentText = streamBuffer.toString() - + val currentText = cleanTextForTTS(streamBuffer.toString()) // 定义标点符号列表 val punctuationMarks = listOf('.', '。', '!', '!', '?', '?', ';', ';', ',', ',', ':', ':', '\n')