* update:qq group

* update:更新英文版说明

---------

Co-authored-by: hrz <1710360675@qq.com>
This commit is contained in:
欣南科技
2025-02-26 16:02:59 +08:00
committed by GitHub
co-authored by hrz
parent 2255aacfd0
commit 242f4d87e7
2 changed files with 220 additions and 356 deletions
+1 -1
View File
@@ -1,4 +1,4 @@
[![SVG Banners](https://svg-banners.vercel.app/api?type=origin&text1=你好😃,小智📟&text2=开源小智ESP-32后端服务&width=800&height=210)](https://github.com/xinnan-tech/xiaozhi-esp32-server) [![SVG Banners](https://svg-banners.vercel.app/api?type=origin&text1=你好😃,小智📟&text2=开源小智ESP-32后端服务&width=830&height=210)](https://github.com/xinnan-tech/xiaozhi-esp32-server)
<p align="center"> <p align="center">
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors"> <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/xinnan-tech/xiaozhi-esp32-server" /> <img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/xinnan-tech/xiaozhi-esp32-server" />
+219 -355
View File
@@ -1,427 +1,291 @@
![图片](docs/images/banner.png)
# Xiaozhi ESP-32 Back-end Service (xiaozhi-esp32-server) [![SVG Banners](https://svg-banners.vercel.app/api?type=origin&text1=Hello😃,%20XiaoZhi📟&text2=Open%20Source%20XiaoZhi%20ESP-32%20Backend%20Service&width=830&height=210)](https://github.com/xinnan-tech/xiaozhi-esp32-server)
<p align="center">
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/xinnan-tech/xiaozhi-esp32-server" />
</a>
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/xinnan-tech/xiaozhi-esp32-server?color=0088ff" />
</a>
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/xinnan-tech/xiaozhi-esp32-server?color=0088ff" />
</a>
</p>
[中文](README.md) | English # XiaoZhi ESP-32 Backend Service (xiaozhi-esp32-server)
This project provides backend services for the open-source smart hardware ([中文](README.md) | English)
project [xiaozhi-esp32](https://github.com/78/xiaozhi-esp32)。Implemented in Python following
the[Xiaozhi Communication Protocol](https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh)。
## Target Audience This project provides the backend service for the open source smart hardware project [xiaozhi-esp32](https://github.com/78/xiaozhi-esp32). It is implemented in `Python` based on the [XiaoZhi Communication Protocol](https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh).
This project requires compatible esp32 hardware devices. If you have purchased esp32 hardware, successfully connected to ---
Xiage's deployed backend, and wish to independently set up the `xiaozhi-esp32` backend service, this project is for
you.
To see a demo, watch this video: ## Target Audience 👥
<a href="https://www.bilibili.com/video/BV1FMFyejExX"> This project is designed to be used in conjunction with ESP32 hardware devices. If you have already purchased an ESP32 device, successfully connected to the backend service deployed by XieGe, and now wish to set up your own `xiaozhi-esp32` backend service, then this project is perfect for you.
<picture>
<img alt="小智esp32连接自己的后台模型" src="docs/images/demo.png" />
</picture>
</a>
To fully experience this project, follow these steps: Want to see it in action? Check out the videos 🎥
- Prepare hardware compatible with the `xiaozhi-esp32` project. For supported <table>
models, [click here](https://rcnv1t9vps13.feishu.cn/wiki/DdgIw4BUgivWDPkhMj1cGIYCnRf). <tr>
- Use a computer/server with at least 4-core CPU and 8GB RAM to run this project. After deployment, you'll see the <td>
service endpoint address in the console. <a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
- Download the `xiaozhi-esp32` project, replace the default `endpoint address` with your own, compile, and flash the <picture>
firmware to your device. <img alt="XiaoZhi ESP32 connecting to a custom backend model" src="docs/images/demo1.png" />
- Start the device and check your server console logs to verify successful connection. </picture>
</a>
</td>
<td>
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
<picture>
<img alt="Custom Voice" src="docs/images/demo2.png" />
</picture>
</a>
</td>
<td>
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
<picture>
<img alt="Conversing in Cantonese" src="docs/images/demo3.png" />
</picture>
</a>
</td>
<td>
<a href="https://www.bilibili.com/video/av114036381327149" target="_blank">
<picture>
<img alt="Control Home Appliances" src="docs/images/demo5.png" />
</picture>
</a>
</td>
<td>
<a href="https://www.bilibili.com/video/BV1kgA2eYEQ9" target="_blank">
<picture>
<img alt="Lowest Cost Configuration" src="docs/images/demo4.png" />
</picture>
</a>
</td>
<td>
</td>
</tr>
</table>
## Warning ---
This project has been established for a short time and has not passed the network security assessment, so please do not ## System Requirements and Deployment Prerequisites 🖥️
use it in the production environment.
## Feature List - **Hardware**: A set of devices compatible with `xiaozhi-esp32` (for specific models, please refer to [this link](https://rcnv1t9vps13.feishu.cn/wiki/DdgIw4BUgivWDPkhMj1cGIYCnRf)).
- **Server**: A computer with at least a 4-core CPU and 8GB of memory.
- **Firmware Compilation**: Please update the backend service API endpoint in the `xiaozhi-esp32` project, then recompile the firmware and flash it to your device.
## Implemented ---
- `xiaozhi-esp32` WebSocket communication protocol ## Warning ⚠️
- Supports wake-word initiated dialogue, manual dialogue, and real-time interruption of dialogue.
- Support for 5 languages: Mandarin, Cantonese, English, Japanese, Korean (FunASR - default)
- Flexible LLM switching (openai:ChatGLM - default, Aliyun, DeepSeek; dify:Dify)
- Flexible TTS switching (EdgeTTS - default, ByteDance Doubao TTS)
## In Progress This project is relatively new and has not yet undergone network security evaluations. **Do not use it in a production environment.**
- Sleep mode after inactivity If you deploy this project on a public network for learning purposes, be sure to enable protection in the configuration file `config.yaml`:
- Dialogue memory
- Change the mood mode
## Supported Services ```yaml
server:
| Type | Service | Usage | Pricing Model | Notes | auth:
|:-----|:-----------|:--------:|:---------------|:---------------------------------------------------------------------------| # Enable protection
| LLM | Aliyun | openai API call | Token-based | [Apply for API Key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) | enabled: true
| LLM | DeepSeek | openai API call | Token-based | [Apply for API Key](https://platform.deepseek.com/) |
| LLM | Bigmodel | openai API call | Free | [Create API Key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) |
| LLM | Dify | dify API call | Token-based | Self-hosted |
| TTS | HuoshanTTS | API call | Token-based | [Create API Key](https://console.volcengine.com/speech/service/8) |
| TTS | EdgeTTS | API call | Free | |
| VAD | SileroVAD | Local | Free | |
| ASR | FunASR | Local | Free | |
In fact, any LLM that supports OpenAI API calls can be integrated and used.
# Deployment
This project supports rapid deployment of docker and local source code operation. If you want to have a quick
experience, it is recommended to use docker to deploy. If you want to have an in-depth understanding of this project, it
is recommended to run the local source code.
## Method 1: Quick deployment of docker
The docker image has supported the CPU of x86 architecture and arm64 architecture, and supports running on Chinese
operating systems.
1. Install docker
If your computer has not installed docker, you can follow the tutorial here to install
it:[Install docker](https://www.runoob.com/docker/ubuntu-docker-install.html)
2. Create a directory
After installation, you need to find a directory for the configuration file for this project. Let's call it the
`project directory` for the time being. This directory is preferably a newly created empty directory.
3. Download the configuration file
Open with a browser[This link](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/config.yaml)。
On the right side of the page, find the button named `RAW`, next to the `RAW` button, find the download icon, click the
Download button, and download the `config.yaml` file. Download the file to your `project directory`.
4. Configure Project
Modify the `config.yaml` file to configure the various parameters required for this project. The default LLM uses
`ChatGLMLLM`, you need to configure the key to start.
The default TTS uses `EdgeTTS`. This does not require configuration. If you need to replace it with`Doubao TTS`, you
need to
configure the key.
Configuration description: This is the default component of each function, such as LLM default to use the `ChatGLMLLM`
model. If you need to switch the model, it is the corresponding name.
The default configuration of this project is only the lowest operating cost configuration`glm-4-flash`and`EdgeTTS`are
free),If you need to be better and faster, you need to combine the use of the deployment environment to switch the use
of each component。
```
selected_module:
ASR: FunASR
VAD: SileroVAD
LLM: ChatGLMLLM
TTS: EdgeTTS
``` ```
For example, to modify the components used by the `LLM`, it depends on which `LLM` API interfaces are supported by this project. Currently, the supported ones are `openai` and `dify`. We welcome validation and support for more LLM platforms' interfaces. Once protection is enabled, you will need to validate the machine's token or MAC address based on your actual situation. Please refer to the configuration documentation for details.
When using it, change the `selected_module` to the corresponding name of the following LLM configurations:
```
LLM:
AliLLM:
type: openai
...
DeepSeekLLM:
type: openai
...
ChatGLMLLM:
type: openai
...
DifyLLM:
type: openai
...
```
Some services, for example, if you use the TTS` of the `dify` and` bean bags, you need a key, remember to add the ---
configuration file!
5. Execute the docker command ## Feature List ✨
Open the command line tool, `cd` enter your `project directory`, and execute the following command
``` ### Implemented ✅
#If you are Linux, execute
ls
#If you are Windows, execute
dir
```
If you can see the `config.yaml` file, you have indeed entered the `project directory`, and then execute the following - **Communication Protocol**
command: Based on the `xiaozhi-esp32` protocol, data exchange is implemented via WebSocket.
- **Dialogue Interaction**
``` Supports wake-up dialogues, manual conversations, and real-time interruptions. Automatically enters sleep mode after long periods of inactivity.
docker run -d --name xiaozhi-esp32-server --restart always --security-opt seccomp:unconfined -p 8000:8000 -v $(pwd)/config.yaml:/opt/xiaozhi-esp32-server/config.yaml ccr.ccs.tencentyun.com/xinnan/xiaozhi-esp32-server:latest - **Multilingual Recognition**
``` Supports Mandarin, Cantonese, English, Japanese, and Korean (default using FunASR).
- **LLM Module**
If executed for the first time, it may take several minutes, and you have to be patient to wait for it to complete the Allows flexible switching of LLM modules. The default is ChatGLMLLM, with options to use AliLLM, DeepSeek, Ollama, and others.
pull. After normal pulling is completed, you can execute the following command on the command line to see if the service - **TTS Module**
is started successfully. Supports multiple TTS interfaces including EdgeTTS (default) and Volcano Engine Doubao TTS to meet speech synthesis requirements.
```
docker ps
```
If you can see `xiaozhi-server`, it means that the service starts successfully. Then you can further execute the
following command to view the service log
```
docker logs -f xiaozhi-esp32-server
```
If you can see, similar to the following logs, it is a sign that the service of this project is successfully launched.
```
2025-xx-xx xx:51:59,492 - core.server - INFO - Server is running at ws://xx.xx.xx.xxx:8000
2025-xx-xx xx:51:59,516 - websockets.server - INFO - server listening on 0.0.0.0:8000
```
Next, you can start `compiling esp32 firmware`. Please go down and turn to the relevant chapter on
`compiling esp32 firmware`. So since you are deploying with docker, you have to check the IP of your native computer by
yourself.
Normally, assuming your ip is `192.168.1.25`, then your interface address is: `ws://192.168.1.25:8000`. This information
is very useful, and it is required to `compile esp32 firmware` later.
## Method 2 : Local Source Code Deployment
### 1.Install Prerequisites
This project uses 'conda' to manage dependencies, and after installation, start executing the following commands:
```
conda remove -n xiaozhi-esp32-server --all -y
conda create -n xiaozhi-esp32-server python=3.10 -y
conda activate xiaozhi-esp32-server
```
After executing the above command, if your computer is Windows or Mac, execute the following statement:
```
conda activate xiaozhi-esp32-server
conda install conda-forge::libopus
conda install conda-forge::ffmpeg
```
If your computer is ubuntu, execute the following statement:
```
apt-get install libopus0 ffmpeg
```
### 2.Install Dependencies
```
# Clone the project
cd xiaozhi-esp32-server
conda activate xiaozhi-esp32-server
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
pip install -r requirements.txt
```
### 3.Download ASR Model
Download [SenseVoiceSmall](https://modelscope.cn/models/iic/SenseVoiceSmall/resolve/master/model.pt) to
`model/SenseVoiceSmall`.
By default, the `SenseVoiceSmall` model is used to convert voice to text. Because the model is large, it needs to be
downloaded independently. After downloading, place the `model.pt` file in the `model/SenseVoiceSmall` directory. Choose
any of the following two download routes.
- Line 1: Download Ali Magic
Tower[SenseVoiceSmall](https://modelscope.cn/models/iic/SenseVoiceSmall/resolve/master/model.pt)
- Line 2: Baidu Netdisk download[SenseVoiceSmall](https://pan.baidu.com/share/init?surl=QlgM58FHhYv1tFnUT_A8Sg&pwd=qvna)
提取码: `qvna`
### 4.Configure Project ### In Development 🚧
Modify the `config.yaml` file to configure the various parameters required for this project. The default LLM uses
`ChatGLMLLM`, you need to configure the key to start.
The default TTS uses `EdgeTTS`. This does not require configuration. If you need to replace it with`Doubao TTS`, you
need to
configure the key.
Configuration description: This is the default component of each function, such as LLM default to use the `ChatGLMLLM`
model. If you need to switch the model, it is the corresponding name.
The default configuration of this project is only the lowest operating cost configuration`glm-4-flash`and`EdgeTTS`are
free),If you need to be better and faster, you need to combine the use of the deployment environment to switch the use
of each component。
``` - Conversation Memory Feature
selected_module: - Multiple Mood Modes
ASR: FunASR - Smart Control Panel Web UI
VAD: SileroVAD
LLM: ChatGLMLLM
TTS: EdgeTTS
```
For example, to modify the components used by the `LLM`, it depends on which `LLM` API interfaces are supported by this project. Currently, the supported ones are `openai` and `dify`. We welcome validation and support for more LLM platforms' interfaces.
When using it, change the `selected_module` to the corresponding name of the following LLM configurations:
```
LLM:
AliLLM:
type: openai
...
DeepSeekLLM:
type: openai
...
ChatGLMLLM:
type: openai
...
DifyLLM:
type: openai
...
```
Some services, for example, if you use the TTS` of the `dify` and` bean bags, you need a key, remember to add the
configuration file!
### 5.Run the Project
Run the Project ![Screenshot](docs/images/webui.png)
``` ---
# Make sure to execute in the root directory of this project
conda activate xiaozhi-esp32-server
python app.py
```
You'll see the WebSocket endpoint in logs: ## Supported Platforms/Components 📋
``` ### LLM
2025-xx-xx xx:51:59,492 - core.server - INFO - Server is running at ws://192.168.1.25:8000
2025-xx-xx xx:51:59,516 - websockets.server - INFO - server listening on 0.0.0.0:8000
```
Among them, the `ws://192.168.1.25:8000` is the interface address provided by this project. Of course, your own machine | Type | Platform Name | Usage Method | Pricing Model | Remarks |
is different from mine. Remember to find your own address. |:----:|:-----------------------------:|:-----------------------------:|:-----------------:|:-------------------------------------------------------------------------:|
| LLM | AliLLM (阿里百炼) | OpenAI API call | Token consumption | [Click to apply for API key](https://bailian.console.aliyun.com/?apiKey=1#/api-key) |
| LLM | DeepSeekLLM (深度求索) | OpenAI API call | Token consumption | [Click to apply for API key](https://platform.deepseek.com/) |
| LLM | ChatGLMLLM (智谱) | OpenAI API call | Free | Although free, you still need to [click to apply for an API key](https://bigmodel.cn/usercenter/proj-mgmt/apikeys) |
| LLM | OllamaLLM | Ollama API call | Free/Custom | Requires pre-downloading the model (`ollama pull`); service URL: `http://localhost:11434` |
| LLM | DifyLLM | Dify API call | Token consumption | For local deployment. Note that prompt configuration must be set in the Dify console. |
| LLM | GeminiLLM | Gemini API call | Free | [Click to apply for API key](https://aistudio.google.com/apikey) |
| LLM | CozeLLM | Coze API call | Token consumption | Requires providing bot_id, user_id, and personal token. |
| LLM | Home Assistant | Home Assistant voice assistant API call | Free | Requires providing a Home Assistant token. |
# Compile ESP32 Firmware In fact, any LLM that supports OpenAI API calls can be integrated.
1. Download `xiaozhi-esp32` project, configure the project environment according to this ---
tutorial [" Windows builds ESP IDF 5.3.2 Development Environment and Compiles Xiaozhi "](https://icnynnzcwou8.feishu.cn/wiki/JEYDwTTALi5s2zkGlFGcDiRknXf)
Cure
2. Open the `xiaozhi-esp32/main/kconfig.projbuild` file, find the content of the` websocket_url` `default`, change the ### TTS
` wss: // api.tenclass.net` to your own address, such as
Before modification: | Type | Platform Name | Usage Method | Pricing Model | Remarks |
|:----:|:--------------------------------------:|:------------:|:-----------------:|:--------------------------------------------------------------------------------------:|
| TTS | EdgeTTS | API call | Free | Default TTS based on Microsoft's speech synthesis technology. |
| TTS | DoubaoTTS (火山引擎豆包 TTS) | API call | Token consumption | [Click to create an API key](https://console.volcengine.com/speech/service/8); it is recommended to use the paid version for higher concurrency. |
| TTS | CosyVoiceSiliconflow | API call | Token consumption | Requires application for the Siliconflow API key; output format is WAV. |
| TTS | CozeCnTTS | API call | Token consumption | Requires providing a Coze API key; output format is WAV. |
| TTS | FishSpeech | API call | Free/Custom | Starts a local TTS service; see the configuration file for startup instructions. |
| TTS | GPT_SOVITS_V2 | API call | Free/Custom | Starts a local TTS service, suitable for personalized speech synthesis scenarios. |
``` ---
config WEBSOCKET_URL
depends on CONNECTION_TYPE_WEBSOCKET
string "Websocket URL"
default "wss://api.tenclass.net/xiaozhi/v1/"
help
Communication with the server through websocket after wake up.
```
After modification (example): ### VAD
``` | Type | Platform Name | Usage Method | Pricing Model | Remarks |
config WEBSOCKET_URL |:----:|:-------------------:|:------------:|:-------------:|:-------:|
depends on CONNECTION_TYPE_WEBSOCKET | VAD | SileroVAD | Local | Free | |
string "Websocket URL"
default "ws://192.168.1.25:8000/xiaozhi/v1/"
help
Communication with the server through websocket after wake up.
```
3. Configure build settings: ---
``` ### ASR
# The terminal command line enters the root directory of xiaozhi-esp32
cd xiaozhi-esp32
# For example, the board I use is ESP32S3, so the compile target is ESP32S3. If your board is other models, please replace it with the corresponding model
idf.py set-target esp32s3
# Enter the menu configuration
idf.py menuconfig
```
![图片](docs/images/build_setting01.png) | Type | Platform Name | Usage Method | Pricing Model | Remarks |
|:----:|:-------------------:|:------------:|:-------------:|:-------:|
| ASR | FunASR | Local | Free | |
| ASR | DoubaoASR | API call | Paid | |
After entering the menu configuration, then enter `xiaozhi assistant`, set the` connection_type` to `websocket` ---
Go back to the main menu, then enter `xiaozhi assistant`, set the `BOARD_TYPE` of your board
Save exit and return to the terminal command line.
![图片](docs/images/build_setting02.png) ## Usage 🚀
4. Build and package: ### 1. [Deployment Documentation](./docs/Deployment.md)
``` This project supports three deployment methods. Choose the one that best fits your needs.
idf.py build
cd scripts
python release.py
```
After the compilation is successful, the firmware file `merged-binary.bin` is generated in the` build` directory in the The documentation provided here is a **written tutorial**. If you prefer a **video tutorial**, you can refer to [this expert's hands-on guide](https://www.bilibili.com/video/BV1gePuejEvT).
project root directory.
This `merged-binary.bin` is the firmware file that will be recorded on the hardware.
6. Flash Combining both the written and video tutorials can help you get started more quickly.
Connect the ESP32 device to the computer, use the Chrome browser, and open the following URL
``` 1. [Docker Quick Deployment](./docs/Deployment.md)
https://espressif.github.io/esp-launchpad/ Suitable for general users who want a quick experience without extensive environment configuration. The only downside is that pulling the image can be a bit slow.
```
Open this 2. [Deployment Using Docker Environment](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E5%80%9F%E5%8A%A9docker%E7%8E%AF%E5%A2%83%E8%BF%90%E8%A1%8C%E9%83%A8%E7%BD%B2)
tutorial, [Flash Tools/Web -side Burning Folding Step (No IDF Development Environment)](https://ccnphfhqs21z.feishu.cn/wiki/Zpz4wXBtdimBrLk25WdcXzxcnNS). Ideal for software engineers who already have Docker installed and wish to customize the code.
Turn to: `Method 2: ESP-LAUNCHPAD browser web-end burning`, start from
`3. Burning firmware/download to the development board`, follow the tutorial operation.
# FAQ 3. [Running from Local Source Code](./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)
Suitable for users familiar with the `Conda` environment or those who wish to build the runtime environment from scratch.
## 1、TTS often fails, often overtime For scenarios requiring higher response speeds, running from the local source code is recommended to reduce additional overhead.
Suggestion: If the `Edgetts` is slow or often fails, you can replace it with a bean bag TTS` with a volcanic engine. If ### 2. [Firmware Compilation](./docs/firmware-build.md)
both are slow, the network environment may need to be optimized.
## 2、Big model reply is a bit slow Click [here](./docs/firmware-build.md) for a detailed guide on firmware compilation.
Suggestions: Both big models and TTS are dependent interfaces. If the network environment is not good, you can consider After successful compilation and network connection, wake up XiaoZhi using the wake-up word and monitor the server console for output.
changing the local model. Or try to switch different interface models.
## 3、Why is my ChatGLMLLM replying to a bit? Obviously it is Xiaozhi, but treats me as Xiaozhi. ---
Suggestion: You can modify the prompts in the configuration file first. You can also replace the free `GLM-4-FLASH` to ## Frequently Asked Questions ❓
the model of other toll versions of `ChatGlm`.
## 4、I want to control the operation of electric lights, air conditioners, remote switching and other operations through Xiaozhi. ### 1. TTS often fails and times out ⏰
Suggestion: In the configuration file, set the `LLM` to`DifyLLM`, and then arrange the smart application by the **Suggestion:**
`Dify`. If `EdgeTTS` frequently fails, please first check whether you are using a proxy (VPN). If so, try disabling the proxy and try again. If you are using Volcano Engine Doubao TTS and it often fails, it is recommended to use the paid version since the trial only supports 2 concurrent requests.
## 5、I said very slowly, I paused, Xiaozhi always grabbed me, what to do. ### 2. I want to control lights, air conditioners, remote power on/off, etc. with XiaoZhi 💡
Suggestion: In the configuration file, find this section, change the `min_silence_duration_ms` value, such as change to **Suggestion:**
` 1000`. Set the `LLM` to `HomeAssistant` in the configuration file and use the `HomeAssistant` API to perform the relevant controls.
``` ### 3. I speak slowly, and XiaoZhi always interrupts during pauses 🗣️
**Suggestion:**
Locate the following section in the configuration file and increase the value of `min_silence_duration_ms` (for example, change it to `1000`):
```yaml
VAD: VAD:
SileroVAD: SileroVAD:
threshold: 0.5 threshold: 0.5
model_dir: models/snakers4_silero-vad model_dir: models/snakers4_silero-vad
min_silence_duration_ms: 700 # 如果说话停顿比较长,可以把这个值设置大一些 min_silence_duration_ms: 700 # If your pauses are longer, increase this value
``` ```
## 6、For more questions, contact us to feedback ### 4. Why does XiaoZhi recognize a lot of Korean, Japanese, and English in what I say? 🇰🇷
![图片](docs/images/wechat.jpg) **Suggestion:**
Check whether the `model.pt` file exists in the `models/SenseVoiceSmall` directory. If it does not, please download it. See [Download ASR Model Files](docs/Deployment.md#模型文件) for details.
# Acknowledgments ### 5. Why does the error “TTS task error: file does not exist” occur? 📁
- This project is inspired by the [Bailin Voice Dialogue Robot](https://github.com/wwbin2017/bailing) project, and the **Suggestion:**
basic idea of the project is completed。 Verify that you have correctly installed the `libopus` and `ffmpeg` libraries using `conda`. If not, install them using:
- Thanks to [Tencent Cloud] (https://cloud.tencent.com/) for providing free docker space for this project。
- Thanks to [tenclass](https://www.tenclass.com/)Provide adequate documentation support on Xiaozhi Communication ```
Protocol。 conda install conda-forge::libopus
conda install conda-forge::ffmpeg
```
### 6. How can I improve XiaoZhi's dialogue response speed? ⚡
The default configuration of this project is designed to be cost-effective. It is recommended that beginners first use the default free models to ensure that the system runs smoothly, then optimize for faster response times.
To improve response speed, you can try replacing individual components. Below are the response time test results for each component (for reference only, not a guarantee):
**LLM Performance Ranking:**
| Module Name | Average First Token Time | Average Total Response Time |
|--------------|--------------------------|-----------------------------|
| AliLLM | 0.547s | 1.485s |
| ChatGLMLLM | 0.677s | 3.057s |
| OllamaLLM | 0.003s | 0.003s |
**TTS Performance Ranking:**
| Module Name | Average Synthesis Time |
|----------------------------|------------------------|
| EdgeTTS | 1.019s |
| DoubaoTTS | 0.503s |
| CosyVoiceSiliconflow | 3.732s |
**Recommended Configuration Combination (Overall Response Speed):**
| Combination Scheme | Overall Score | LLM First Token | TTS Synthesis |
|-----------------------------------|---------------|-----------------|---------------|
| AliLLM + DoubaoTTS | 0.539 | 0.547s | 0.503s |
| AliLLM + EdgeTTS | 0.642 | 0.547s | 1.019s |
| ChatGLMLLM + DoubaoTTS | 0.642 | 0.677s | 0.503s |
| ChatGLMLLM + EdgeTTS | 0.745 | 0.677s | 1.019s |
| AliLLM + CosyVoiceSiliconflow | 1.184 | 0.547s | 3.732s |
**Conclusion 🔍**
_As of February 19, 2025, if my computer were located in Haizhu District, Guangzhou, Guangdong Province, and connected via China Unicom, I would prioritize using:_
- **LLM:** `AliLLM`
- **TTS:** `DoubaoTTS`
### 7. For more questions, feel free to contact us for feedback 💬
![WeChat QR Code](docs/images/wechat.jpg)
---
## Acknowledgements 🙏
- This project was inspired by the [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) and implemented based on it.
- Many thanks to [Tenclass](https://www.tenclass.com/) for providing detailed documentation support for the XiaoZhi communication protocol.
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date"> <a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
<picture> <picture>