From 73d174bc4ae2543f71c3f824204e0472b494b175 Mon Sep 17 00:00:00 2001 From: Sakura-RanChen <1908198662@qq.com> Date: Thu, 19 Mar 2026 16:18:30 +0800 Subject: [PATCH 1/7] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E9=98=9F=E5=88=97?= =?UTF-8?q?=E6=81=A2=E5=A4=8D=E6=97=B6=E9=9F=B3=E9=A2=91=E6=92=AD=E6=94=BE?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E9=94=99=E4=B9=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/xiaozhi-server/core/handle/sendAudioHandle.py | 2 ++ .../core/utils/audioRateController.py | 14 ++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/main/xiaozhi-server/core/handle/sendAudioHandle.py b/main/xiaozhi-server/core/handle/sendAudioHandle.py index 63a2411c..21cda9e6 100644 --- a/main/xiaozhi-server/core/handle/sendAudioHandle.py +++ b/main/xiaozhi-server/core/handle/sendAudioHandle.py @@ -280,6 +280,8 @@ async def send_tts_message(conn: "ConnectionHandler", state, text=None): await sendAudio(conn, audios) # 等待所有音频包发送完成 await _wait_for_audio_completion(conn) + # 停止音频发送循环 + conn.audio_rate_controller.stop_sending() # 清除服务端讲话状态 conn.clearSpeakStatus() diff --git a/main/xiaozhi-server/core/utils/audioRateController.py b/main/xiaozhi-server/core/utils/audioRateController.py index 01d71b05..29e203f2 100644 --- a/main/xiaozhi-server/core/utils/audioRateController.py +++ b/main/xiaozhi-server/core/utils/audioRateController.py @@ -43,6 +43,14 @@ class AudioRateController: def add_audio(self, opus_packet): """添加音频包到队列""" + # 如果队列之前为空,需要调整时间戳以保持播放时间连续 + # 这样工具调用等待期间,新加入的音频不会提前播放 + if len(self.queue) == 0 and self.play_position > 0: + self.start_timestamp = time.monotonic() - (self.play_position / 1000) + self.logger.bind(tag=TAG).debug( + f"队列从空恢复,重置时间戳,当前播放位置: {self.play_position}ms" + ) + self.queue.append(("audio", opus_packet)) # 相关事件处理 self.queue_empty_event.clear() @@ -55,6 +63,12 @@ class AudioRateController: Args: message_callback: 消息发送回调函数 async def() """ + if len(self.queue) == 0 and self.play_position > 0: + self.start_timestamp = time.monotonic() - (self.play_position / 1000) + self.logger.bind(tag=TAG).debug( + f"队列从空恢复,重置时间戳,当前播放位置: {self.play_position}ms" + ) + self.queue.append(("message", message_callback)) # 相关事件处理 self.queue_empty_event.clear() From 52f5859b1fcc5ec91f6b9787c32cca5f772b2717 Mon Sep 17 00:00:00 2001 From: zhuoqinglian <1035449612@qq.com> Date: Thu, 19 Mar 2026 17:56:27 +0800 Subject: [PATCH 2/7] =?UTF-8?q?update:=20mobile=20=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E4=BD=93=E7=AE=A1=E7=90=86=E5=A4=9A=E8=AF=AD=E8=A8=80=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main/manager-mobile/src/i18n/de.ts | 6 +-- main/manager-mobile/src/i18n/en.ts | 2 +- main/manager-mobile/src/i18n/pt_BR.ts | 2 +- main/manager-mobile/src/i18n/vi.ts | 2 +- main/manager-mobile/src/pages/agent/edit.vue | 10 +++++ main/manager-mobile/src/pages/agent/tools.vue | 12 ++++-- .../src/pages/voiceprint/index.vue | 38 ++++++++++++++----- 7 files changed, 53 insertions(+), 19 deletions(-) diff --git a/main/manager-mobile/src/i18n/de.ts b/main/manager-mobile/src/i18n/de.ts index aa048248..0a409adb 100644 --- a/main/manager-mobile/src/i18n/de.ts +++ b/main/manager-mobile/src/i18n/de.ts @@ -85,7 +85,7 @@ export default { 'agent.chatHistory': 'Chat-Verlauf', 'agent.voiceprintManagement': 'Stimmabdruckverwaltung', 'agent.editTitle': 'Agent bearbeiten', - 'agent.toolsTitle': 'Funktionen bearbeiten', + 'agent.toolsTitle': 'Bearbeiten', 'agent.voiceActivityDetection': 'Sprachaktivitätserkennung', 'agent.speechRecognition': 'Spracherkennung', 'agent.largeLanguageModel': 'Großes Sprachmodell', @@ -116,7 +116,7 @@ export default { 'agent.tts': 'Text-zu-Sprache', 'agent.voiceprint': 'Agenten-Stimme', 'agent.plugins': 'Plugins', - 'agent.editFunctions': 'Funktionen bearbeiten', + 'agent.editFunctions': 'Bearbeiten', 'agent.historyMemory': 'Verlaufsspeicher', 'agent.memoryContent': 'Speicherinhalt', 'agent.saving': 'Wird gespeichert...', @@ -371,7 +371,7 @@ export default { 'agent.tools.mcpAccessPoint': 'MCP-Zugangspunkt', 'agent.tools.copy': 'Kopieren', 'agent.tools.noTools': 'Keine Werkzeuge verfügbar', - 'agent.tools.parameterConfig': 'Parameterkonfiguration', + 'agent.tools.parameterConfig': 'Konfig', 'agent.tools.noParamsNeeded': 'Keine Parameter benötigt', 'agent.tools.pleaseInput': 'Bitte eingeben', 'agent.tools.inputOneItemPerLine': 'Ein Element pro Zeile eingeben', diff --git a/main/manager-mobile/src/i18n/en.ts b/main/manager-mobile/src/i18n/en.ts index f0fe4c14..af1dddc6 100644 --- a/main/manager-mobile/src/i18n/en.ts +++ b/main/manager-mobile/src/i18n/en.ts @@ -371,7 +371,7 @@ export default { 'agent.tools.mcpAccessPoint': 'MCP Access Point', 'agent.tools.copy': 'Copy', 'agent.tools.noTools': 'No tools available', - 'agent.tools.parameterConfig': 'Parameter Configuration', + 'agent.tools.parameterConfig': 'Param Config', 'agent.tools.noParamsNeeded': 'No parameters needed', 'agent.tools.pleaseInput': 'Please input', 'agent.tools.inputOneItemPerLine': 'Input one item per line', diff --git a/main/manager-mobile/src/i18n/pt_BR.ts b/main/manager-mobile/src/i18n/pt_BR.ts index 2901583b..b8bc979f 100644 --- a/main/manager-mobile/src/i18n/pt_BR.ts +++ b/main/manager-mobile/src/i18n/pt_BR.ts @@ -371,7 +371,7 @@ export default { 'agent.tools.mcpAccessPoint': 'Ponto de Acesso MCP', 'agent.tools.copy': 'Copiar', 'agent.tools.noTools': 'Nenhuma ferramenta disponível', - 'agent.tools.parameterConfig': 'Configuração de Parâmetros', + 'agent.tools.parameterConfig': 'Configuração', 'agent.tools.noParamsNeeded': 'Nenhum parâmetro necessário', 'agent.tools.pleaseInput': 'Por favor, insira', 'agent.tools.inputOneItemPerLine': 'Insira um item por linha', diff --git a/main/manager-mobile/src/i18n/vi.ts b/main/manager-mobile/src/i18n/vi.ts index e9406afe..cbb790f7 100644 --- a/main/manager-mobile/src/i18n/vi.ts +++ b/main/manager-mobile/src/i18n/vi.ts @@ -371,7 +371,7 @@ export default { 'agent.tools.mcpAccessPoint': 'Điểm truy cập MCP', 'agent.tools.copy': 'Sao chép', 'agent.tools.noTools': 'Không có công cụ nào', - 'agent.tools.parameterConfig': 'Cấu hình tham số', + 'agent.tools.parameterConfig': 'Cấu hình', 'agent.tools.noParamsNeeded': 'Không cần tham số', 'agent.tools.pleaseInput': 'Vui lòng nhập', 'agent.tools.inputOneItemPerLine': 'Nhập một mục mỗi dòng', diff --git a/main/manager-mobile/src/pages/agent/edit.vue b/main/manager-mobile/src/pages/agent/edit.vue index 93e715ca..112a48a2 100644 --- a/main/manager-mobile/src/pages/agent/edit.vue +++ b/main/manager-mobile/src/pages/agent/edit.vue @@ -1006,6 +1006,7 @@ onMounted(async () => { @@ -1059,4 +1060,13 @@ onMounted(async () => { background: transparent !important; } } +::v-deep .custom-sheet-tts { + .wd-action-sheet { + padding: 8px 0 !important; + overflow: hidden; + } + .wd-action-sheet__actions { + padding: 0 !important; + } +} diff --git a/main/manager-mobile/src/pages/agent/tools.vue b/main/manager-mobile/src/pages/agent/tools.vue index ab0b595b..fb47deae 100644 --- a/main/manager-mobile/src/pages/agent/tools.vue +++ b/main/manager-mobile/src/pages/agent/tools.vue @@ -311,7 +311,7 @@ onMounted(async () => { v-if="notSelectedList.length === 0" class="h-[400rpx] flex items-center justify-center" > - + { v-if="selectedList.length === 0" class="h-[400rpx] flex items-center justify-center" > - + { @@ -586,3 +586,9 @@ onMounted(async () => { + + diff --git a/main/manager-mobile/src/pages/voiceprint/index.vue b/main/manager-mobile/src/pages/voiceprint/index.vue index e0917c98..a00711a5 100644 --- a/main/manager-mobile/src/pages/voiceprint/index.vue +++ b/main/manager-mobile/src/pages/voiceprint/index.vue @@ -460,8 +460,11 @@ defineExpose({ - - * {{ t('voiceprint.voiceVector') }} + + + * + + {{ t('voiceprint.voiceVector') }} - - * {{ t('voiceprint.name') }} + + + * + + {{ t('voiceprint.name') }} - - * {{ t('voiceprint.description') }} + + + * + + {{ t('voiceprint.description') }}