From bd174ef1b0ba373327e7000c81130cf97b193621 Mon Sep 17 00:00:00 2001 From: hrz <1710360675@qq.com> Date: Thu, 20 Feb 2025 22:38:35 +0800 Subject: [PATCH] =?UTF-8?q?update:=E4=BC=98=E5=8C=96=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 45 +++++++++++++++++++------------ core/providers/tts/fishspeech.py | 8 +++++- core/providers/tts/siliconflow.py | 2 -- 3 files changed, 35 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 5d8122835..c77bd07f5 100644 --- a/README.md +++ b/README.md @@ -80,15 +80,15 @@ server: ### LLM -| 类型 | 平台名称 | 使用方式 | 收费模式 | 备注 | -|:---:|:------------------:|:-----------:|:--------:|:-----------------------------------------------------------------:| -| LLM | 阿里百炼 (AliLLM) | openai 接口调用 | 消耗 token | [点击申请密钥](https://bailian.console.aliyun.com/?apiKey=1#/api-key) | -| LLM | 深度求索 (DeepSeekLLM) | openai 接口调用 | 消耗 token | [点击申请密钥](https://platform.deepseek.com/) | -| LLM | 智谱(ChatGLMLLM) | openai 接口调用 | 免费 | 虽然免费,仍需[点击申请密钥](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) | -| LLM | OllamaLLM | ollama 接口调用 | 免费/自定义 | 需预先下载模型(`ollama pull`),服务地址:`http://localhost:11434` | -| LLM | DifyLLM | dify 接口调用 | 消耗 token | 本地化部署,注意配置提示词需在 Dify 控制台设置 | -| LLM | GeminiLLM | gemini 接口调用 | 免费 | [点击申请密钥](https://aistudio.google.com/apikey) | -| LLM | CozeLLM | coze 接口调用 | 消耗 token | 需提供 bot_id、user_id 及个人令牌 | +| 类型 | 平台名称 | 使用方式 | 收费模式 | 备注 | +|:---:|:------------------:|:---------------------:|:--------:|:-----------------------------------------------------------------:| +| LLM | 阿里百炼 (AliLLM) | openai 接口调用 | 消耗 token | [点击申请密钥](https://bailian.console.aliyun.com/?apiKey=1#/api-key) | +| LLM | 深度求索 (DeepSeekLLM) | openai 接口调用 | 消耗 token | [点击申请密钥](https://platform.deepseek.com/) | +| LLM | 智谱(ChatGLMLLM) | openai 接口调用 | 免费 | 虽然免费,仍需[点击申请密钥](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) | +| LLM | OllamaLLM | ollama 接口调用 | 免费/自定义 | 需预先下载模型(`ollama pull`),服务地址:`http://localhost:11434` | +| LLM | DifyLLM | dify 接口调用 | 消耗 token | 本地化部署,注意配置提示词需在 Dify 控制台设置 | +| LLM | GeminiLLM | gemini 接口调用 | 免费 | [点击申请密钥](https://aistudio.google.com/apikey) | +| LLM | CozeLLM | coze 接口调用 | 消耗 token | 需提供 bot_id、user_id 及个人令牌 | | LLM | Home Assistant | homeassistant语音助手接口调用 | 免费 | 需提供home assistant令牌 | 实际上,任何支持 openai 接口调用的 LLM 均可接入使用。 @@ -128,11 +128,8 @@ server: ### 一、[部署文档](./docs/Deployment.md) -1. - * - -*[本地源码运行](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%89%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C) -** +1.**[本地源码运行](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%89%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C)** + 适合熟悉 Conda 环境或希望从零搭建运行环境的用户。 对于对响应速度要求较高的场景,推荐使用本地源码运行方式以降低额外开销。 @@ -153,7 +150,7 @@ server: ### 2、我想通过小智控制电灯、空调、远程开关机等操作 💡 -建议:在配置文件中将 `LLM` 设置为 `DifyLLM`,并通过 `Dify` 编排智能体来实现相关控制。 +建议:在配置文件中将 `LLM` 设置为 `HomeAssistant`,通过 调用`HomeAssistant`接口实现相关控制。 ### 3、我说话很慢,停顿时小智老是抢话 🗣️ @@ -167,7 +164,21 @@ VAD: min_silence_duration_ms: 700 # 如果说话停顿较长,可将此值调大 ``` -### 4、如何提高小智对话响应速度? ⚡ +### 4、为什么我说的话,小智识别出来很多韩文、日文、英文?🇰🇷 + +建议:检查一下`models/SenseVoiceSmall`是否已经有`model.pt`文件,如果没有就要下载,查看这里[下载语音识别模型文件](docs/Deployment.md#模型文件) + +### 5、为什么会出现“TTS 任务出错 文件不存在”?📁 + +建议:检查一下是否正确使用`conda` 安装了`libopus`和`ffmpeg`库。 + +如果没有安装,就安装 +``` +conda install conda-forge::libopus +conda install conda-forge::ffmpeg +``` + +### 6、如何提高小智对话响应速度? ⚡ 本项目默认配置为低成本方案,建议初学者先使用默认免费模型,解决“跑得动”的问题,再优化“跑得快”。 如需提升响应速度,可尝试更换各组件。以下为各组件的响应速度测试数据(仅供参考,不构成承诺): @@ -225,7 +236,7 @@ TTS 性能排行: - LLM:`AliLLM` - TTS:`DoubaoTTS` -### 5、更多问题,可联系我们反馈 💬 +### 7、更多问题,可联系我们反馈 💬 ![图片](docs/images/wechat.jpg) diff --git a/core/providers/tts/fishspeech.py b/core/providers/tts/fishspeech.py index c71214986..1cbe08105 100644 --- a/core/providers/tts/fishspeech.py +++ b/core/providers/tts/fishspeech.py @@ -9,8 +9,11 @@ from pydantic import BaseModel, Field, conint, model_validator from typing_extensions import Annotated from datetime import datetime from typing import Literal -# from base import TTSProviderBase from core.providers.tts.base import TTSProviderBase +from config.logger import setup_logging + +TAG = __name__ +logger = setup_logging() class ServeReferenceAudio(BaseModel): @@ -86,6 +89,9 @@ class TTSProvider(TTSProviderBase): self.channels = config.get("channels",1) self.rate = config.get("rate",44100) self.api_key = config.get("api_key","YOUR_API_KEY") + if not self.api_key or "你" in self.api_key: + logger.bind(tag=TAG).error("你还没配置FishSpeech TTS的密钥,请在配置文件中配置密钥,否则无法正常工作") + return self.normalize = config.get("normalize",True) self.max_new_tokens = config.get("max_new_tokens",1024) self.chunk_length = config.get("chunk_length",200) diff --git a/core/providers/tts/siliconflow.py b/core/providers/tts/siliconflow.py index faca44057..4c0cc3562 100644 --- a/core/providers/tts/siliconflow.py +++ b/core/providers/tts/siliconflow.py @@ -1,7 +1,5 @@ import os import uuid -import json -import base64 import requests from datetime import datetime from core.providers.tts.base import TTSProviderBase