From ccc77799d9f76a112ae99024707408b2b0e10243 Mon Sep 17 00:00:00 2001 From: shinjiyu Date: Wed, 28 Oct 2026 06:02:21 +0800 Subject: [PATCH 1/2] =?UTF-8?q?fix(config):=20=E7=BA=A0=E6=AD=A3=20AliLLM?= =?UTF-8?q?=20=E5=8D=A0=E4=BD=8D=E6=96=87=E6=A1=88=E4=B8=8E=20PaddleSpeech?= =?UTF-8?q?=20=E5=8D=8F=E8=AE=AE=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AliLLM 的 api_key 占位误写成 deepseek,照抄会把错误 key 填进百炼(#3495) - PaddleSpeechTTS 实际只实现 websocket,去掉 config/报错里对 http 的承诺(#3503) --- main/xiaozhi-server/config.yaml | 6 +++--- main/xiaozhi-server/core/providers/tts/paddle_speech.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index 17329459a..be2b2bb73 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -619,7 +619,7 @@ LLM: # 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key base_url: https://dashscope.aliyuncs.com/compatible-mode/v1 model_name: qwen-flash - api_key: 你的deepseek web key + api_key: 你的api_key temperature: 0.7 # 温度值 max_tokens: 500 # 最大生成token数 top_p: 1 @@ -1117,8 +1117,8 @@ TTS: #SpeechServerDemo https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/speech_server #流式传输请参考 https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-WebSocket-API type: paddle_speech - protocol: websocket # protocol choices = ['websocket', 'http'] - url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务的 URL 地址,指向本地服务器 [websocket默认ws://127.0.0.1:8092/paddlespeech/tts/streaming,http默认http://127.0.0.1:8090/paddlespeech/tts] + protocol: websocket # 当前仅实现 websocket + url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务的 URL 地址,指向本地服务器 [websocket 默认 ws://127.0.0.1:8092/paddlespeech/tts/streaming] spk_id: 0 # 发音人 ID,0 通常表示默认的发音人 speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢 volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小 diff --git a/main/xiaozhi-server/core/providers/tts/paddle_speech.py b/main/xiaozhi-server/core/providers/tts/paddle_speech.py index e9562d60e..52cb88295 100644 --- a/main/xiaozhi-server/core/providers/tts/paddle_speech.py +++ b/main/xiaozhi-server/core/providers/tts/paddle_speech.py @@ -82,7 +82,7 @@ class TTSProvider(TTSProviderBase): if self.protocol == "websocket": return await self.text_streaming(text, output_file) else: - raise ValueError("Unsupported protocol. Please use 'websocket' or 'http'.") + raise ValueError("Unsupported protocol. Please use 'websocket'.") async def text_streaming(self, text, output_file): try: From 1ac4c099460b71c69ab298a25555089a172f0edd Mon Sep 17 00:00:00 2001 From: shinjiyu <6233416+shinjiyu@users.noreply.github.com> Date: Fri, 30 Oct 2026 20:55:56 +0800 Subject: [PATCH 2/2] =?UTF-8?q?fix(config):=20=E6=8C=89=E5=AE=A1=E6=A0=B8?= =?UTF-8?q?=E6=84=8F=E8=A7=81=E8=A1=A5=E9=BD=90=E5=8D=A0=E4=BD=8D=E6=96=87?= =?UTF-8?q?=E6=A1=88=E4=B8=8E=20PaddleSpeech=20=E5=8D=8F=E8=AE=AE=E6=94=B6?= =?UTF-8?q?=E6=95=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - AliLLM 占位改为「你的阿里云百炼API密钥」;ASR 段「语音合成」改为「语音识别」;XunfeiSparkLLM 占位改为 api_key - PaddleSpeech:启动时校验 protocol;代码兜底 URL 与 config 对齐为本机;智控台新增 changeset 去掉 http 选项 --- .../resources/db/changelog/202610302051.sql | 22 +++++++++++++++ .../db/changelog/db.changelog-master.yaml | 7 +++++ main/xiaozhi-server/config.yaml | 28 +++++++++---------- .../core/providers/tts/paddle_speech.py | 6 ++-- 4 files changed, 47 insertions(+), 16 deletions(-) create mode 100644 main/manager-api/src/main/resources/db/changelog/202610302051.sql diff --git a/main/manager-api/src/main/resources/db/changelog/202610302051.sql b/main/manager-api/src/main/resources/db/changelog/202610302051.sql new file mode 100644 index 000000000..797ca7733 --- /dev/null +++ b/main/manager-api/src/main/resources/db/changelog/202610302051.sql @@ -0,0 +1,22 @@ +-- PaddleSpeechTTS:智控台协议收敛为仅 websocket(与 xiaozhi-server 实现一致) + +UPDATE `ai_model_provider` +SET `fields` = JSON_ARRAY( + JSON_OBJECT('key', 'protocol', 'label', '协议类型', 'type', 'string', 'options', JSON_ARRAY('websocket')), + JSON_OBJECT('key', 'url', 'label', '服务地址', 'type', 'string'), + JSON_OBJECT('key', 'spk_id', 'label', '音色', 'type', 'int'), + JSON_OBJECT('key', 'sample_rate', 'label', '采样率', 'type', 'float'), + JSON_OBJECT('key', 'speed', 'label', '语速', 'type', 'float'), + JSON_OBJECT('key', 'volume', 'label', '音量', 'type', 'float'), + JSON_OBJECT('key', 'save_path', 'label', '保存路径', 'type', 'string') +) +WHERE `id` = 'SYSTEM_TTS_PaddleSpeechTTS'; + +UPDATE `ai_model_config` +SET `remark` = 'PaddleSpeechTTS 配置说明: +1. PaddleSpeech 是百度飞桨开源的语音合成工具,支持本地离线部署和模型训练。paddlepaddle百度飞浆框架地址:https://www.paddlepaddle.org.cn/ +2. 当前仅支持 WebSocket 协议进行流式传输(参考部署文档:https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/paddlespeech-deploy.md)。 +3. 使用前要在本地部署 paddlespeech 服务,服务默认运行在 ws://127.0.0.1:8092/paddlespeech/tts/streaming +4. 支持自定义发音人、语速、音量和采样率。 +' +WHERE `id` = 'TTS_PaddleSpeechTTS'; diff --git a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml index 282fbaf48..1b2eb615a 100644 --- a/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml +++ b/main/manager-api/src/main/resources/db/changelog/db.changelog-master.yaml @@ -753,3 +753,10 @@ databaseChangeLog: - sqlFile: encoding: utf8 path: classpath:db/changelog/202609172100.sql + - changeSet: + id: 202610302051 + author: shinjiyu + changes: + - sqlFile: + encoding: utf8 + path: classpath:db/changelog/202610302051.sql diff --git a/main/xiaozhi-server/config.yaml b/main/xiaozhi-server/config.yaml index be2b2bb73..2ba213e14 100644 --- a/main/xiaozhi-server/config.yaml +++ b/main/xiaozhi-server/config.yaml @@ -398,8 +398,8 @@ ASR: # DoubaoASR和DoubaoStreamASR的区别是:DoubaoASR是按次收费,DoubaoStreamASR是按时收费 # 一般来说按次收费的更便宜,但是DoubaoStreamASR使用了大模型技术,效果更好 type: doubao - appid: 你的火山引擎语音合成服务appid - access_token: 你的火山引擎语音合成服务access_token + appid: 你的火山引擎语音识别服务appid + access_token: 你的火山引擎语音识别服务access_token cluster: volcengine_input_common # 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738 boosting_table_name: (选填)你的热词文件名称 @@ -412,8 +412,8 @@ ASR: # 开通地址https://console.volcengine.com/speech/service/10011 # 一般来说按次收费的更便宜,但是DoubaoStreamASR使用了大模型技术,效果更好 type: doubao_stream - appid: 你的火山引擎语音合成服务appid - access_token: 你的火山引擎语音合成服务access_token + appid: 你的火山引擎语音识别服务appid + access_token: 你的火山引擎语音识别服务access_token # 资源ID:小时版 volc.bigasr.sauc.duration,并发版 volc.bigasr.sauc.concurrent resource_id: volc.bigasr.sauc.duration # 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738 @@ -432,8 +432,8 @@ ASR: # 开通地址:https://console.volcengine.com/speech/service/10038 # 价格更为便宜,建议在高并发场景下使用 type: doubao_stream - appid: 你的火山引擎语音合成服务appid - access_token: 你的火山引擎语音合成服务access_token + appid: 你的火山引擎语音识别服务appid + access_token: 你的火山引擎语音识别服务access_token # 资源ID:小时版 volc.seedasr.sauc.duration,并发版 volc.seedasr.sauc.concurrent resource_id: volc.seedasr.sauc.duration # 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738 @@ -451,9 +451,9 @@ ASR: # token申请地址:https://console.cloud.tencent.com/cam/capi # 免费领取资源:https://console.cloud.tencent.com/asr/resourcebundle type: tencent - appid: 你的腾讯语音合成服务appid - secret_id: 你的腾讯语音合成服务secret_id - secret_key: 你的腾讯语音合成服务secret_key + appid: 你的腾讯语音识别服务appid + secret_id: 你的腾讯语音识别服务secret_id + secret_key: 你的腾讯语音识别服务secret_key output_dir: tmp/ AliyunASR: # 阿里云智能语音交互服务,需要先在阿里云平台开通服务,然后获取验证信息 @@ -619,7 +619,7 @@ LLM: # 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key base_url: https://dashscope.aliyuncs.com/compatible-mode/v1 model_name: qwen-flash - api_key: 你的api_key + api_key: 你的阿里云百炼API密钥 temperature: 0.7 # 温度值 max_tokens: 500 # 最大生成token数 top_p: 1 @@ -763,10 +763,10 @@ VLLM: # 先新建应用,在下面的地址 # 开通应用地址:https://console.xfyun.cn/app/myapp # 有免费额度,但也要开通服务,才能获取api_key - # 每一个模型都需要单独开通,每一个模型的api_password都不同,例如Lite模型在https://console.xfyun.cn/services/cbm 开通 + # 每一个模型都需要单独开通,每一个模型的 api_key 都不同,例如 Lite 模型在 https://console.xfyun.cn/services/cbm 开通 base_url: https://ark.cn-beijing.volces.com/api/v3 model_name: lite - api_key: 你的api_password + api_key: 你的api_key TTS: # 当前支持的type为edge、doubao,可自行适配 EdgeTTS: @@ -1117,8 +1117,8 @@ TTS: #SpeechServerDemo https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/speech_server #流式传输请参考 https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-WebSocket-API type: paddle_speech - protocol: websocket # 当前仅实现 websocket - url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务的 URL 地址,指向本地服务器 [websocket 默认 ws://127.0.0.1:8092/paddlespeech/tts/streaming] + protocol: websocket # 当前仅实现 websocket;填其他值会在启动时报错 + url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务地址(未配置时代码兜底同此本机地址) spk_id: 0 # 发音人 ID,0 通常表示默认的发音人 speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢 volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小 diff --git a/main/xiaozhi-server/core/providers/tts/paddle_speech.py b/main/xiaozhi-server/core/providers/tts/paddle_speech.py index 52cb88295..d39dce273 100644 --- a/main/xiaozhi-server/core/providers/tts/paddle_speech.py +++ b/main/xiaozhi-server/core/providers/tts/paddle_speech.py @@ -23,9 +23,11 @@ class TTSProvider(TTSProviderBase): def __init__(self, config, delete_audio_file): super().__init__(config, delete_audio_file) - self.url = config.get("url", "ws://192.168.1.10:8092/paddlespeech/tts/streaming") + self.url = config.get("url", "ws://127.0.0.1:8092/paddlespeech/tts/streaming") self.protocol = config.get("protocol", "websocket") - + if self.protocol != "websocket": + raise ValueError("Unsupported protocol. Please use 'websocket'.") + if config.get("private_voice"): self.spk_id = int(config.get("private_voice")) else: