mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-26 04:39:53 +01:00
Merge pull request #3515 from shinjiyu/fix/config-provider-copy-accuracy
fix(config): 纠正供应器占位文案与 PaddleSpeech 协议说明
This commit is contained in:
commit
3230a69c99
4 changed files with 48 additions and 17 deletions
|
|
@ -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';
|
||||||
|
|
@ -753,3 +753,10 @@ databaseChangeLog:
|
||||||
- sqlFile:
|
- sqlFile:
|
||||||
encoding: utf8
|
encoding: utf8
|
||||||
path: classpath:db/changelog/202609172100.sql
|
path: classpath:db/changelog/202609172100.sql
|
||||||
|
- changeSet:
|
||||||
|
id: 202610302051
|
||||||
|
author: shinjiyu
|
||||||
|
changes:
|
||||||
|
- sqlFile:
|
||||||
|
encoding: utf8
|
||||||
|
path: classpath:db/changelog/202610302051.sql
|
||||||
|
|
|
||||||
|
|
@ -398,8 +398,8 @@ ASR:
|
||||||
# DoubaoASR和DoubaoStreamASR的区别是:DoubaoASR是按次收费,DoubaoStreamASR是按时收费
|
# DoubaoASR和DoubaoStreamASR的区别是:DoubaoASR是按次收费,DoubaoStreamASR是按时收费
|
||||||
# 一般来说按次收费的更便宜,但是DoubaoStreamASR使用了大模型技术,效果更好
|
# 一般来说按次收费的更便宜,但是DoubaoStreamASR使用了大模型技术,效果更好
|
||||||
type: doubao
|
type: doubao
|
||||||
appid: 你的火山引擎语音合成服务appid
|
appid: 你的火山引擎语音识别服务appid
|
||||||
access_token: 你的火山引擎语音合成服务access_token
|
access_token: 你的火山引擎语音识别服务access_token
|
||||||
cluster: volcengine_input_common
|
cluster: volcengine_input_common
|
||||||
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
||||||
boosting_table_name: (选填)你的热词文件名称
|
boosting_table_name: (选填)你的热词文件名称
|
||||||
|
|
@ -412,8 +412,8 @@ ASR:
|
||||||
# 开通地址https://console.volcengine.com/speech/service/10011
|
# 开通地址https://console.volcengine.com/speech/service/10011
|
||||||
# 一般来说按次收费的更便宜,但是DoubaoStreamASR使用了大模型技术,效果更好
|
# 一般来说按次收费的更便宜,但是DoubaoStreamASR使用了大模型技术,效果更好
|
||||||
type: doubao_stream
|
type: doubao_stream
|
||||||
appid: 你的火山引擎语音合成服务appid
|
appid: 你的火山引擎语音识别服务appid
|
||||||
access_token: 你的火山引擎语音合成服务access_token
|
access_token: 你的火山引擎语音识别服务access_token
|
||||||
# 资源ID:小时版 volc.bigasr.sauc.duration,并发版 volc.bigasr.sauc.concurrent
|
# 资源ID:小时版 volc.bigasr.sauc.duration,并发版 volc.bigasr.sauc.concurrent
|
||||||
resource_id: volc.bigasr.sauc.duration
|
resource_id: volc.bigasr.sauc.duration
|
||||||
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
||||||
|
|
@ -432,8 +432,8 @@ ASR:
|
||||||
# 开通地址:https://console.volcengine.com/speech/service/10038
|
# 开通地址:https://console.volcengine.com/speech/service/10038
|
||||||
# 价格更为便宜,建议在高并发场景下使用
|
# 价格更为便宜,建议在高并发场景下使用
|
||||||
type: doubao_stream
|
type: doubao_stream
|
||||||
appid: 你的火山引擎语音合成服务appid
|
appid: 你的火山引擎语音识别服务appid
|
||||||
access_token: 你的火山引擎语音合成服务access_token
|
access_token: 你的火山引擎语音识别服务access_token
|
||||||
# 资源ID:小时版 volc.seedasr.sauc.duration,并发版 volc.seedasr.sauc.concurrent
|
# 资源ID:小时版 volc.seedasr.sauc.duration,并发版 volc.seedasr.sauc.concurrent
|
||||||
resource_id: volc.seedasr.sauc.duration
|
resource_id: volc.seedasr.sauc.duration
|
||||||
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
# 热词、替换词使用流程:https://www.volcengine.com/docs/6561/155738
|
||||||
|
|
@ -451,9 +451,9 @@ ASR:
|
||||||
# token申请地址:https://console.cloud.tencent.com/cam/capi
|
# token申请地址:https://console.cloud.tencent.com/cam/capi
|
||||||
# 免费领取资源:https://console.cloud.tencent.com/asr/resourcebundle
|
# 免费领取资源:https://console.cloud.tencent.com/asr/resourcebundle
|
||||||
type: tencent
|
type: tencent
|
||||||
appid: 你的腾讯语音合成服务appid
|
appid: 你的腾讯语音识别服务appid
|
||||||
secret_id: 你的腾讯语音合成服务secret_id
|
secret_id: 你的腾讯语音识别服务secret_id
|
||||||
secret_key: 你的腾讯语音合成服务secret_key
|
secret_key: 你的腾讯语音识别服务secret_key
|
||||||
output_dir: tmp/
|
output_dir: tmp/
|
||||||
AliyunASR:
|
AliyunASR:
|
||||||
# 阿里云智能语音交互服务,需要先在阿里云平台开通服务,然后获取验证信息
|
# 阿里云智能语音交互服务,需要先在阿里云平台开通服务,然后获取验证信息
|
||||||
|
|
@ -619,7 +619,7 @@ LLM:
|
||||||
# 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key
|
# 可在这里找到你的 api_key https://bailian.console.aliyun.com/?apiKey=1#/api-key
|
||||||
base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
|
base_url: https://dashscope.aliyuncs.com/compatible-mode/v1
|
||||||
model_name: qwen-flash
|
model_name: qwen-flash
|
||||||
api_key: 你的deepseek web key
|
api_key: 你的阿里云百炼API密钥
|
||||||
temperature: 0.7 # 温度值
|
temperature: 0.7 # 温度值
|
||||||
max_tokens: 500 # 最大生成token数
|
max_tokens: 500 # 最大生成token数
|
||||||
top_p: 1
|
top_p: 1
|
||||||
|
|
@ -763,10 +763,10 @@ VLLM:
|
||||||
# 先新建应用,在下面的地址
|
# 先新建应用,在下面的地址
|
||||||
# 开通应用地址:https://console.xfyun.cn/app/myapp
|
# 开通应用地址:https://console.xfyun.cn/app/myapp
|
||||||
# 有免费额度,但也要开通服务,才能获取api_key
|
# 有免费额度,但也要开通服务,才能获取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
|
base_url: https://ark.cn-beijing.volces.com/api/v3
|
||||||
model_name: lite
|
model_name: lite
|
||||||
api_key: 你的api_password
|
api_key: 你的api_key
|
||||||
TTS:
|
TTS:
|
||||||
# 当前支持的type为edge、doubao,可自行适配
|
# 当前支持的type为edge、doubao,可自行适配
|
||||||
EdgeTTS:
|
EdgeTTS:
|
||||||
|
|
@ -1117,8 +1117,8 @@ TTS:
|
||||||
#SpeechServerDemo https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/speech_server
|
#SpeechServerDemo https://github.com/PaddlePaddle/PaddleSpeech/tree/develop/demos/speech_server
|
||||||
#流式传输请参考 https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-WebSocket-API
|
#流式传输请参考 https://github.com/PaddlePaddle/PaddleSpeech/wiki/PaddleSpeech-Server-WebSocket-API
|
||||||
type: paddle_speech
|
type: paddle_speech
|
||||||
protocol: websocket # protocol choices = ['websocket', 'http']
|
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,http默认http://127.0.0.1:8090/paddlespeech/tts]
|
url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务地址(未配置时代码兜底同此本机地址)
|
||||||
spk_id: 0 # 发音人 ID,0 通常表示默认的发音人
|
spk_id: 0 # 发音人 ID,0 通常表示默认的发音人
|
||||||
speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢
|
speed: 1.0 # 语速,1.0 表示正常语速,>1 表示加快,<1 表示减慢
|
||||||
volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小
|
volume: 1.0 # 音量,1.0 表示正常音量,>1 表示增大,<1 表示减小
|
||||||
|
|
|
||||||
|
|
@ -23,8 +23,10 @@ class TTSProvider(TTSProviderBase):
|
||||||
|
|
||||||
def __init__(self, config, delete_audio_file):
|
def __init__(self, config, delete_audio_file):
|
||||||
super().__init__(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")
|
self.protocol = config.get("protocol", "websocket")
|
||||||
|
if self.protocol != "websocket":
|
||||||
|
raise ValueError("Unsupported protocol. Please use 'websocket'.")
|
||||||
|
|
||||||
if config.get("private_voice"):
|
if config.get("private_voice"):
|
||||||
self.spk_id = int(config.get("private_voice"))
|
self.spk_id = int(config.get("private_voice"))
|
||||||
|
|
@ -82,7 +84,7 @@ class TTSProvider(TTSProviderBase):
|
||||||
if self.protocol == "websocket":
|
if self.protocol == "websocket":
|
||||||
return await self.text_streaming(text, output_file)
|
return await self.text_streaming(text, output_file)
|
||||||
else:
|
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):
|
async def text_streaming(self, text, output_file):
|
||||||
try:
|
try:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue