mirror of
https://github.com/xinnan-tech/xiaozhi-esp32-server.git
synced 2026-11-24 04:19:48 +01:00
Compare commits
No commits in common. "main" and "v0.9.3" have entirely different histories.
644 changed files with 17828 additions and 48630 deletions
38
.github/dependabot.yml
vendored
38
.github/dependabot.yml
vendored
|
|
@ -3,40 +3,4 @@ updates:
|
||||||
- package-ecosystem: pip
|
- package-ecosystem: pip
|
||||||
directory: /main/xiaozhi-server
|
directory: /main/xiaozhi-server
|
||||||
schedule:
|
schedule:
|
||||||
interval: monthly
|
interval: weekly
|
||||||
open-pull-requests-limit: 5
|
|
||||||
groups:
|
|
||||||
ai-services:
|
|
||||||
patterns:
|
|
||||||
- "openai*"
|
|
||||||
- "google-generativeai"
|
|
||||||
- "dashscope"
|
|
||||||
- "baidu-aip"
|
|
||||||
- "cozepy"
|
|
||||||
- "markitdown"
|
|
||||||
- "mem0ai"
|
|
||||||
- "powermem"
|
|
||||||
ai-models:
|
|
||||||
patterns:
|
|
||||||
- "funasr"
|
|
||||||
- "vosk"
|
|
||||||
- "silero_vad"
|
|
||||||
- "opuslib_next"
|
|
||||||
- "sherpa_onnx"
|
|
||||||
- "modelscope"
|
|
||||||
web-stack:
|
|
||||||
patterns:
|
|
||||||
- "httpx"
|
|
||||||
- "aiohttp"
|
|
||||||
- "aiohttp_cors"
|
|
||||||
- "requests"
|
|
||||||
- "pysocks"
|
|
||||||
everything-else:
|
|
||||||
patterns:
|
|
||||||
- "*"
|
|
||||||
ignore:
|
|
||||||
- dependency-name: "torch"
|
|
||||||
- dependency-name: "torchaudio"
|
|
||||||
- dependency-name: "numpy"
|
|
||||||
- dependency-name: "portalocker"
|
|
||||||
- dependency-name: "websockets"
|
|
||||||
107
.github/workflows/test.yml
vendored
107
.github/workflows/test.yml
vendored
|
|
@ -1,107 +0,0 @@
|
||||||
name: Tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches: [main]
|
|
||||||
pull_request:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
python:
|
|
||||||
name: Python (xiaozhi-server)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version: '3.10'
|
|
||||||
cache: 'pip'
|
|
||||||
cache-dependency-path: 'main/xiaozhi-server/requirements.txt'
|
|
||||||
- name: Install system dependencies
|
|
||||||
run: |
|
|
||||||
# opuslib_next 是 ctypes 绑定,pip 装上的是纯 Python 包,真正的编解码
|
|
||||||
# 靠系统里的 libopus.so。runner 上默认没有,import 会失败,音频相关的
|
|
||||||
# 用例直接报错。正式镜像 Dockerfile-server-base 里也是装 libopus0 的
|
|
||||||
sudo apt-get update
|
|
||||||
sudo apt-get install -y --no-install-recommends libopus0
|
|
||||||
- name: Install dependencies
|
|
||||||
working-directory: main/xiaozhi-server
|
|
||||||
run: |
|
|
||||||
pip install -r requirements.txt
|
|
||||||
pip install pytest pytest-asyncio freezegun
|
|
||||||
- name: Prepare test config
|
|
||||||
working-directory: main/xiaozhi-server
|
|
||||||
run: |
|
|
||||||
# config/settings.py 在 import 期就要这个文件,缺了整套用例连收集都过不去。
|
|
||||||
# data/ 在 .gitignore 里,只能由这一步现造
|
|
||||||
mkdir -p data
|
|
||||||
printf '{}\n' > data/.config.yaml
|
|
||||||
- name: Run tests
|
|
||||||
working-directory: main/xiaozhi-server
|
|
||||||
run: |
|
|
||||||
# Edge TTS 那条要连微软公网,runner 的出口 IP 会被风控挡掉,先排除。
|
|
||||||
# 根治办法是给它打 live 标记,让 mock 模式下自动不收(另开一条改)
|
|
||||||
pytest tests/ -v -k "not test_tts_text_to_speak_writes_file"
|
|
||||||
|
|
||||||
java:
|
|
||||||
name: Java (manager-api)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
# 三个 @SpringBootTest 要真连 MySQL 和 Redis,空库即可,Liquibase 会自己建表
|
|
||||||
services:
|
|
||||||
mysql:
|
|
||||||
image: mysql:8.0
|
|
||||||
env:
|
|
||||||
MYSQL_ROOT_PASSWORD: 123456
|
|
||||||
MYSQL_DATABASE: xiaozhi_esp32_server
|
|
||||||
ports:
|
|
||||||
- 3306:3306
|
|
||||||
options: >-
|
|
||||||
--health-cmd="mysqladmin ping -h 127.0.0.1 -uroot -p123456"
|
|
||||||
--health-interval=10s
|
|
||||||
--health-timeout=5s
|
|
||||||
--health-retries=20
|
|
||||||
redis:
|
|
||||||
image: redis:8.0
|
|
||||||
ports:
|
|
||||||
- 6379:6379
|
|
||||||
options: >-
|
|
||||||
--health-cmd="redis-cli ping"
|
|
||||||
--health-interval=10s
|
|
||||||
--health-timeout=5s
|
|
||||||
--health-retries=20
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-java@v4
|
|
||||||
with:
|
|
||||||
distribution: 'temurin'
|
|
||||||
java-version: '21'
|
|
||||||
cache: 'maven'
|
|
||||||
- name: Run tests
|
|
||||||
working-directory: main/manager-api
|
|
||||||
run: mvn -B test -DskipTests=false -DfailIfNoTests=false
|
|
||||||
- name: Check the integration tests really ran
|
|
||||||
working-directory: main/manager-api
|
|
||||||
# 守卫在依赖不齐时会把整类集成测试跳过,这里盯一下它们有没有真跑,
|
|
||||||
# 免得门禁被悄悄掏空
|
|
||||||
run: bash scripts/check-integration-tests.sh
|
|
||||||
|
|
||||||
web:
|
|
||||||
name: Vue (manager-web)
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: actions/setup-node@v4
|
|
||||||
with:
|
|
||||||
node-version: '20'
|
|
||||||
cache: 'npm'
|
|
||||||
cache-dependency-path: main/manager-web/package-lock.json
|
|
||||||
- name: Run tests
|
|
||||||
working-directory: main/manager-web
|
|
||||||
run: |
|
|
||||||
npm ci --no-audit --no-fund
|
|
||||||
npm run test:contract
|
|
||||||
npm run test:unit
|
|
||||||
npm run build
|
|
||||||
12
.gitignore
vendored
12
.gitignore
vendored
|
|
@ -112,17 +112,12 @@ celerybeat.pid
|
||||||
# Environments
|
# Environments
|
||||||
.env
|
.env
|
||||||
.venv
|
.venv
|
||||||
/.venv-*/
|
|
||||||
env/
|
env/
|
||||||
venv/
|
venv/
|
||||||
ENV/
|
ENV/
|
||||||
env.bak/
|
env.bak/
|
||||||
venv.bak/
|
venv.bak/
|
||||||
|
|
||||||
# Repository-local runtimes and package-manager caches
|
|
||||||
/.runtime/
|
|
||||||
/main/manager-web/.npm-cache/
|
|
||||||
|
|
||||||
# Spyder project settings
|
# Spyder project settings
|
||||||
.spyderproject
|
.spyderproject
|
||||||
.spyproject
|
.spyproject
|
||||||
|
|
@ -154,7 +149,6 @@ tmp
|
||||||
.history
|
.history
|
||||||
.DS_Store
|
.DS_Store
|
||||||
main/xiaozhi-server/data
|
main/xiaozhi-server/data
|
||||||
main/xiaozhi-server/.claude
|
|
||||||
|
|
||||||
main/manager-web/node_modules
|
main/manager-web/node_modules
|
||||||
.config.yaml
|
.config.yaml
|
||||||
|
|
@ -192,8 +186,4 @@ uploadfile
|
||||||
!main/manager-mobile/**/env/
|
!main/manager-mobile/**/env/
|
||||||
!main/manager-mobile/**/.env*
|
!main/manager-mobile/**/.env*
|
||||||
!main/manager-mobile/**/*.json
|
!main/manager-mobile/**/*.json
|
||||||
!main/xiaozhi-server/**/*.json
|
!main/xiaozhi-server/**/*.json
|
||||||
!main/digital-human/**/*.json
|
|
||||||
main/digital-human/wakeword_runtime/models
|
|
||||||
main/digital-human/wakeword_runtime/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
|
|
||||||
sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2
|
|
||||||
|
|
@ -29,5 +29,4 @@ COPY main/xiaozhi-server/requirements.txt .
|
||||||
|
|
||||||
# 安装Python依赖
|
# 安装Python依赖
|
||||||
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
RUN pip install --no-cache-dir --upgrade pip setuptools wheel && \
|
||||||
# 阿里云 PyPI 镜像偶有元数据 404,加官方源作 fallback
|
pip install --no-cache-dir -r requirements.txt --default-timeout=120 --retries 5
|
||||||
pip install --no-cache-dir -r requirements.txt --default-timeout=120 --retries 5 --extra-index-url https://pypi.org/simple
|
|
||||||
21
Makefile
21
Makefile
|
|
@ -1,21 +0,0 @@
|
||||||
.PHONY: test test-fast test-python test-java test-web help
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "make test-fast - run all fast unit tests (default)"
|
|
||||||
@echo "make test - alias for test-fast"
|
|
||||||
@echo "make test-python - pytest in main/xiaozhi-server"
|
|
||||||
@echo "make test-java - mvn test in main/manager-api"
|
|
||||||
@echo "make test-web - npm run test:unit in main/manager-web"
|
|
||||||
|
|
||||||
test: test-fast
|
|
||||||
|
|
||||||
test-fast: test-python test-java test-web
|
|
||||||
|
|
||||||
test-python:
|
|
||||||
cd main/xiaozhi-server && python -m pytest -x -q
|
|
||||||
|
|
||||||
test-java:
|
|
||||||
cd main/manager-api && mvn -B -q test -DfailIfNoTests=false
|
|
||||||
|
|
||||||
test-web:
|
|
||||||
cd main/manager-web && npm ci --no-audit --no-fund && npm test
|
|
||||||
200
README.md
200
README.md
|
|
@ -18,11 +18,10 @@
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DBEDFA"></a>
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DBEDFA"></a>
|
||||||
<a href="./docs/readme/README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
<a href="./docs/readme/README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
<a href="./docs/readme/README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
<a href="./docs/readme/README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
||||||
<a href="./docs/readme/README_es.md"><img alt="Español" src="https://img.shields.io/badge/Español-DFE0E5"></a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -54,98 +53,113 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="响应速度感受" src="docs/images/demo9.png" /></picture>
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="速度优化秘诀" src="docs/images/demo6.png" /></picture>
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1WEcxzFEAT" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="小智数字人 支持语音唤醒" src="docs/images/demo8.png" /></picture>
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CKVz6UEuB" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="设备呼叫设备,打电话" src="docs/images/demo0.png" /></picture>
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="复杂医疗场景" src="docs/images/demo1.png" /></picture>
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="播放音乐查询天气播报新闻" src="docs/images/demo7.png" /></picture>
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="实时打断" src="docs/images/demo10.png" /></picture>
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
</a>
|
</picture>
|
||||||
</td>
|
</a>
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="拍照识物品" src="docs/images/demo12.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="控制家电开关" src="docs/images/demo5.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="多指令任务" src="docs/images/demo11.png" /></picture>
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MCP接入点" src="docs/images/demo13.png" /></picture>
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MQTT指令下发" src="docs/images/demo4.png" /></picture>
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="声纹识别" src="docs/images/demo14.png" /></picture>
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="自定义音色" src="docs/images/demo2.png" /></picture>
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="使用粤语交流" src="docs/images/demo3.png" /></picture>
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -170,12 +184,12 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
#### 🚀 部署方式选择
|
#### 🚀 部署方式选择
|
||||||
| 部署方式 | 特点 | 适用场景 | 部署文档 | 配置要求 | 视频教程 |
|
| 部署方式 | 特点 | 适用场景 | 部署文档 | 配置要求 | 视频教程 |
|
||||||
|---------|------|---------|---------|---------|---------|
|
|---------|------|---------|---------|---------|---------|
|
||||||
| **最简化安装** | 智能对话、单智能体管理 | 低配置环境,数据存储在配置文件,无需数据库 | [①Docker版](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②源码部署](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 本地跑 `FunASR` 较耗内存,全部走 API 时资源占用低 | - |
|
| **最简化安装** | 智能对话、单智能体管理 | 低配置环境,数据存储在配置文件,无需数据库 | [①Docker版](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②源码部署](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 如果使用`FunASR`要2核4G,如果全API,要2核2G | - |
|
||||||
| **全模块安装** | 智能对话、多用户管理、多智能体管理、智控台界面操作 | 完整功能体验,数据存储在数据库 |[①Docker版](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②源码部署](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③源码部署自动更新教程](./docs/dev-ops-integration.md) | 本地跑 `FunASR` 较耗内存,另需数据库资源,全部走 API 时资源占用低| [本地源码启动视频教程](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
| **全模块安装** | 智能对话、多用户管理、多智能体管理、智控台界面操作 | 完整功能体验,数据存储在数据库 |[①Docker版](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②源码部署](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③源码部署自动更新教程](./docs/dev-ops-integration.md) | 如果使用`FunASR`要4核8G,如果全API,要2核4G| [本地源码启动视频教程](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
常见问题及相关教程,可参考[这个链接](./docs/FAQ.md)
|
常见问题及相关教程,可参考[这个链接](./docs/FAQ.md)
|
||||||
|
|
||||||
> 💡 提示:以下是按最新代码部署后的测试平台,有需要可烧录测试,并发为6个,每天会清空数据。
|
> 💡 提示:以下是按最新代码部署后的测试平台,有需要可烧录测试,并发为6个,每天会清空数据,
|
||||||
|
|
||||||
```
|
```
|
||||||
智控台地址: https://2662r3426b.vicp.fun
|
智控台地址: https://2662r3426b.vicp.fun
|
||||||
|
|
@ -203,7 +217,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| VLLM(视觉大模型) | glm-4v-flash(智谱) | 👍qwen3.5-flash(阿里百炼) |
|
| VLLM(视觉大模型) | glm-4v-flash(智谱) | 👍qwen3.5-flash(阿里百炼) |
|
||||||
| TTS(语音合成) | EdgeTTS(微软) | 👍HuoshanDoubleStreamTTS(火山流式) |
|
| TTS(语音合成) | EdgeTTS(微软) | 👍HuoshanDoubleStreamTTS(火山流式) |
|
||||||
| Intent(意图识别) | function_call(函数调用) | function_call(函数调用) |
|
| Intent(意图识别) | function_call(函数调用) | function_call(函数调用) |
|
||||||
| Memory(记忆功能) | mem_local_short(本地短期记忆) | mem_local_short(本地短期记忆) |
|
| Memory(记忆功能) | mem_local_short(本地短期记忆) | mem_local_short(本地短期记忆) |
|
||||||
|
|
||||||
如果您关心各组件的耗时,请查阅[小智各组件性能测试报告](https://github.com/xinnan-tech/xiaozhi-performance-research),可按报告中的测试方法在您的环境中实际测试。
|
如果您关心各组件的耗时,请查阅[小智各组件性能测试报告](https://github.com/xinnan-tech/xiaozhi-performance-research),可按报告中的测试方法在您的环境中实际测试。
|
||||||
|
|
||||||
|
|
@ -212,8 +226,8 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 工具名称 | 位置 | 使用方法 | 功能说明 |
|
| 工具名称 | 位置 | 使用方法 | 功能说明 |
|
||||||
|:---:|:---|:---:|:---:|
|
|:---:|:---|:---:|:---:|
|
||||||
| 音频交互测试工具 | main》digital-human》index.html | 在 `main/digital-human` 按其 README 装好依赖后执行 `python start.py`,然后访问 `http://127.0.0.1:8006/index.html` | 测试音频播放和接收功能,验证Python端音频处理是否正常 |
|
| 音频交互测试工具 | main》xiaozhi-server》test》test_page.html | 使用谷歌浏览器直接打开 | 测试音频播放和接收功能,验证Python端音频处理是否正常 |
|
||||||
| 模型响应测试工具 | main》xiaozhi-server》performance_tester.py | 执行 `python performance_tester.py` | 测试ASR(语音识别)、LLM(大模型)、VLLM(视觉模型)、TTS(语音合成)等核心模块的响应速度 |
|
| 模型响应测试工具 | main》xiaozhi-server》performance_tester.py | 执行 `python performance_tester.py` | 测试ASR(语音识别)、LLM(大模型)、VLLM(视觉模型)、TTS(语音合成)三个核心模块的响应速度 |
|
||||||
|
|
||||||
> 💡 提示:测试模型速度时,只会测试配置了密钥的模型。
|
> 💡 提示:测试模型速度时,只会测试配置了密钥的模型。
|
||||||
|
|
||||||
|
|
@ -231,12 +245,12 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| 意图识别 | 支持外挂的大模型意图识别、大模型自主函数调用,提供插件化意图处理机制 |
|
| 意图识别 | 支持外挂的大模型意图识别、大模型自主函数调用,提供插件化意图处理机制 |
|
||||||
| 记忆系统 | 支持本地短期记忆、mem0ai接口记忆、PowerMem智能记忆,具备记忆总结功能 |
|
| 记忆系统 | 支持本地短期记忆、mem0ai接口记忆、PowerMem智能记忆,具备记忆总结功能 |
|
||||||
| 知识库 | 支持RAGFlow知识库,让大模型判断需要调度知识库后再回答 |
|
| 知识库 | 支持RAGFlow知识库,让大模型判断需要调度知识库后再回答 |
|
||||||
| 工具调用 | 支持客户端IOT协议、客户端MCP协议、服务端MCP协议、MCP接入点协议、自定义工具函数 |
|
| 工具调用 | 支持客户端IOT协议、客户MCP协议、服务端MCP协议、MCP接入点协议、自定义工具函数 |
|
||||||
| 指令下发 | 依托MQTT协议,支持从智控台将MCP指令下发到ESP32设备 |
|
| 指令下发 | 依托MQTT协议,支持从智控台将MCP指令下发到ESP32设备 |
|
||||||
| 管理后台 | 提供Web管理界面,支持用户管理、系统配置和设备管理;界面支持中文简体、中文繁体、英文、德语、越南语、巴西葡萄牙语显示 |
|
| 管理后台 | 提供Web管理界面,支持用户管理、系统配置和设备管理;界面支持中文简体、中文繁体、英文显示 |
|
||||||
| 测试工具 | 提供模型响应性能测试工具和音频交互测试工具 |
|
| 测试工具 | 提供性能测试工具、视觉模型测试工具和音频交互测试工具 |
|
||||||
| 部署支持 | 支持Docker部署和本地部署,提供完整的配置文件管理 |
|
| 部署支持 | 支持Docker部署和本地部署,提供完整的配置文件管理 |
|
||||||
| 插件系统 | 支持功能插件扩展、自定义插件开发;新增插件文件在下次设备连接时自动加载,改动已加载插件的代码需重启服务 |
|
| 插件系统 | 支持功能插件扩展、自定义插件开发和插件热加载 |
|
||||||
|
|
||||||
### 正在开发 🚧
|
### 正在开发 🚧
|
||||||
|
|
||||||
|
|
@ -256,7 +270,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI 接口调用 | 阿里百炼、火山引擎、DeepSeek、智谱、Gemini、科大讯飞、LM Studio | 智谱、Gemini |
|
| openai 接口调用 | 阿里百炼、火山引擎、DeepSeek、智谱、Gemini、科大讯飞 | 智谱、Gemini |
|
||||||
| ollama 接口调用 | Ollama | - |
|
| ollama 接口调用 | Ollama | - |
|
||||||
| dify 接口调用 | Dify | - |
|
| dify 接口调用 | Dify | - |
|
||||||
| fastgpt 接口调用 | Fastgpt | - |
|
| fastgpt 接口调用 | Fastgpt | - |
|
||||||
|
|
@ -264,7 +278,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| xinference 接口调用 | Xinference | - |
|
| xinference 接口调用 | Xinference | - |
|
||||||
| homeassistant 接口调用 | HomeAssistant | - |
|
| homeassistant 接口调用 | HomeAssistant | - |
|
||||||
|
|
||||||
实际上,任何支持 OpenAI 接口调用的 LLM 均可接入使用。
|
实际上,任何支持 openai 接口调用的 LLM 均可接入使用。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -272,9 +286,9 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI 接口调用 | 阿里百炼、智谱ChatGLMVLLM、科大讯飞 | 智谱ChatGLMVLLM |
|
| openai 接口调用 | 阿里百炼、智谱ChatGLMVLLM | 智谱ChatGLMVLLM |
|
||||||
|
|
||||||
实际上,任何支持 OpenAI 接口调用的 VLLM 均可接入使用。
|
实际上,任何支持 openai 接口调用的 VLLM 均可接入使用。
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -282,8 +296,8 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| 接口调用 | EdgeTTS、科大讯飞、火山引擎、腾讯云、阿里云及百炼、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、CustomTTS、OpenAITTS、MinimaxTTS | EdgeTTS、CosyVoiceSiliconflow(部分) |
|
| 接口调用 | EdgeTTS、科大讯飞、火山引擎、腾讯云、阿里云及百炼、CosyVoiceSiliconflow、TTS302AI、CozeCnTTS、GizwitsTTS、ACGNTTS、OpenAITTS、灵犀流式TTS、MinimaxTTS | 灵犀流式TTS、EdgeTTS、CosyVoiceSiliconflow(部分) |
|
||||||
| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、IndexStreamTTS、PaddleSpeechTTS | IndexStreamTTS、PaddleSpeechTTS、FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3 |
|
| 本地服务 | FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3、Index-TTS、PaddleSpeech | Index-TTS、PaddleSpeech、FishSpeech、GPT_SOVITS_V2、GPT_SOVITS_V3 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -299,8 +313,8 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| 本地使用 | FunASR、SherpaASR、SherpaParaformerASR、VoskASR | FunASR、SherpaASR、SherpaParaformerASR、VoskASR |
|
| 本地使用 | FunASR、SherpaASR | FunASR、SherpaASR |
|
||||||
| 接口调用 | FunASRServer、火山引擎、科大讯飞、腾讯云、阿里云及百炼、百度云、OpenAI ASR、GroqASR、Qwen3ASRFlash | FunASRServer |
|
| 接口调用 | FunASRServer、火山引擎、科大讯飞、腾讯云、阿里云、百度云、OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -308,9 +322,7 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
|
|
||||||
| 使用方式 | 支持平台 | 免费平台 |
|
| 使用方式 | 支持平台 | 免费平台 |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| 接口调用 | 声纹识别服务(voiceprint-api) | - |
|
| 本地使用 | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
声纹识别需要单独部署 [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) 服务(基于 3D-Speaker),并依赖 MySQL,详见[声纹识别启用指南](./docs/voiceprint-integration.md)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -322,7 +334,6 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| Memory | [powermem](./docs/powermem-integration.md) | 本地总结 | 取决于LLM和DB | OceanBase开源,支持智能检索 |
|
| Memory | [powermem](./docs/powermem-integration.md) | 本地总结 | 取决于LLM和DB | OceanBase开源,支持智能检索 |
|
||||||
| Memory | mem_local_short | 本地总结 | 免费 | |
|
| Memory | mem_local_short | 本地总结 | 免费 | |
|
||||||
| Memory | nomem | 无记忆模式 | 免费 | |
|
| Memory | nomem | 无记忆模式 | 免费 | |
|
||||||
| Memory | mem_report_only | 仅上报 | 免费 | 只上报聊天记录,不做记忆总结 |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -357,10 +368,11 @@ Websocket接口地址: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
||||||
| <img src="./docs/images/logo_contributors.png" width="160"> | [代码贡献者](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | 感谢[所有代码贡献者](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors)贡献者,你们的付出让项目更加健壮和强大。 |
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [代码贡献者](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | 感谢[所有代码贡献者](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors)贡献者,你们的付出让项目更加健壮和强大。 |
|
||||||
|
|
||||||
|
|
||||||
<a href="https://www.star-history.com/?repos=xinnan-tech%2Fxiaozhi-esp32-server&type=date&legend=top-left">
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&theme=dark&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
||||||
|
|
||||||
<h1 align="center">Xiaozhi Backend-Service xiaozhi-esp32-server</h1>
|
<h1 align="center">Xiaozhi Backend-Service xiaozhi-esp32-server</h1>
|
||||||
|
|
||||||
|
|
@ -6,23 +6,22 @@
|
||||||
Dieses Projekt basiert auf der Theorie und Technologie der Mensch-Maschine-symbiotischen Intelligenz zur Entwicklung intelligenter Terminal-Hardware- und Software-Systeme<br/>und bietet Backend-Dienste für das Open-Source-Hardware-Projekt
|
Dieses Projekt basiert auf der Theorie und Technologie der Mensch-Maschine-symbiotischen Intelligenz zur Entwicklung intelligenter Terminal-Hardware- und Software-Systeme<br/>und bietet Backend-Dienste für das Open-Source-Hardware-Projekt
|
||||||
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
||||||
Implementiert mit Python, Java und Vue gemäß dem <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">Xiaozhi-Kommunikationsprotokoll</a><br/>
|
Implementiert mit Python, Java und Vue gemäß dem <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">Xiaozhi-Kommunikationsprotokoll</a><br/>
|
||||||
Unterstützt MQTT+UDP-Protokoll, Websocket-Protokoll, MCP-Zugriffspunkte, Stimmabdruckerkennung und Wissensdatenbank
|
Unterstützt MQTT+UDP-Protokoll, Websocket-Protokoll, MCP-Endpunkte und Stimmabdruckerkennung
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../FAQ.md">Häufige Fragen</a>
|
<a href="./docs/FAQ.md">Häufige Fragen</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Probleme melden</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Probleme melden</a>
|
||||||
· <a href="../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment-Dokumentation</a>
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment-Dokumentation</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release-Hinweise</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release-Hinweise</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../../README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DBEDFA"></a>
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DBEDFA"></a>
|
||||||
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
||||||
<a href="./README_es.md"><img alt="Español" src="https://img.shields.io/badge/Español-DFE0E5"></a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -39,7 +38,7 @@ Geleitet vom Team von Professor Siyuan Liu (South China University of Technology
|
||||||
</br>
|
</br>
|
||||||
刘思源教授团队主导研发(华南理工大学)
|
刘思源教授团队主导研发(华南理工大学)
|
||||||
</br>
|
</br>
|
||||||
<img src="../images/hnlg.jpg" alt="South China University of Technology" width="50%">
|
<img src="./docs/images/hnlg.jpg" alt="South China University of Technology" width="50%">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -53,98 +52,113 @@ Möchten Sie die Nutzungseffekte sehen? Klicken Sie auf die Videos unten 🎥
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Das Gefühl der Reaktionsgeschwindigkeit" src="../images/demo9.png" /></picture>
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Das Geheimnis der Geschwindigkeitsoptimierung" src="../images/demo6.png" /></picture>
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1WEcxzFEAT" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Xiaozhi-Digitalmensch mit Sprachaktivierung" src="../images/demo8.png" /></picture>
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CKVz6UEuB" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Anruf von Gerät zu Gerät" src="../images/demo0.png" /></picture>
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Komplexes medizinisches Szenario" src="../images/demo1.png" /></picture>
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Musik abspielen, Wetter abfragen und Nachrichten vorlesen" src="../images/demo7.png" /></picture>
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Unterbrechung in Echtzeit" src="../images/demo10.png" /></picture>
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
</a>
|
</picture>
|
||||||
</td>
|
</a>
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Objekte per Foto erkennen" src="../images/demo12.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Haushaltsgeräte ein- und ausschalten" src="../images/demo5.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Aufgaben mit mehreren Befehlen" src="../images/demo11.png" /></picture>
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MCP-Zugriffspunkt" src="../images/demo13.png" /></picture>
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MQTT-Befehlsübermittlung" src="../images/demo4.png" /></picture>
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Stimmabdruckerkennung" src="../images/demo14.png" /></picture>
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Eigene Stimmfarbe" src="../images/demo2.png" /></picture>
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Gespräch auf Kantonesisch" src="../images/demo3.png" /></picture>
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -161,17 +175,17 @@ Möchten Sie die Nutzungseffekte sehen? Klicken Sie auf die Videos unten 🎥
|
||||||
|
|
||||||
## Deployment-Dokumentation
|
## Deployment-Dokumentation
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Dieses Projekt bietet zwei Bereitstellungsmethoden. Bitte wählen Sie basierend auf Ihren spezifischen Anforderungen:
|
Dieses Projekt bietet zwei Bereitstellungsmethoden. Bitte wählen Sie basierend auf Ihren spezifischen Anforderungen:
|
||||||
|
|
||||||
#### 🚀 Auswahl der Bereitstellungsmethode
|
#### 🚀 Auswahl der Bereitstellungsmethode
|
||||||
| Bereitstellungsmethode | Funktionen | Anwendungsszenarien | Deployment-Dokumente | Konfigurationsanforderungen | Video-Tutorials |
|
| Bereitstellungsmethode | Funktionen | Anwendungsszenarien | Deployment-Dokumente | Konfigurationsanforderungen | Video-Tutorials |
|
||||||
|---------|------|---------|---------|---------|---------|
|
|---------|------|---------|---------|---------|---------|
|
||||||
| **Vereinfachte Installation** | Intelligenter Dialog, Einzel-Agenten-Verwaltung | Umgebungen mit geringer Konfiguration, Daten in Konfigurationsdateien gespeichert, keine Datenbank erforderlich | [①Docker-Version](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Quellcode-Deployment](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| Lokales `FunASR` benötigt mehr Arbeitsspeicher; bei durchgängiger API-Nutzung ist der Ressourcenverbrauch gering | - |
|
| **Vereinfachte Installation** | Intelligenter Dialog, Einzel-Agenten-Verwaltung | Umgebungen mit geringer Konfiguration, Daten in Konfigurationsdateien gespeichert, keine Datenbank erforderlich | [①Docker-Version](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Quellcode-Deployment](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 Kerne 4GB bei Verwendung von `FunASR`, 2 Kerne 2GB bei allen APIs | - |
|
||||||
| **Vollständige Modulinstallation** | Intelligenter Dialog, Mehrbenutzerverwaltung, Mehr-Agenten-Verwaltung, Intelligente Steuerkonsole-Bedienung | Vollständige Funktionserfahrung, Daten in Datenbank gespeichert |[①Docker-Version](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Quellcode-Deployment](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Quellcode-Deployment Auto-Update-Tutorial](../dev-ops-integration.md) | Lokales `FunASR` benötigt mehr Arbeitsspeicher, zusätzlich werden Datenbankressourcen benötigt; bei durchgängiger API-Nutzung ist der Ressourcenverbrauch gering| [Video-Tutorial für lokalen Quellcode-Start](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
| **Vollständige Modulinstallation** | Intelligenter Dialog, Mehrbenutzerverwaltung, Mehr-Agenten-Verwaltung, Intelligente Steuerkonsole-Bedienung | Vollständige Funktionserfahrung, Daten in Datenbank gespeichert |[①Docker-Version](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Quellcode-Deployment](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Quellcode-Deployment Auto-Update-Tutorial](./docs/dev-ops-integration.md) | 4 Kerne 8GB bei Verwendung von `FunASR`, 2 Kerne 4GB bei allen APIs| [Video-Tutorial für lokalen Quellcode-Start](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](../FAQ.md)
|
Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](./docs/FAQ.md)
|
||||||
|
|
||||||
> 💡 Hinweis: Unten ist eine Testplattform, die mit dem neuesten Code bereitgestellt wurde. Sie können bei Bedarf brennen und testen. Gleichzeitige Benutzer: 6, Daten werden täglich gelöscht.
|
> 💡 Hinweis: Unten ist eine Testplattform, die mit dem neuesten Code bereitgestellt wurde. Sie können bei Bedarf brennen und testen. Gleichzeitige Benutzer: 6, Daten werden täglich gelöscht.
|
||||||
|
|
||||||
|
|
@ -210,15 +224,15 @@ Dieses Projekt bietet die folgenden Testwerkzeuge, um Ihnen bei der Überprüfun
|
||||||
|
|
||||||
| Werkzeugname | Standort | Verwendungsmethode | Funktionsbeschreibung |
|
| Werkzeugname | Standort | Verwendungsmethode | Funktionsbeschreibung |
|
||||||
|:---:|:---|:---:|:---:|
|
|:---:|:---|:---:|:---:|
|
||||||
| Audio-Interaktionstesttool | main》digital-human》index.html | In `main/digital-human` zuerst die Abhängigkeiten wie in der README installieren, dann `python start.py` ausführen und `http://127.0.0.1:8006/index.html` öffnen | Testet Audio-Wiedergabe- und Empfangsfunktionen, überprüft, ob die Python-seitige Audioverarbeitung normal ist |
|
| Audio-Interaktionstesttool | main》xiaozhi-server》test》test_page.html | Direkt mit Google Chrome öffnen | Testet Audio-Wiedergabe- und Empfangsfunktionen, überprüft, ob die Python-seitige Audioverarbeitung normal ist |
|
||||||
| Modell-Reaktionstesttool | main》xiaozhi-server》performance_tester.py | Ausführen `python performance_tester.py` | Testet die Reaktionsgeschwindigkeit von Kernmodulen wie ASR (Spracherkennung), LLM (großes Modell), VLLM (Vision-Modell), TTS (Sprachsynthese) |
|
| Modell-Reaktionstesttool | main》xiaozhi-server》performance_tester.py | Ausführen `python performance_tester.py` | Testet die Reaktionsgeschwindigkeit von ASR (Spracherkennung), LLM (großes Modell), VLLM (Vision-Modell), TTS (Sprachsynthese) drei Kernmodulen |
|
||||||
|
|
||||||
> 💡 Hinweis: Beim Testen der Modellgeschwindigkeit werden nur Modelle mit konfigurierten Schlüsseln getestet.
|
> 💡 Hinweis: Beim Testen der Modellgeschwindigkeit werden nur Modelle mit konfigurierten Schlüsseln getestet.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Funktionsliste ✨
|
## Funktionsliste ✨
|
||||||
### Implementiert ✅
|
### Implementiert ✅
|
||||||

|

|
||||||
| Funktionsmodul | Beschreibung |
|
| Funktionsmodul | Beschreibung |
|
||||||
|:---:|:---|
|
|:---:|:---|
|
||||||
| Kernarchitektur | Basierend auf [MQTT+UDP-Gateway](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket und HTTP-Servern, bietet vollständiges Konsolenverwaltungs- und Authentifizierungssystem |
|
| Kernarchitektur | Basierend auf [MQTT+UDP-Gateway](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket und HTTP-Servern, bietet vollständiges Konsolenverwaltungs- und Authentifizierungssystem |
|
||||||
|
|
@ -226,21 +240,21 @@ Dieses Projekt bietet die folgenden Testwerkzeuge, um Ihnen bei der Überprüfun
|
||||||
| Stimmabdruckerkennung | Unterstützt Mehrbenutzer-Stimmabdruckregistrierung, -verwaltung und -erkennung, verarbeitet parallel mit ASR, Echtzeit-Sprecheridentitätserkennung und Weitergabe an LLM für personalisierte Antworten |
|
| Stimmabdruckerkennung | Unterstützt Mehrbenutzer-Stimmabdruckregistrierung, -verwaltung und -erkennung, verarbeitet parallel mit ASR, Echtzeit-Sprecheridentitätserkennung und Weitergabe an LLM für personalisierte Antworten |
|
||||||
| Intelligenter Dialog | Unterstützt mehrere LLM (große Sprachmodelle), implementiert intelligenten Dialog |
|
| Intelligenter Dialog | Unterstützt mehrere LLM (große Sprachmodelle), implementiert intelligenten Dialog |
|
||||||
| Visuelle Wahrnehmung | Unterstützt mehrere VLLM (Vision Large Models), implementiert multimodale Interaktion |
|
| Visuelle Wahrnehmung | Unterstützt mehrere VLLM (Vision Large Models), implementiert multimodale Interaktion |
|
||||||
| Absichtserkennung | Unterstützt externe LLM-Absichtserkennung, autonome Funktionsaufrufe durch große Modelle, bietet plugin-basierten Absichtsverarbeitungsmechanismus |
|
| Absichtserkennung | Unterstützt LLM-Absichtserkennung, Function Call-Funktionsaufruf, bietet plugin-basierten Absichtsverarbeitungsmechanismus |
|
||||||
| Gedächtnissystem | Unterstützt lokales Kurzzeitgedächtnis, mem0ai-Schnittstellengedächtnis, PowerMem intelligentes Gedächtnis, mit Gedächtniszusammenfassungsfunktion |
|
| Gedächtnissystem | Unterstützt lokales Kurzzeitgedächtnis, mem0ai-Schnittstellengedächtnis, PowerMem intelligentes Gedächtnis, mit Gedächtniszusammenfassungsfunktion |
|
||||||
| Wissensdatenbank | Unterstützt RAGFlow-Wissensdatenbank, ermöglicht großem Modell die Bewertung, ob Wissensdatenbank benötigt wird, bevor geantwortet wird |
|
| Wissensdatenbank | Unterstützt RAGFlow-Wissensdatenbank, ermöglicht großem Modell die Bewertung, ob Wissensdatenbank benötigt wird, bevor geantwortet wird |
|
||||||
| Werkzeugaufruf | Unterstützt Client-IOT-Protokoll, Client-MCP-Protokoll, Server-MCP-Protokoll, MCP-Zugriffspunktprotokoll, benutzerdefinierte Werkzeugfunktionen |
|
| Werkzeugaufruf | Unterstützt Client-IOT-Protokoll, Client-MCP-Protokoll, Server-MCP-Protokoll, MCP-Endpunktprotokoll, benutzerdefinierte Werkzeugfunktionen |
|
||||||
| Befehlsübermittlung | Basierend auf MQTT-Protokoll, unterstützt die Übermittlung von MCP-Befehlen von der intelligenten Steuerkonsole an ESP32-Geräte |
|
| Befehlsübermittlung | Basierend auf MQTT-Protokoll, unterstützt die Übermittlung von MCP-Befehlen von der intelligenten Steuerkonsole an ESP32-Geräte |
|
||||||
| Verwaltungs-Backend | Bietet Web-Verwaltungsoberfläche, unterstützt Benutzerverwaltung, Systemkonfiguration und Geräteverwaltung; Oberfläche unterstützt vereinfachtes Chinesisch, traditionelles Chinesisch, Englisch, Deutsch, Vietnamesisch und brasilianisches Portugiesisch an |
|
| Verwaltungs-Backend | Bietet Web-Verwaltungsoberfläche, unterstützt Benutzerverwaltung, Systemkonfiguration und Geräteverwaltung; Oberfläche unterstützt vereinfachtes Chinesisch, traditionelles Chinesisch und englische Anzeige |
|
||||||
| Testwerkzeuge | Bietet Leistungstestwerkzeuge für Modellantworten und Audio-Interaktionstestwerkzeuge |
|
| Testwerkzeuge | Bietet Leistungstestwerkzeuge, Vision-Modell-Testwerkzeuge und Audio-Interaktionstestwerkzeuge |
|
||||||
| Deployment-Unterstützung | Unterstützt Docker-Deployment und lokales Deployment, bietet vollständige Konfigurationsdateiverwaltung |
|
| Deployment-Unterstützung | Unterstützt Docker-Deployment und lokales Deployment, bietet vollständige Konfigurationsdateiverwaltung |
|
||||||
| Plugin-System | Unterstützt funktionale Plugin-Erweiterungen und benutzerdefinierte Plugin-Entwicklung; neu hinzugefügte Plugin-Dateien werden bei der nächsten Geräteverbindung geladen, Änderungen an bereits geladenen Plugins erfordern einen Neustart des Dienstes |
|
| Plugin-System | Unterstützt funktionale Plugin-Erweiterungen, benutzerdefinierte Plugin-Entwicklung und Plugin-Hot-Loading |
|
||||||
|
|
||||||
### In Entwicklung 🚧
|
### In Entwicklung 🚧
|
||||||
|
|
||||||
Um über spezifische Entwicklungsplanfortschritte zu erfahren, [klicken Sie hier](https://github.com/users/xinnan-tech/projects/3). Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](../FAQ.md)
|
Um über spezifische Entwicklungsplanfortschritte zu erfahren, [klicken Sie hier](https://github.com/users/xinnan-tech/projects/3). Häufige Fragen und entsprechende Tutorials finden Sie unter [diesem Link](./docs/FAQ.md)
|
||||||
|
|
||||||
Wenn Sie ein Softwareentwickler sind, finden Sie hier einen [Offenen Brief an Entwickler](../contributor_open_letter.md). Willkommen beim Beitritt!
|
Wenn Sie ein Softwareentwickler sind, finden Sie hier einen [Offenen Brief an Entwickler](docs/contributor_open_letter.md). Willkommen beim Beitritt!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -254,7 +268,7 @@ Xiaozhi ist ein Ökosystem. Wenn Sie dieses Produkt verwenden, können Sie sich
|
||||||
|
|
||||||
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Volcano Engine Doubao, Volcano Engine AI Gateway, DeepSeek, Zhipu ChatGLM, Gemini, iFLYTEK, LM Studio | Zhipu ChatGLM, Gemini |
|
| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Volcano Engine Doubao, DeepSeek, Zhipu ChatGLM, Gemini | Zhipu ChatGLM, Gemini |
|
||||||
| Ollama-Schnittstellenaufrufe | Ollama | - |
|
| Ollama-Schnittstellenaufrufe | Ollama | - |
|
||||||
| Dify-Schnittstellenaufrufe | Dify | - |
|
| Dify-Schnittstellenaufrufe | Dify | - |
|
||||||
| FastGPT-Schnittstellenaufrufe | FastGPT | - |
|
| FastGPT-Schnittstellenaufrufe | FastGPT | - |
|
||||||
|
|
@ -270,7 +284,7 @@ Tatsächlich kann jedes LLM, das OpenAI-Schnittstellenaufrufe unterstützt, inte
|
||||||
|
|
||||||
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Zhipu ChatGLMVLLM, iFLYTEK | Zhipu ChatGLMVLLM |
|
| OpenAI-Schnittstellenaufrufe | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
|
||||||
|
|
||||||
Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, integriert und verwendet werden.
|
Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, integriert und verwendet werden.
|
||||||
|
|
||||||
|
|
@ -280,8 +294,8 @@ Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, int
|
||||||
|
|
||||||
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Schnittstellenaufrufe | EdgeTTS, iFLYTEK, Volcano Engine Doubao TTS, Volcano Engine AI Gateway TTS, Tencent Cloud, Alibaba Cloud TTS, AliYun Stream TTS, Alibaba Bailian CosyVoice TTS, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, CustomTTS, OpenAITTS, MinimaxTTS, Volcano Dual-Stream TTS | EdgeTTS, CosyVoiceSiliconflow (teilweise) |
|
| Schnittstellenaufrufe | EdgeTTS, Volcano Engine Doubao TTS, Tencent Cloud, Alibaba Cloud TTS, AliYun Stream TTS, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS, Volcano Dual-Stream TTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow (teilweise) |
|
||||||
| Lokale Dienste | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, IndexStreamTTS, PaddleSpeechTTS | IndexStreamTTS, PaddleSpeechTTS, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
| Lokale Dienste | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -297,8 +311,8 @@ Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, int
|
||||||
|
|
||||||
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Lokale Verwendung | FunASR, SherpaASR, SherpaParaformerASR, VoskASR | FunASR, SherpaASR, SherpaParaformerASR, VoskASR |
|
| Lokale Verwendung | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
| Schnittstellenaufrufe | DoubaoASR, Doubao Streaming ASR, Doubao Streaming ASR V2, FunASRServer, iFLYTEK, TencentASR, AliyunASR, Aliyun Streaming ASR, Alibaba Bailian Streaming ASR, Baidu ASR, OpenAI ASR, GroqASR, Qwen3ASRFlash | FunASRServer |
|
| Schnittstellenaufrufe | DoubaoASR, Doubao Streaming ASR, FunASRServer, TencentASR, AliyunASR, Aliyun Streaming ASR, Baidu ASR, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -306,9 +320,7 @@ Tatsächlich kann jedes VLLM, das OpenAI-Schnittstellenaufrufe unterstützt, int
|
||||||
|
|
||||||
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
| Verwendungsmethode | Unterstützte Plattformen | Kostenlose Plattformen |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Schnittstellenaufrufe | Voiceprint-Dienst (voiceprint-api) | - |
|
| Lokale Verwendung | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
Die Stimmabdruckerkennung erfordert einen separat bereitgestellten [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api)-Dienst (auf Basis von 3D-Speaker) sowie MySQL. Siehe [Anleitung zur Stimmabdruckerkennung](../voiceprint-integration.md).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -317,10 +329,9 @@ Die Stimmabdruckerkennung erfordert einen separat bereitgestellten [voiceprint-a
|
||||||
| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
|
| Typ | Plattformname | Verwendungsmethode | Preismodell | Hinweise |
|
||||||
|:------:|:---------------:|:----:|:---------:|:--:|
|
|:------:|:---------------:|:----:|:---------:|:--:|
|
||||||
| Memory | mem0ai | Schnittstellenaufrufe | 1000 Mal/Monat Kontingent | |
|
| Memory | mem0ai | Schnittstellenaufrufe | 1000 Mal/Monat Kontingent | |
|
||||||
| Memory | [powermem](../powermem-integration.md) | Lokale Zusammenfassung | Abhängig von LLM und DB | OceanBase Open Source, unterstützt intelligente Abfrage |
|
| Memory | [powermem](./docs/powermem-integration.md) | Lokale Zusammenfassung | Abhängig von LLM und DB | OceanBase Open Source, unterstützt intelligente Abfrage |
|
||||||
| Memory | mem_local_short | Lokale Zusammenfassung | Kostenlos | |
|
| Memory | mem_local_short | Lokale Zusammenfassung | Kostenlos | |
|
||||||
| Memory | nomem | Kein Gedächtnismodus | Kostenlos | |
|
| Memory | nomem | Kein Gedächtnismodus | Kostenlos | |
|
||||||
| Memory | mem_report_only | Nur Meldung | Kostenlos | Meldet nur Chat-Verläufe, keine Gedächtniszusammenfassung |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -346,19 +357,20 @@ Die Stimmabdruckerkennung erfordert einen separat bereitgestellten [voiceprint-a
|
||||||
|
|
||||||
| Logo | Projekt/Unternehmen | Beschreibung |
|
| Logo | Projekt/Unternehmen | Beschreibung |
|
||||||
|:---:|:---:|:---|
|
|:---:|:---:|:---|
|
||||||
| <img src="../images/logo_bailing.png" width="160"> | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | Dieses Projekt wurde von [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) inspiriert und auf dessen Basis implementiert |
|
| <img src="./docs/images/logo_bailing.png" width="160"> | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | Dieses Projekt wurde von [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) inspiriert und auf dessen Basis implementiert |
|
||||||
| <img src="../images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Dank an [Tenclass](https://www.tenclass.com/) für die Formulierung von Standardkommunikationsprotokollen, Multi-Geräte-Kompatibilitätslösungen und High-Concurrency-Szenario-Praxisdemonstrationen für das Xiaozhi-Ökosystem; für die Bereitstellung vollständiger technischer Dokumentationsunterstützung für dieses Projekt |
|
| <img src="./docs/images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Dank an [Tenclass](https://www.tenclass.com/) für die Formulierung von Standardkommunikationsprotokollen, Multi-Geräte-Kompatibilitätslösungen und High-Concurrency-Szenario-Praxisdemonstrationen für das Xiaozhi-Ökosystem; für die Bereitstellung vollständiger technischer Dokumentationsunterstützung für dieses Projekt |
|
||||||
| <img src="../images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Dank an [Xuanfeng Technology](https://github.com/Eric0308) für den Beitrag des Funktionsaufruf-Frameworks, des MCP-Kommunikationsprotokolls und der plugin-basierten Aufrufmechanismus-Implementierungscode. Durch standardisiertes Befehlsplanungssystem und dynamische Erweiterungsfähigkeiten wird die Interaktionseffizienz und funktionale Erweiterbarkeit von Frontend-Geräten (IoT) erheblich verbessert |
|
| <img src="./docs/images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Dank an [Xuanfeng Technology](https://github.com/Eric0308) für den Beitrag des Funktionsaufruf-Frameworks, des MCP-Kommunikationsprotokolls und der plugin-basierten Aufrufmechanismus-Implementierungscode. Durch standardisiertes Befehlsplanungssystem und dynamische Erweiterungsfähigkeiten wird die Interaktionseffizienz und funktionale Erweiterbarkeit von Frontend-Geräten (IoT) erheblich verbessert |
|
||||||
| <img src="../images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Dank an [huangjunsen](https://github.com/huangjunsen0406) für den Beitrag des `Smart Control Console Mobile`-Moduls, das eine effiziente Steuerung und Echtzeit-Interaktion über mobile Geräte ermöglicht und die Betriebsbequemlichkeit und Verwaltungseffizienz des Systems in mobilen Szenarien erheblich verbessert |
|
| <img src="./docs/images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Dank an [huangjunsen](https://github.com/huangjunsen0406) für den Beitrag des `Smart Control Console Mobile`-Moduls, das eine effiziente Steuerung und Echtzeit-Interaktion über mobile Geräte ermöglicht und die Betriebsbequemlichkeit und Verwaltungseffizienz des Systems in mobilen Szenarien erheblich verbessert |
|
||||||
| <img src="../images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Dank an [Huiyuan Design](http://ui.kwd988.net/) für die Bereitstellung professioneller visueller Lösungen für dieses Projekt, unter Verwendung ihrer Design-Praxiserfahrung im Dienst von über tausend Unternehmen, um die Produktbenutzererfahrung dieses Projekts zu stärken |
|
| <img src="./docs/images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Dank an [Huiyuan Design](http://ui.kwd988.net/) für die Bereitstellung professioneller visueller Lösungen für dieses Projekt, unter Verwendung ihrer Design-Praxiserfahrung im Dienst von über tausend Unternehmen, um die Produktbenutzererfahrung dieses Projekts zu stärken |
|
||||||
| <img src="../images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Dank an [Xi'an Qinren Information Technology](https://www.029app.com/) für die Vertiefung des visuellen Systems dieses Projekts und die Sicherstellung der Konsistenz und Erweiterbarkeit des Gesamtdesignstils in Multi-Szenario-Anwendungen |
|
| <img src="./docs/images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Dank an [Xi'an Qinren Information Technology](https://www.029app.com/) für die Vertiefung des visuellen Systems dieses Projekts und die Sicherstellung der Konsistenz und Erweiterbarkeit des Gesamtdesignstils in Multi-Szenario-Anwendungen |
|
||||||
| <img src="../images/logo_contributors.png" width="160"> | [Code-Mitwirkende](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Dank an [alle Code-Mitwirkenden](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), Ihre Bemühungen haben das Projekt robuster und leistungsfähiger gemacht. |
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [Code-Mitwirkende](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Dank an [alle Code-Mitwirkenden](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), Ihre Bemühungen haben das Projekt robuster und leistungsfähiger gemacht. |
|
||||||
|
|
||||||
|
|
||||||
<a href="https://www.star-history.com/?repos=xinnan-tech%2Fxiaozhi-esp32-server&type=date&legend=top-left">
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&theme=dark&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
||||||
|
|
||||||
<h1 align="center">Xiaozhi Backend Service xiaozhi-esp32-server</h1>
|
<h1 align="center">Xiaozhi Backend Service xiaozhi-esp32-server</h1>
|
||||||
|
|
||||||
|
|
@ -10,19 +10,18 @@ Support for MQTT+UDP protocol, Websocket protocol, MCP access point, voiceprint
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../FAQ.md">FAQ</a>
|
<a href="./docs/FAQ.md">FAQ</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Report Issues</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Report Issues</a>
|
||||||
· <a href="../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment Docs</a>
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Deployment Docs</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release Notes</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Release Notes</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../../README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DBEDFA"></a>
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DBEDFA"></a>
|
||||||
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
||||||
<a href="./README_es.md"><img alt="Español" src="https://img.shields.io/badge/Español-DFE0E5"></a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -39,7 +38,7 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
</br>
|
</br>
|
||||||
刘思源教授团队主导研发(华南理工大学)
|
刘思源教授团队主导研发(华南理工大学)
|
||||||
</br>
|
</br>
|
||||||
<img src="../images/hnlg.jpg" alt="South China University of Technology" width="50%">
|
<img src="./docs/images/hnlg.jpg" alt="South China University of Technology" width="50%">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -53,98 +52,113 @@ Want to see the usage effects? Click the videos below 🎥
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="The feel of the response speed" src="../images/demo9.png" /></picture>
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="The secret to speeding things up" src="../images/demo6.png" /></picture>
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1WEcxzFEAT" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Xiaozhi digital human with voice wake-up" src="../images/demo8.png" /></picture>
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CKVz6UEuB" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Device-to-device calling" src="../images/demo0.png" /></picture>
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="A complex medical scenario" src="../images/demo1.png" /></picture>
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Play music, check the weather, and read the news" src="../images/demo7.png" /></picture>
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Real-time interruption" src="../images/demo10.png" /></picture>
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
</a>
|
</picture>
|
||||||
</td>
|
</a>
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Take a photo to identify objects" src="../images/demo12.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Turn home appliances on and off" src="../images/demo5.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Multi-command tasks" src="../images/demo11.png" /></picture>
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MCP access point" src="../images/demo13.png" /></picture>
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="MQTT command delivery" src="../images/demo4.png" /></picture>
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Voiceprint recognition" src="../images/demo14.png" /></picture>
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Custom voice timbre" src="../images/demo2.png" /></picture>
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Talking in Cantonese" src="../images/demo3.png" /></picture>
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -161,17 +175,17 @@ Want to see the usage effects? Click the videos below 🎥
|
||||||
|
|
||||||
## Deployment Documentation
|
## Deployment Documentation
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
This project provides two deployment methods. Please choose based on your specific needs:
|
This project provides two deployment methods. Please choose based on your specific needs:
|
||||||
|
|
||||||
#### 🚀 Deployment Method Selection
|
#### 🚀 Deployment Method Selection
|
||||||
| Deployment Method | Features | Applicable Scenarios | Deployment Docs | Configuration Requirements | Video Tutorials |
|
| Deployment Method | Features | Applicable Scenarios | Deployment Docs | Configuration Requirements | Video Tutorials |
|
||||||
|---------|------|---------|---------|---------|---------|
|
|---------|------|---------|---------|---------|---------|
|
||||||
| **Simplified Installation** | Intelligent dialogue, single agent management | Low-configuration environments, data stored in config files, no database required | [①Docker Version](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Source Code Deployment](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| Local `FunASR` needs more memory; using APIs for everything keeps resource usage low | - |
|
| **Simplified Installation** | Intelligent dialogue, single agent management | Low-configuration environments, data stored in config files, no database required | [①Docker Version](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Source Code Deployment](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 cores 4GB if using `FunASR`, 2 cores 2GB if all APIs | - |
|
||||||
| **Full Module Installation** | Intelligent dialogue, multi-user management, multi-agent management, intelligent console interface operation | Complete functionality experience, data stored in database |[①Docker Version](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Source Code Deployment](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Source Code Deployment Auto-Update Tutorial](../dev-ops-integration.md) | Local `FunASR` needs more memory plus database resources; using APIs for everything keeps resource usage low| [Local Source Code Startup Video Tutorial](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
| **Full Module Installation** | Intelligent dialogue, multi-user management, multi-agent management, intelligent console interface operation | Complete functionality experience, data stored in database |[①Docker Version](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Source Code Deployment](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Source Code Deployment Auto-Update Tutorial](./docs/dev-ops-integration.md) | 4 cores 8GB if using `FunASR`, 2 cores 4GB if all APIs| [Local Source Code Startup Video Tutorial](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
For frequently asked questions and related tutorials, please refer to [this link](../FAQ.md)
|
For frequently asked questions and related tutorials, please refer to [this link](./docs/FAQ.md)
|
||||||
|
|
||||||
> 💡 Note: Below is a test platform deployed with the latest code. You can burn and test if needed. Concurrent users: 6, data will be cleared daily.
|
> 💡 Note: Below is a test platform deployed with the latest code. You can burn and test if needed. Concurrent users: 6, data will be cleared daily.
|
||||||
|
|
||||||
|
|
@ -210,15 +224,15 @@ This project provides the following testing tools to help you verify the system
|
||||||
|
|
||||||
| Tool Name | Location | Usage Method | Function Description |
|
| Tool Name | Location | Usage Method | Function Description |
|
||||||
|:---:|:---|:---:|:---:|
|
|:---:|:---|:---:|:---:|
|
||||||
| Audio Interaction Test Tool | main》digital-human》index.html | In `main/digital-human`, install dependencies as its README says, then run `python start.py` and open `http://127.0.0.1:8006/index.html` | Tests audio playback and reception functions, verifies if Python-side audio processing is normal |
|
| Audio Interaction Test Tool | main》xiaozhi-server》test》test_page.html | Open directly with Google Chrome | Tests audio playback and reception functions, verifies if Python-side audio processing is normal |
|
||||||
| Model Response Test Tool | main》xiaozhi-server》performance_tester.py | Execute `python performance_tester.py` | Tests response speed of core modules such as ASR(speech recognition), LLM(large model), VLLM(vision model), TTS(speech synthesis) |
|
| Model Response Test Tool | main》xiaozhi-server》performance_tester.py | Execute `python performance_tester.py` | Tests response speed of three core modules: ASR(speech recognition), LLM(large model), VLLM(vision model), TTS(speech synthesis) |
|
||||||
|
|
||||||
> 💡 Note: When testing model speed, only models with configured keys will be tested.
|
> 💡 Note: When testing model speed, only models with configured keys will be tested.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Feature List ✨
|
## Feature List ✨
|
||||||
### Implemented ✅
|
### Implemented ✅
|
||||||

|

|
||||||
| Feature Module | Description |
|
| Feature Module | Description |
|
||||||
|:---:|:---|
|
|:---:|:---|
|
||||||
| Core Architecture | Based on [MQTT+UDP gateway](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket and HTTP servers, provides complete console management and authentication system |
|
| Core Architecture | Based on [MQTT+UDP gateway](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket and HTTP servers, provides complete console management and authentication system |
|
||||||
|
|
@ -226,21 +240,21 @@ This project provides the following testing tools to help you verify the system
|
||||||
| Voiceprint Recognition | Supports multi-user voiceprint registration, management, and recognition, processes in parallel with ASR, real-time speaker identity recognition and passes to LLM for personalized responses |
|
| Voiceprint Recognition | Supports multi-user voiceprint registration, management, and recognition, processes in parallel with ASR, real-time speaker identity recognition and passes to LLM for personalized responses |
|
||||||
| Intelligent Dialogue | Supports multiple LLM(large language models), implements intelligent dialogue |
|
| Intelligent Dialogue | Supports multiple LLM(large language models), implements intelligent dialogue |
|
||||||
| Visual Perception | Supports multiple VLLM(vision large models), implements multimodal interaction |
|
| Visual Perception | Supports multiple VLLM(vision large models), implements multimodal interaction |
|
||||||
| Intent Recognition | Supports pluggable external LLM intent recognition and autonomous LLM function calling, provides plugin-based intent processing mechanism |
|
| Intent Recognition | Supports LLM intent recognition, Function Call function calling, provides plugin-based intent processing mechanism |
|
||||||
| Memory System | Supports local short-term memory, mem0ai interface memory, PowerMem intelligent memory, with memory summarization functionality |
|
| Memory System | Supports local short-term memory, mem0ai interface memory, PowerMem intelligent memory, with memory summarization functionality |
|
||||||
| Knowledge Base | Supports RAGFlow knowledge base, enabling LLM to judge whether to schedule the knowledge base after receiving the user's question, and then answer the question |
|
| Knowledge Base | Supports RAGFlow knowledge base, enabling LLM to judge whether to schedule the knowledge base after receiving the user's question, and then answer the question |
|
||||||
| Tool Calling | Supports client IOT protocol, client MCP protocol, server MCP protocol, MCP access point protocol, custom tool functions |
|
| Tool Calling | Supports client IOT protocol, client MCP protocol, server MCP protocol, MCP endpoint protocol, custom tool functions |
|
||||||
| Command Delivery | Supports MCP command delivery to ESP32 devices via MQTT protocol from Smart Console |
|
| Command Delivery | Supports MCP command delivery to ESP32 devices via MQTT protocol from Smart Console |
|
||||||
| Management Backend | Provides Web management interface, supports user management, system configuration and device management; Supports Simplified Chinese, Traditional Chinese, English, German, Vietnamese and Brazilian Portuguese display |
|
| Management Backend | Provides Web management interface, supports user management, system configuration and device management; Supports Simplified Chinese, Traditional Chinese and English display |
|
||||||
| Testing Tools | Provides model response performance testing tools and audio interaction testing tools |
|
| Testing Tools | Provides performance testing tools, vision model testing tools, and audio interaction testing tools |
|
||||||
| Deployment Support | Supports Docker deployment and local deployment, provides complete configuration file management |
|
| Deployment Support | Supports Docker deployment and local deployment, provides complete configuration file management |
|
||||||
| Plugin System | Supports functional plugin extensions and custom plugin development; newly added plugin files are loaded on the next device connection, code changes to already loaded plugins require a service restart |
|
| Plugin System | Supports functional plugin extensions, custom plugin development, and plugin hot-loading |
|
||||||
|
|
||||||
### Under Development 🚧
|
### Under Development 🚧
|
||||||
|
|
||||||
To learn about specific development plan progress, [click here](https://github.com/users/xinnan-tech/projects/3). For frequently asked questions and related tutorials, please refer to [this link](../FAQ.md)
|
To learn about specific development plan progress, [click here](https://github.com/users/xinnan-tech/projects/3). For frequently asked questions and related tutorials, please refer to [this link](./docs/FAQ.md)
|
||||||
|
|
||||||
If you are a software developer, here is an [Open Letter to Developers](../contributor_open_letter.md). Welcome to join!
|
If you are a software developer, here is an [Open Letter to Developers](docs/contributor_open_letter.md). Welcome to join!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -254,7 +268,7 @@ Xiaozhi is an ecosystem. When using this product, you can also check out other [
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI interface calls | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK, LM Studio | Zhipu, Gemini |
|
| OpenAI interface calls | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK | Zhipu, Gemini |
|
||||||
| Ollama interface calls | Ollama | - |
|
| Ollama interface calls | Ollama | - |
|
||||||
| Dify interface calls | Dify | - |
|
| Dify interface calls | Dify | - |
|
||||||
| FastGPT interface calls | FastGPT | - |
|
| FastGPT interface calls | FastGPT | - |
|
||||||
|
|
@ -270,7 +284,7 @@ In fact, any LLM that supports OpenAI interface calls can be integrated and used
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| OpenAI interface calls | Alibaba Bailian, Zhipu ChatGLMVLLM, iFLYTEK | Zhipu ChatGLMVLLM |
|
| OpenAI interface calls | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
|
||||||
|
|
||||||
In fact, any VLLM that supports OpenAI interface calls can be integrated and used.
|
In fact, any VLLM that supports OpenAI interface calls can be integrated and used.
|
||||||
|
|
||||||
|
|
@ -280,8 +294,8 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Interface calls | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud and Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, CustomTTS, OpenAITTS, MinimaxTTS | EdgeTTS, CosyVoiceSiliconflow(partial) |
|
| Interface calls | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud and Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow(partial) |
|
||||||
| Local services | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, IndexStreamTTS, PaddleSpeechTTS | IndexStreamTTS, PaddleSpeechTTS, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
| Local services | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -297,8 +311,8 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Local use | FunASR, SherpaASR, SherpaParaformerASR, VoskASR | FunASR, SherpaASR, SherpaParaformerASR, VoskASR |
|
| Local use | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
| Interface calls | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud and Bailian, Baidu Cloud, OpenAI ASR, GroqASR, Qwen3ASRFlash | FunASRServer |
|
| Interface calls | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -306,9 +320,7 @@ In fact, any VLLM that supports OpenAI interface calls can be integrated and use
|
||||||
|
|
||||||
| Usage Method | Supported Platforms | Free Platforms |
|
| Usage Method | Supported Platforms | Free Platforms |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Interface calls | Voiceprint service (voiceprint-api) | - |
|
| Local use | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
Voiceprint recognition requires a separately deployed [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) service (based on 3D-Speaker) and MySQL. See the [voiceprint integration guide](../voiceprint-integration.md).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -317,10 +329,9 @@ Voiceprint recognition requires a separately deployed [voiceprint-api](https://g
|
||||||
| Type | Platform Name | Usage Method | Pricing Model | Notes |
|
| Type | Platform Name | Usage Method | Pricing Model | Notes |
|
||||||
|:------:|:---------------:|:----:|:---------:|:--:|
|
|:------:|:---------------:|:----:|:---------:|:--:|
|
||||||
| Memory | mem0ai | Interface calls | 1000 times/month quota | |
|
| Memory | mem0ai | Interface calls | 1000 times/month quota | |
|
||||||
| Memory | [powermem](../powermem-integration.md) | Local summarization | Depends on LLM and DB | OceanBase open source, supports intelligent retrieval |
|
| Memory | [powermem](./docs/powermem-integration.md) | Local summarization | Depends on LLM and DB | OceanBase open source, supports intelligent retrieval |
|
||||||
| Memory | mem_local_short | Local summarization | Free | |
|
| Memory | mem_local_short | Local summarization | Free | |
|
||||||
| Memory | nomem | No memory mode | Free | |
|
| Memory | nomem | No memory mode | Free | |
|
||||||
| Memory | mem_report_only | Report only | Free | Only reports chat records, no memory summarization |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -346,19 +357,20 @@ Voiceprint recognition requires a separately deployed [voiceprint-api](https://g
|
||||||
|
|
||||||
| Logo | Project/Company | Description |
|
| Logo | Project/Company | Description |
|
||||||
|:---:|:---:|:---|
|
|:---:|:---:|:---|
|
||||||
| <img src="../images/logo_bailing.png" width="160"> | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | This project is inspired by [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) and implemented on its basis |
|
| <img src="./docs/images/logo_bailing.png" width="160"> | [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) | This project is inspired by [Bailing Voice Dialogue Robot](https://github.com/wwbin2017/bailing) and implemented on its basis |
|
||||||
| <img src="../images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Thanks to [Tenclass](https://www.tenclass.com/) for formulating standard communication protocols, multi-device compatibility solutions, and high-concurrency scenario practice demonstrations for the Xiaozhi ecosystem; providing full-link technical documentation support for this project |
|
| <img src="./docs/images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Thanks to [Tenclass](https://www.tenclass.com/) for formulating standard communication protocols, multi-device compatibility solutions, and high-concurrency scenario practice demonstrations for the Xiaozhi ecosystem; providing full-link technical documentation support for this project |
|
||||||
| <img src="../images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Thanks to [Xuanfeng Technology](https://github.com/Eric0308) for contributing function calling framework, MCP communication protocol, and plugin-based calling mechanism implementation code. Through standardized instruction scheduling system and dynamic expansion capabilities, it significantly improves the interaction efficiency and functional extensibility of frontend devices (IoT) |
|
| <img src="./docs/images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Thanks to [Xuanfeng Technology](https://github.com/Eric0308) for contributing function calling framework, MCP communication protocol, and plugin-based calling mechanism implementation code. Through standardized instruction scheduling system and dynamic expansion capabilities, it significantly improves the interaction efficiency and functional extensibility of frontend devices (IoT) |
|
||||||
| <img src="../images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Thanks to [huangjunsen](https://github.com/huangjunsen0406) for contributing the `Smart Control Console Mobile` module, which enables efficient control and real-time interaction across mobile devices, significantly enhancing the system's operational convenience and management efficiency in mobile scenarios. |
|
| <img src="./docs/images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Thanks to [huangjunsen](https://github.com/huangjunsen0406) for contributing the `Smart Control Console Mobile` module, which enables efficient control and real-time interaction across mobile devices, significantly enhancing the system's operational convenience and management efficiency in mobile scenarios. |
|
||||||
| <img src="../images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Thanks to [Huiyuan Design](http://ui.kwd988.net/) for providing professional visual solutions for this project, using their design practical experience serving over a thousand enterprises to empower this project's product user experience |
|
| <img src="./docs/images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Thanks to [Huiyuan Design](http://ui.kwd988.net/) for providing professional visual solutions for this project, using their design practical experience serving over a thousand enterprises to empower this project's product user experience |
|
||||||
| <img src="../images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Thanks to [Xi'an Qinren Information Technology](https://www.029app.com/) for deepening this project's visual system, ensuring consistency and extensibility of overall design style in multi-scenario applications |
|
| <img src="./docs/images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Thanks to [Xi'an Qinren Information Technology](https://www.029app.com/) for deepening this project's visual system, ensuring consistency and extensibility of overall design style in multi-scenario applications |
|
||||||
| <img src="../images/logo_contributors.png" width="160"> | [Code Contributors](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Thanks to [all code contributors](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), your efforts have made the project more robust and powerful. |
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [Code Contributors](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Thanks to [all code contributors](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), your efforts have made the project more robust and powerful. |
|
||||||
|
|
||||||
|
|
||||||
<a href="https://www.star-history.com/?repos=xinnan-tech%2Fxiaozhi-esp32-server&type=date&legend=top-left">
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&theme=dark&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
||||||
|
|
||||||
<h1 align="center">Serviço Backend Xiaozhi xiaozhi-esp32-server</h1>
|
<h1 align="center">Serviço Backend Xiaozhi xiaozhi-esp32-server</h1>
|
||||||
|
|
||||||
|
|
@ -10,19 +10,18 @@ Suporte ao protocolo MQTT+UDP, protocolo WebSocket, ponto de acesso MCP, reconhe
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../FAQ.md">Perguntas Frequentes</a>
|
<a href="./docs/FAQ.md">Perguntas Frequentes</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Reportar Problemas</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Reportar Problemas</a>
|
||||||
· <a href="../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Documentação de Implantação</a>
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Documentação de Implantação</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Notas de Lançamento</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Notas de Lançamento</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../../README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
||||||
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DBEDFA"></a>
|
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DBEDFA"></a>
|
||||||
<a href="./README_es.md"><img alt="Español" src="https://img.shields.io/badge/Español-DFE0E5"></a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -39,7 +38,7 @@ Liderado pela Equipe do Professor Siyuan Liu (Universidade de Tecnologia do Sul
|
||||||
</br>
|
</br>
|
||||||
刘思源教授团队主导研发(华南理工大学)
|
刘思源教授团队主导研发(华南理工大学)
|
||||||
</br>
|
</br>
|
||||||
<img src="../images/hnlg.jpg" alt="Universidade de Tecnologia do Sul da China (华南理工大学)" width="50%">
|
<img src="./docs/images/hnlg.jpg" alt="Universidade de Tecnologia do Sul da China (华南理工大学)" width="50%">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -53,98 +52,113 @@ Quer ver os efeitos de uso? Clique nos vídeos abaixo 🎥
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="A sensação da velocidade de resposta" src="../images/demo9.png" /></picture>
|
<img alt="Experiência de velocidade de resposta" src="docs/images/demo9.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="O segredo para otimizar a velocidade" src="../images/demo6.png" /></picture>
|
<img alt="Segredo da otimização de velocidade" src="docs/images/demo6.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1WEcxzFEAT" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Humano digital Xiaozhi com ativação por voz" src="../images/demo8.png" /></picture>
|
<img alt="Cenário médico complexo" src="docs/images/demo1.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CKVz6UEuB" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Chamadas de dispositivo para dispositivo" src="../images/demo0.png" /></picture>
|
<img alt="Envio de comandos MQTT" src="docs/images/demo4.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Cenário médico complexo" src="../images/demo1.png" /></picture>
|
<img alt="Reconhecimento de impressão vocal" src="docs/images/demo14.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Reproduzir música, consultar o tempo e ler as notícias" src="../images/demo7.png" /></picture>
|
<img alt="Controle de interruptores de eletrodomésticos" src="docs/images/demo5.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Interrupção em tempo real" src="../images/demo10.png" /></picture>
|
<img alt="Ponto de acesso MCP" src="docs/images/demo13.png" />
|
||||||
</a>
|
</picture>
|
||||||
</td>
|
</a>
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Reconhecer objetos com uma foto" src="../images/demo12.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Controlar o acionamento de eletrodomésticos" src="../images/demo5.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Tarefas com vários comandos" src="../images/demo11.png" /></picture>
|
<img alt="Tarefas com múltiplos comandos" src="docs/images/demo11.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="Reproduzir música" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="Plugin de clima" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Ponto de acesso MCP" src="../images/demo13.png" /></picture>
|
<img alt="Interrupção em tempo real" src="docs/images/demo10.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Envio de comandos MQTT" src="../images/demo4.png" /></picture>
|
<img alt="Fotografar e identificar objetos" src="docs/images/demo12.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Reconhecimento de impressão vocal" src="../images/demo14.png" /></picture>
|
<img alt="Timbre de voz personalizado" src="docs/images/demo2.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Tom de voz personalizado" src="../images/demo2.png" /></picture>
|
<img alt="Comunicação em cantonês" src="docs/images/demo3.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Conversa em cantonês" src="../images/demo3.png" /></picture>
|
<img alt="Transmissão de notícias" src="docs/images/demo0.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -161,17 +175,17 @@ Quer ver os efeitos de uso? Clique nos vídeos abaixo 🎥
|
||||||
|
|
||||||
## Documentação de Implantação
|
## Documentação de Implantação
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Este projeto oferece dois métodos de implantação. Por favor, escolha de acordo com suas necessidades específicas:
|
Este projeto oferece dois métodos de implantação. Por favor, escolha de acordo com suas necessidades específicas:
|
||||||
|
|
||||||
#### 🚀 Seleção do Método de Implantação
|
#### 🚀 Seleção do Método de Implantação
|
||||||
| Método de Implantação | Funcionalidades | Cenários Aplicáveis | Documentação de Implantação | Requisitos de Configuração | Tutoriais em Vídeo |
|
| Método de Implantação | Funcionalidades | Cenários Aplicáveis | Documentação de Implantação | Requisitos de Configuração | Tutoriais em Vídeo |
|
||||||
|---------|------|---------|---------|---------|---------|
|
|---------|------|---------|---------|---------|---------|
|
||||||
| **Instalação Simplificada** | Diálogo inteligente, gerenciamento de agente único | Ambientes de baixa configuração, dados armazenados em arquivos de configuração, sem necessidade de banco de dados | [①Versão Docker](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Implantação via Código-Fonte](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| `FunASR` local exige mais memória; usar apenas APIs mantém o consumo de recursos baixo | - |
|
| **Instalação Simplificada** | Diálogo inteligente, gerenciamento de agente único | Ambientes de baixa configuração, dados armazenados em arquivos de configuração, sem necessidade de banco de dados | [①Versão Docker](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Implantação via Código-Fonte](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 núcleos 4GB se usar `FunASR`, 2 núcleos 2GB se todas APIs | - |
|
||||||
| **Instalação de Módulo Completo** | Diálogo inteligente, gerenciamento multiusuário, gerenciamento de múltiplos agentes, operação de interface do console inteligente | Experiência com funcionalidade completa, dados armazenados em banco de dados |[①Versão Docker](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Implantação via Código-Fonte](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Tutorial de Atualização Automática via Código-Fonte](../dev-ops-integration.md) | `FunASR` local exige mais memória e recursos de banco de dados; usar apenas APIs mantém o consumo de recursos baixo| [Tutorial em Vídeo de Inicialização via Código-Fonte Local](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
| **Instalação de Módulo Completo** | Diálogo inteligente, gerenciamento multiusuário, gerenciamento de múltiplos agentes, operação de interface do console inteligente | Experiência com funcionalidade completa, dados armazenados em banco de dados |[①Versão Docker](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Implantação via Código-Fonte](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Tutorial de Atualização Automática via Código-Fonte](./docs/dev-ops-integration.md) | 4 núcleos 8GB se usar `FunASR`, 2 núcleos 4GB se todas APIs| [Tutorial em Vídeo de Inicialização via Código-Fonte Local](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
Perguntas frequentes e tutoriais relacionados podem ser consultados [neste link](../FAQ.md)
|
Perguntas frequentes e tutoriais relacionados podem ser consultados [neste link](./docs/FAQ.md)
|
||||||
|
|
||||||
> 💡 Nota: Abaixo está uma plataforma de teste implantada com o código mais recente. Você pode gravar e testar se necessário. Usuários simultâneos: 6, os dados serão limpos diariamente.
|
> 💡 Nota: Abaixo está uma plataforma de teste implantada com o código mais recente. Você pode gravar e testar se necessário. Usuários simultâneos: 6, os dados serão limpos diariamente.
|
||||||
|
|
||||||
|
|
@ -210,15 +224,15 @@ Este projeto fornece as seguintes ferramentas de teste para ajudá-lo a verifica
|
||||||
|
|
||||||
| Nome da Ferramenta | Localização | Método de Uso | Descrição da Função |
|
| Nome da Ferramenta | Localização | Método de Uso | Descrição da Função |
|
||||||
|:---:|:---|:---:|:---:|
|
|:---:|:---|:---:|:---:|
|
||||||
| Ferramenta de Teste de Interação por Áudio | main》digital-human》index.html | Em `main/digital-human`, instale as dependências como indica o README, depois execute `python start.py` e abra `http://127.0.0.1:8006/index.html` | Testa as funções de reprodução e recepção de áudio, verifica se o processamento de áudio no lado Python está normal |
|
| Ferramenta de Teste de Interação por Áudio | main》xiaozhi-server》test》test_page.html | Abrir diretamente com Google Chrome | Testa as funções de reprodução e recepção de áudio, verifica se o processamento de áudio no lado Python está normal |
|
||||||
| Ferramenta de Teste de Resposta de Modelo | main》xiaozhi-server》performance_tester.py | Execute `python performance_tester.py` | Testa a velocidade de resposta de módulos principais como ASR(reconhecimento de fala), LLM(modelo de linguagem), VLLM(modelo de visão), TTS(síntese de voz) |
|
| Ferramenta de Teste de Resposta de Modelo | main》xiaozhi-server》performance_tester.py | Execute `python performance_tester.py` | Testa a velocidade de resposta dos três módulos principais: ASR(reconhecimento de fala), LLM(modelo de linguagem), VLLM(modelo de visão), TTS(síntese de voz) |
|
||||||
|
|
||||||
> 💡 Nota: Ao testar a velocidade dos modelos, apenas os modelos com chaves configuradas serão testados.
|
> 💡 Nota: Ao testar a velocidade dos modelos, apenas os modelos com chaves configuradas serão testados.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Lista de Funcionalidades ✨
|
## Lista de Funcionalidades ✨
|
||||||
### Implementado ✅
|
### Implementado ✅
|
||||||

|

|
||||||
| Módulo de Funcionalidade | Descrição |
|
| Módulo de Funcionalidade | Descrição |
|
||||||
|:---:|:---|
|
|:---:|:---|
|
||||||
| Arquitetura Principal | Baseado em [gateway MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), servidores WebSocket e HTTP, fornece sistema completo de gerenciamento de console e autenticação |
|
| Arquitetura Principal | Baseado em [gateway MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), servidores WebSocket e HTTP, fornece sistema completo de gerenciamento de console e autenticação |
|
||||||
|
|
@ -226,21 +240,21 @@ Este projeto fornece as seguintes ferramentas de teste para ajudá-lo a verifica
|
||||||
| Reconhecimento de Impressão Vocal | Suporta registro, gerenciamento e reconhecimento de impressão vocal de múltiplos usuários, processa em paralelo com o ASR, reconhecimento de identidade do falante em tempo real e repassa ao LLM para respostas personalizadas |
|
| Reconhecimento de Impressão Vocal | Suporta registro, gerenciamento e reconhecimento de impressão vocal de múltiplos usuários, processa em paralelo com o ASR, reconhecimento de identidade do falante em tempo real e repassa ao LLM para respostas personalizadas |
|
||||||
| Diálogo Inteligente | Suporta múltiplos LLM (modelos de linguagem de grande porte), implementa diálogo inteligente |
|
| Diálogo Inteligente | Suporta múltiplos LLM (modelos de linguagem de grande porte), implementa diálogo inteligente |
|
||||||
| Percepção Visual | Suporta múltiplos VLLM (modelos de visão de grande porte), implementa interação multimodal |
|
| Percepção Visual | Suporta múltiplos VLLM (modelos de visão de grande porte), implementa interação multimodal |
|
||||||
| Reconhecimento de Intenção | Suporta reconhecimento de intenção por LLM externo e conectável, chamada de função autônoma do modelo de linguagem, fornece mecanismo de processamento de intenção baseado em plugins |
|
| Reconhecimento de Intenção | Suporta reconhecimento de intenção por LLM, Function Call (chamada de função), fornece mecanismo de processamento de intenção baseado em plugins |
|
||||||
| Sistema de Memória | Suporta memória local de curto prazo, memória via interface mem0ai, memória inteligente PowerMem, com funcionalidade de resumo de memória |
|
| Sistema de Memória | Suporta memória local de curto prazo, memória via interface mem0ai, memória inteligente PowerMem, com funcionalidade de resumo de memória |
|
||||||
| Base de Conhecimento | Suporta base de conhecimento RAGFlow, permitindo que o LLM julgue se deve acionar a base de conhecimento após receber a pergunta do usuário, e então responda à pergunta |
|
| Base de Conhecimento | Suporta base de conhecimento RAGFlow, permitindo que o LLM julgue se deve acionar a base de conhecimento após receber a pergunta do usuário, e então responda à pergunta |
|
||||||
| Chamada de Ferramentas | Suporta protocolo IOT do cliente, protocolo MCP do cliente, protocolo MCP do servidor, protocolo de ponto de acesso MCP, funções de ferramentas personalizadas |
|
| Chamada de Ferramentas | Suporta protocolo IOT do cliente, protocolo MCP do cliente, protocolo MCP do servidor, protocolo de endpoint MCP, funções de ferramentas personalizadas |
|
||||||
| Envio de Comandos | Suporta envio de comandos MCP para dispositivos ESP32 via protocolo MQTT a partir do Console Inteligente |
|
| Envio de Comandos | Suporta envio de comandos MCP para dispositivos ESP32 via protocolo MQTT a partir do Console Inteligente |
|
||||||
| Backend de Gerenciamento | Fornece interface de gerenciamento Web, suporta gerenciamento de usuários, configuração do sistema e gerenciamento de dispositivos; Suporta exibição em Chinês Simplificado, Chinês Tradicional, Inglês, Alemão, Vietnamita e Português do Brasil |
|
| Backend de Gerenciamento | Fornece interface de gerenciamento Web, suporta gerenciamento de usuários, configuração do sistema e gerenciamento de dispositivos; Suporta exibição em Chinês Simplificado, Chinês Tradicional e Inglês |
|
||||||
| Ferramentas de Teste | Fornece ferramentas de teste de desempenho de resposta de modelo e ferramentas de teste de interação por áudio |
|
| Ferramentas de Teste | Fornece ferramentas de teste de desempenho, ferramentas de teste de modelo de visão e ferramentas de teste de interação por áudio |
|
||||||
| Suporte à Implantação | Suporta implantação via Docker e implantação local, fornece gerenciamento completo de arquivos de configuração |
|
| Suporte à Implantação | Suporta implantação via Docker e implantação local, fornece gerenciamento completo de arquivos de configuração |
|
||||||
| Sistema de Plugins | Suporta extensões de plugins funcionais e desenvolvimento de plugins personalizados; novos arquivos de plugin são carregados na próxima conexão do dispositivo e alterações em plugins já carregados exigem reiniciar o serviço |
|
| Sistema de Plugins | Suporta extensões de plugins funcionais, desenvolvimento de plugins personalizados e carregamento dinâmico de plugins |
|
||||||
|
|
||||||
### Em Desenvolvimento 🚧
|
### Em Desenvolvimento 🚧
|
||||||
|
|
||||||
Para conhecer o progresso específico do plano de desenvolvimento, [clique aqui](https://github.com/users/xinnan-tech/projects/3). Perguntas frequentes e tutoriais relacionados podem ser consultados [neste link](../FAQ.md)
|
Para conhecer o progresso específico do plano de desenvolvimento, [clique aqui](https://github.com/users/xinnan-tech/projects/3). Perguntas frequentes e tutoriais relacionados podem ser consultados [neste link](./docs/FAQ.md)
|
||||||
|
|
||||||
Se você é um desenvolvedor de software, aqui está uma [Carta Aberta aos Desenvolvedores](../contributor_open_letter.md). Seja bem-vindo a participar!
|
Se você é um desenvolvedor de software, aqui está uma [Carta Aberta aos Desenvolvedores](docs/contributor_open_letter.md). Seja bem-vindo a participar!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -254,7 +268,7 @@ Xiaozhi é um ecossistema. Ao utilizar este produto, você também pode conferir
|
||||||
|
|
||||||
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Chamadas via interface OpenAI | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK, LM Studio | Zhipu, Gemini |
|
| Chamadas via interface OpenAI | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK | Zhipu, Gemini |
|
||||||
| Chamadas via interface Ollama | Ollama | - |
|
| Chamadas via interface Ollama | Ollama | - |
|
||||||
| Chamadas via interface Dify | Dify | - |
|
| Chamadas via interface Dify | Dify | - |
|
||||||
| Chamadas via interface FastGPT | FastGPT | - |
|
| Chamadas via interface FastGPT | FastGPT | - |
|
||||||
|
|
@ -262,7 +276,7 @@ Xiaozhi é um ecossistema. Ao utilizar este produto, você também pode conferir
|
||||||
| Chamadas via interface Xinference | Xinference | - |
|
| Chamadas via interface Xinference | Xinference | - |
|
||||||
| Chamadas via interface HomeAssistant | HomeAssistant | - |
|
| Chamadas via interface HomeAssistant | HomeAssistant | - |
|
||||||
|
|
||||||
Na verdade, qualquer LLM que suporte chamadas via interface OpenAI pode ser integrado e utilizado.
|
Na verdade, qualquer LLM que suporte chamadas via interface openai pode ser integrado e utilizado.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -270,7 +284,7 @@ Na verdade, qualquer LLM que suporte chamadas via interface OpenAI pode ser inte
|
||||||
|
|
||||||
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Chamadas via interface OpenAI | Alibaba Bailian, Zhipu ChatGLMVLLM, iFLYTEK | Zhipu ChatGLMVLLM |
|
| Chamadas via interface OpenAI | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
|
||||||
|
|
||||||
Na verdade, qualquer VLLM que suporte chamadas via interface OpenAI pode ser integrado e utilizado.
|
Na verdade, qualquer VLLM que suporte chamadas via interface OpenAI pode ser integrado e utilizado.
|
||||||
|
|
||||||
|
|
@ -280,8 +294,8 @@ Na verdade, qualquer VLLM que suporte chamadas via interface OpenAI pode ser int
|
||||||
|
|
||||||
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Chamadas via interface | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud e Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, CustomTTS, OpenAITTS, MinimaxTTS | EdgeTTS, CosyVoiceSiliconflow(parcial) |
|
| Chamadas via interface | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud e Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi Streaming TTS, MinimaxTTS | Lingxi Streaming TTS, EdgeTTS, CosyVoiceSiliconflow(parcial) |
|
||||||
| Serviços locais | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, IndexStreamTTS, PaddleSpeechTTS | IndexStreamTTS, PaddleSpeechTTS, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
| Serviços locais | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -297,8 +311,8 @@ Na verdade, qualquer VLLM que suporte chamadas via interface OpenAI pode ser int
|
||||||
|
|
||||||
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Uso local | FunASR, SherpaASR, SherpaParaformerASR, VoskASR | FunASR, SherpaASR, SherpaParaformerASR, VoskASR |
|
| Uso local | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
| Chamadas via interface | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud e Bailian, Baidu Cloud, OpenAI ASR, GroqASR, Qwen3ASRFlash | FunASRServer |
|
| Chamadas via interface | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -306,9 +320,7 @@ Na verdade, qualquer VLLM que suporte chamadas via interface OpenAI pode ser int
|
||||||
|
|
||||||
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
| Método de Uso | Plataformas Suportadas | Plataformas Gratuitas |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Chamadas via interface | Serviço de voiceprint (voiceprint-api) | - |
|
| Uso local | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
O reconhecimento de impressão vocal exige um serviço [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) implantado separadamente (baseado em 3D-Speaker) e MySQL. Veja o [guia de integração de voiceprint](../voiceprint-integration.md).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -317,10 +329,9 @@ O reconhecimento de impressão vocal exige um serviço [voiceprint-api](https://
|
||||||
| Tipo | Nome da Plataforma | Método de Uso | Modelo de Preço | Observações |
|
| Tipo | Nome da Plataforma | Método de Uso | Modelo de Preço | Observações |
|
||||||
|:------:|:---------------:|:----:|:---------:|:--:|
|
|:------:|:---------------:|:----:|:---------:|:--:|
|
||||||
| Memória | mem0ai | Chamadas via interface | Cota de 1000 vezes/mês | |
|
| Memória | mem0ai | Chamadas via interface | Cota de 1000 vezes/mês | |
|
||||||
| Memória | [powermem](../powermem-integration.md) | Resumo local | Depende do LLM e BD | OceanBase de código aberto, suporta busca inteligente |
|
| Memória | [powermem](./docs/powermem-integration.md) | Resumo local | Depende do LLM e BD | OceanBase de código aberto, suporta busca inteligente |
|
||||||
| Memória | mem_local_short | Resumo local | Gratuito | |
|
| Memória | mem_local_short | Resumo local | Gratuito | |
|
||||||
| Memória | nomem | Modo sem memória | Gratuito | |
|
| Memória | nomem | Modo sem memória | Gratuito | |
|
||||||
| Memória | mem_report_only | Apenas relatório | Gratuito | Apenas reporta o histórico de chat, sem resumo de memória |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -346,19 +357,20 @@ O reconhecimento de impressão vocal exige um serviço [voiceprint-api](https://
|
||||||
|
|
||||||
| Logo | Projeto/Empresa | Descrição |
|
| Logo | Projeto/Empresa | Descrição |
|
||||||
|:---:|:---:|:---|
|
|:---:|:---:|:---|
|
||||||
| <img src="../images/logo_bailing.png" width="160"> | [Robô de Diálogo por Voz Bailing](https://github.com/wwbin2017/bailing) | Este projeto foi inspirado pelo [Robô de Diálogo por Voz Bailing](https://github.com/wwbin2017/bailing) e implementado com base nele |
|
| <img src="./docs/images/logo_bailing.png" width="160"> | [Robô de Diálogo por Voz Bailing](https://github.com/wwbin2017/bailing) | Este projeto foi inspirado pelo [Robô de Diálogo por Voz Bailing](https://github.com/wwbin2017/bailing) e implementado com base nele |
|
||||||
| <img src="../images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Agradecimentos à [Tenclass](https://www.tenclass.com/) por formular protocolos de comunicação padrão, soluções de compatibilidade multidispositivo e demonstrações práticas de cenários de alta concorrência para o ecossistema Xiaozhi; fornecendo suporte completo de documentação técnica para este projeto |
|
| <img src="./docs/images/logo_tenclass.png" width="160"> | [Tenclass](https://www.tenclass.com/) | Agradecimentos à [Tenclass](https://www.tenclass.com/) por formular protocolos de comunicação padrão, soluções de compatibilidade multidispositivo e demonstrações práticas de cenários de alta concorrência para o ecossistema Xiaozhi; fornecendo suporte completo de documentação técnica para este projeto |
|
||||||
| <img src="../images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology (玄凤科技)](https://github.com/Eric0308) | Agradecimentos à [Xuanfeng Technology](https://github.com/Eric0308) por contribuir com o framework de chamada de função, protocolo de comunicação MCP e implementação do mecanismo de chamada baseado em plugins. Através de um sistema padronizado de agendamento de instruções e capacidades de expansão dinâmica, melhora significativamente a eficiência de interação e extensibilidade funcional dos dispositivos de frontend (IoT) |
|
| <img src="./docs/images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology (玄凤科技)](https://github.com/Eric0308) | Agradecimentos à [Xuanfeng Technology](https://github.com/Eric0308) por contribuir com o framework de chamada de função, protocolo de comunicação MCP e implementação do mecanismo de chamada baseado em plugins. Através de um sistema padronizado de agendamento de instruções e capacidades de expansão dinâmica, melhora significativamente a eficiência de interação e extensibilidade funcional dos dispositivos de frontend (IoT) |
|
||||||
| <img src="../images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Agradecimentos a [huangjunsen](https://github.com/huangjunsen0406) por contribuir com o módulo `Console de Controle Inteligente Mobile`, que permite controle eficiente e interação em tempo real em dispositivos móveis, melhorando significativamente a conveniência operacional e a eficiência de gerenciamento do sistema em cenários móveis. |
|
| <img src="./docs/images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Agradecimentos a [huangjunsen](https://github.com/huangjunsen0406) por contribuir com o módulo `Console de Controle Inteligente Mobile`, que permite controle eficiente e interação em tempo real em dispositivos móveis, melhorando significativamente a conveniência operacional e a eficiência de gerenciamento do sistema em cenários móveis. |
|
||||||
| <img src="../images/logo_huiyuan.png" width="160"> | [Huiyuan Design (汇远设计)](http://ui.kwd988.net/) | Agradecimentos à [Huiyuan Design](http://ui.kwd988.net/) por fornecer soluções visuais profissionais para este projeto, utilizando sua experiência prática de design atendendo mais de mil empresas para potencializar a experiência do usuário deste produto |
|
| <img src="./docs/images/logo_huiyuan.png" width="160"> | [Huiyuan Design (汇远设计)](http://ui.kwd988.net/) | Agradecimentos à [Huiyuan Design](http://ui.kwd988.net/) por fornecer soluções visuais profissionais para este projeto, utilizando sua experiência prática de design atendendo mais de mil empresas para potencializar a experiência do usuário deste produto |
|
||||||
| <img src="../images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology (西安勤人信息科技)](https://www.029app.com/) | Agradecimentos à [Xi'an Qinren Information Technology](https://www.029app.com/) por aprofundar o sistema visual deste projeto, garantindo consistência e extensibilidade do estilo de design geral em aplicações de múltiplos cenários |
|
| <img src="./docs/images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology (西安勤人信息科技)](https://www.029app.com/) | Agradecimentos à [Xi'an Qinren Information Technology](https://www.029app.com/) por aprofundar o sistema visual deste projeto, garantindo consistência e extensibilidade do estilo de design geral em aplicações de múltiplos cenários |
|
||||||
| <img src="../images/logo_contributors.png" width="160"> | [Contribuidores de Código](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Agradecimentos a [todos os contribuidores de código](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), seus esforços tornaram o projeto mais robusto e poderoso. |
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [Contribuidores de Código](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Agradecimentos a [todos os contribuidores de código](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), seus esforços tornaram o projeto mais robusto e poderoso. |
|
||||||
|
|
||||||
|
|
||||||
<a href="https://www.star-history.com/?repos=xinnan-tech%2Fxiaozhi-esp32-server&type=date&legend=top-left">
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&theme=dark&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
||||||
|
|
||||||
<h1 align="center">Dịch vụ Backend Xiaozhi xiaozhi-esp32-server</h1>
|
<h1 align="center">Dịch vụ Backend Xiaozhi xiaozhi-esp32-server</h1>
|
||||||
|
|
||||||
|
|
@ -6,23 +6,22 @@
|
||||||
Dự án này dựa trên lý thuyết và công nghệ trí tuệ cộng sinh người-máy để phát triển hệ thống phần mềm và phần cứng thiết bị đầu cuối thông minh<br/>Cung cấp dịch vụ backend cho dự án phần cứng thông minh mã nguồn mở
|
Dự án này dựa trên lý thuyết và công nghệ trí tuệ cộng sinh người-máy để phát triển hệ thống phần mềm và phần cứng thiết bị đầu cuối thông minh<br/>Cung cấp dịch vụ backend cho dự án phần cứng thông minh mã nguồn mở
|
||||||
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
||||||
Được triển khai bằng Python, Java, Vue theo <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">giao thức truyền thông Xiaozhi</a><br/>
|
Được triển khai bằng Python, Java, Vue theo <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">giao thức truyền thông Xiaozhi</a><br/>
|
||||||
Hỗ trợ giao thức MQTT+UDP, giao thức Websocket, điểm truy cập MCP, nhận dạng vân giọng và kho tri thức
|
Hỗ trợ giao thức MQTT+UDP, giao thức Websocket, điểm truy cập MCP, nhận dạng giọng nói và kho tri thức
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../FAQ.md">Câu hỏi thường gặp</a>
|
<a href="./docs/FAQ.md">Câu hỏi thường gặp</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Báo cáo vấn đề</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Báo cáo vấn đề</a>
|
||||||
· <a href="../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Tài liệu triển khai</a>
|
· <a href="./README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Tài liệu triển khai</a>
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Nhật ký cập nhật</a>
|
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Nhật ký cập nhật</a>
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<a href="../../README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
<a href="./README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
||||||
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
||||||
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DBEDFA"></a>
|
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DBEDFA"></a>
|
||||||
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
||||||
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
||||||
<a href="./README_es.md"><img alt="Español" src="https://img.shields.io/badge/Español-DFE0E5"></a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -39,7 +38,7 @@ Spearheaded by Professor Siyuan Liu's Team (South China University of Technology
|
||||||
</br>
|
</br>
|
||||||
Được dẫn dắt bởi nhóm Giáo sư Lưu Tư Nguyên (Đại học Bách khoa Nam Trung Quốc)
|
Được dẫn dắt bởi nhóm Giáo sư Lưu Tư Nguyên (Đại học Bách khoa Nam Trung Quốc)
|
||||||
</br>
|
</br>
|
||||||
<img src="../images/hnlg.jpg" alt="Đại học Bách khoa Nam Trung Quốc" width="50%">
|
<img src="./docs/images/hnlg.jpg" alt="华南理工大学" width="50%">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -53,98 +52,113 @@ Muốn xem hiệu quả sử dụng? Hãy xem video 🎥
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Cảm giác tốc độ phản hồi" src="../images/demo9.png" /></picture>
|
<img alt="响应速度感受" src="docs/images/demo9.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Bí quyết tối ưu tốc độ" src="../images/demo6.png" /></picture>
|
<img alt="速度优化秘诀" src="docs/images/demo6.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1WEcxzFEAT" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Người ảo số Xiaozhi có đánh thức bằng giọng nói" src="../images/demo8.png" /></picture>
|
<img alt="复杂医疗场景" src="docs/images/demo1.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CKVz6UEuB" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Gọi giữa các thiết bị" src="../images/demo0.png" /></picture>
|
<img alt="MQTT指令下发" src="docs/images/demo4.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Tình huống y tế phức tạp" src="../images/demo1.png" /></picture>
|
<img alt="声纹识别" src="docs/images/demo14.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Phát nhạc, tra cứu thời tiết và đọc tin tức" src="../images/demo7.png" /></picture>
|
<img alt="控制家电开关" src="docs/images/demo5.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Ngắt giữa chừng theo thời gian thực" src="../images/demo10.png" /></picture>
|
<img alt="MCP接入点" src="docs/images/demo13.png" />
|
||||||
</a>
|
</picture>
|
||||||
</td>
|
</a>
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Nhận dạng vật thể qua ảnh chụp" src="../images/demo12.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Bật tắt thiết bị gia dụng" src="../images/demo5.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Nhiệm vụ nhiều lệnh" src="../images/demo11.png" /></picture>
|
<img alt="多指令任务" src="docs/images/demo11.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="播放音乐" src="docs/images/demo7.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<a href="https://www.bilibili.com/video/BV1Z8XuYZEAS" target="_blank">
|
||||||
|
<picture>
|
||||||
|
<img alt="天气插件" src="docs/images/demo8.png" />
|
||||||
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Điểm truy cập MCP" src="../images/demo13.png" /></picture>
|
<img alt="实时打断" src="docs/images/demo10.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Gửi lệnh MQTT" src="../images/demo4.png" /></picture>
|
<img alt="拍照识物品" src="docs/images/demo12.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Nhận dạng vân giọng" src="../images/demo14.png" /></picture>
|
<img alt="自定义音色" src="docs/images/demo2.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Giọng nói tùy chỉnh" src="../images/demo2.png" /></picture>
|
<img alt="使用粤语交流" src="docs/images/demo3.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
<a href="https://www.bilibili.com/video/BV17LXWYvENb" target="_blank">
|
||||||
<picture>
|
<picture>
|
||||||
<img alt="Trò chuyện bằng tiếng Quảng Đông" src="../images/demo3.png" /></picture>
|
<img alt="播报新闻" src="docs/images/demo0.png" />
|
||||||
</a>
|
</picture>
|
||||||
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
@ -162,19 +176,19 @@ Khuyến nghị người dùng ưu tiên lựa chọn nhà cung cấp dịch v
|
||||||
|
|
||||||
## Tài liệu triển khai
|
## Tài liệu triển khai
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
Dự án này cung cấp hai phương pháp triển khai, vui lòng chọn theo nhu cầu cụ thể của bạn:
|
Dự án này cung cấp hai phương pháp triển khai, vui lòng chọn theo nhu cầu cụ thể của bạn:
|
||||||
|
|
||||||
#### 🚀 Lựa chọn phương pháp triển khai
|
#### 🚀 Lựa chọn phương pháp triển khai
|
||||||
| Phương pháp triển khai | Đặc điểm | Tình huống áp dụng | Tài liệu triển khai | Yêu cầu cấu hình | Video hướng dẫn |
|
| Phương pháp triển khai | Đặc điểm | Tình huống áp dụng | Tài liệu triển khai | Yêu cầu cấu hình | Video hướng dẫn |
|
||||||
|---------|------|---------|---------|---------|---------|
|
|---------|------|---------|---------|---------|---------|
|
||||||
| **Cài đặt tối giản** | Đối thoại thông minh, quản lý đơn tác nhân | Môi trường cấu hình thấp, dữ liệu lưu trong tệp cấu hình, không cần cơ sở dữ liệu | [①Phiên bản Docker](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Triển khai mã nguồn](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| `FunASR` cục bộ cần nhiều bộ nhớ; dùng toàn API thì mức dùng tài nguyên thấp | - |
|
| **Cài đặt tối giản** | Đối thoại thông minh, quản lý đơn tác nhân | Môi trường cấu hình thấp, dữ liệu lưu trong tệp cấu hình, không cần cơ sở dữ liệu | [①Phiên bản Docker](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Triển khai mã nguồn](./docs/Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| 2 nhân 4GB nếu dùng `FunASR`, 2 nhân 2GB nếu toàn API | - |
|
||||||
| **Cài đặt toàn bộ module** | Đối thoại thông minh, quản lý đa người dùng, quản lý đa tác nhân, thao tác qua bảng điều khiển thông minh | Trải nghiệm đầy đủ tính năng, dữ liệu lưu trong cơ sở dữ liệu |[①Phiên bản Docker](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Triển khai mã nguồn](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Hướng dẫn tự động cập nhật triển khai mã nguồn](../dev-ops-integration.md) | `FunASR` cục bộ cần nhiều bộ nhớ, thêm tài nguyên cơ sở dữ liệu; dùng toàn API thì mức dùng tài nguyên thấp| [Video hướng dẫn khởi động mã nguồn cục bộ](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
| **Cài đặt toàn bộ module** | Đối thoại thông minh, quản lý đa người dùng, quản lý đa tác nhân, bảng điều khiển thông minh | Trải nghiệm đầy đủ tính năng, dữ liệu lưu trong cơ sở dữ liệu |[①Phiên bản Docker](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Triển khai mã nguồn](./docs/Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Hướng dẫn tự động cập nhật triển khai mã nguồn](./docs/dev-ops-integration.md) | 4 nhân 8GB nếu dùng `FunASR`, 2 nhân 4GB nếu toàn API| [Video hướng dẫn khởi động mã nguồn cục bộ](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
||||||
|
|
||||||
Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](../FAQ.md)
|
Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](./docs/FAQ.md)
|
||||||
|
|
||||||
> 💡 Gợi ý: Dưới đây là nền tảng thử nghiệm được triển khai theo mã mới nhất, có thể flash để thử nghiệm nếu cần, đồng thời là 6, dữ liệu sẽ được xóa mỗi ngày.
|
> 💡 Gợi ý: Dưới đây là nền tảng thử nghiệm được triển khai theo mã mới nhất, có thể flash để thử nghiệm nếu cần, đồng thời là 6, dữ liệu sẽ được xóa mỗi ngày,
|
||||||
|
|
||||||
```
|
```
|
||||||
Địa chỉ bảng điều khiển thông minh: https://2662r3426b.vicp.fun
|
Địa chỉ bảng điều khiển thông minh: https://2662r3426b.vicp.fun
|
||||||
|
|
@ -193,7 +207,7 @@ Công cụ kiểm tra dịch vụ: https://2662r3426b.vicp.fun/test/
|
||||||
>
|
>
|
||||||
> 2. `Cấu hình streaming`: Phù hợp với demo, đào tạo, hơn 2 đồng thời, v.v., sử dụng công nghệ xử lý streaming, tốc độ phản hồi nhanh hơn, trải nghiệm tốt hơn.
|
> 2. `Cấu hình streaming`: Phù hợp với demo, đào tạo, hơn 2 đồng thời, v.v., sử dụng công nghệ xử lý streaming, tốc độ phản hồi nhanh hơn, trải nghiệm tốt hơn.
|
||||||
>
|
>
|
||||||
> Từ phiên bản `0.5.2`, dự án hỗ trợ cấu hình streaming, so với các phiên bản trước đó, tốc độ phản hồi cải thiện khoảng `2.5 giây`, cải thiện đáng kể trải nghiệm người dùng.
|
> Từ phiên bản `0.5.2`, dự án hỗ trợ cấu hình streaming, so với phiên bản đầu, tốc độ phản hồi cải thiện khoảng `2.5 giây`, cải thiện đáng kể trải nghiệm người dùng.
|
||||||
|
|
||||||
| Tên module | Cài đặt miễn phí cho người mới | Cấu hình streaming |
|
| Tên module | Cài đặt miễn phí cho người mới | Cấu hình streaming |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
|
|
@ -211,15 +225,15 @@ Dự án này cung cấp các công cụ kiểm tra sau để giúp bạn xác m
|
||||||
|
|
||||||
| Tên công cụ | Vị trí | Phương pháp sử dụng | Mô tả chức năng |
|
| Tên công cụ | Vị trí | Phương pháp sử dụng | Mô tả chức năng |
|
||||||
|:---:|:---|:---:|:---:|
|
|:---:|:---|:---:|:---:|
|
||||||
| Công cụ kiểm tra tương tác âm thanh | main》digital-human》index.html | Trong `main/digital-human`, cài đặt các phụ thuộc theo README, rồi chạy `python start.py` và mở `http://127.0.0.1:8006/index.html` | Kiểm tra chức năng phát và nhận âm thanh, xác minh xử lý âm thanh phía Python có bình thường không |
|
| Công cụ kiểm tra tương tác âm thanh | main》xiaozhi-server》test》test_page.html | Mở trực tiếp bằng trình duyệt Google Chrome | Kiểm tra chức năng phát và nhận âm thanh, xác minh xử lý âm thanh phía Python có bình thường không |
|
||||||
| Công cụ kiểm tra phản hồi mô hình | main》xiaozhi-server》performance_tester.py | Thực hiện `python performance_tester.py` | Kiểm tra tốc độ phản hồi của các module cốt lõi như ASR(Nhận dạng giọng nói), LLM(Mô hình lớn), VLLM(Mô hình thị giác), TTS(Tổng hợp giọng nói) |
|
| Công cụ kiểm tra phản hồi mô hình | main》xiaozhi-server》performance_tester.py | Thực hiện `python performance_tester.py` | Kiểm tra tốc độ phản hồi của ba module cốt lõi ASR(Nhận dạng giọng nói), LLM(Mô hình lớn), VLLM(Mô hình thị giác), TTS(Tổng hợp giọng nói) |
|
||||||
|
|
||||||
> 💡 Gợi ý: Khi kiểm tra tốc độ mô hình, chỉ kiểm tra các mô hình đã cấu hình khóa.
|
> 💡 Gợi ý: Khi kiểm tra tốc độ mô hình, chỉ kiểm tra các mô hình đã cấu hình khóa.
|
||||||
|
|
||||||
---
|
---
|
||||||
## Danh sách tính năng ✨
|
## Danh sách tính năng ✨
|
||||||
### Đã thực hiện ✅
|
### Đã thực hiện ✅
|
||||||

|

|
||||||
| Module chức năng | Mô tả |
|
| Module chức năng | Mô tả |
|
||||||
|:---:|:---|
|
|:---:|:---|
|
||||||
| Kiến trúc cốt lõi | Dựa trên [cổng MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket, máy chủ HTTP, cung cấp hệ thống quản lý bảng điều khiển và xác thực hoàn chỉnh |
|
| Kiến trúc cốt lõi | Dựa trên [cổng MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md), WebSocket, máy chủ HTTP, cung cấp hệ thống quản lý bảng điều khiển và xác thực hoàn chỉnh |
|
||||||
|
|
@ -232,16 +246,16 @@ Dự án này cung cấp các công cụ kiểm tra sau để giúp bạn xác m
|
||||||
| Kho tri thức | Hỗ trợ kho tri thức RAGFlow, cho phép mô hình lớn đánh giá cần gọi kho tri thức trước khi trả lời |
|
| Kho tri thức | Hỗ trợ kho tri thức RAGFlow, cho phép mô hình lớn đánh giá cần gọi kho tri thức trước khi trả lời |
|
||||||
| Gọi công cụ | Hỗ trợ giao thức IOT phía client, giao thức MCP phía client, giao thức MCP phía server, giao thức điểm truy cập MCP, hàm công cụ tùy chỉnh |
|
| Gọi công cụ | Hỗ trợ giao thức IOT phía client, giao thức MCP phía client, giao thức MCP phía server, giao thức điểm truy cập MCP, hàm công cụ tùy chỉnh |
|
||||||
| Gửi lệnh | Dựa vào giao thức MQTT, hỗ trợ gửi lệnh MCP từ bảng điều khiển thông minh xuống thiết bị ESP32 |
|
| Gửi lệnh | Dựa vào giao thức MQTT, hỗ trợ gửi lệnh MCP từ bảng điều khiển thông minh xuống thiết bị ESP32 |
|
||||||
| Backend quản lý | Cung cấp giao diện quản lý Web, hỗ trợ quản lý người dùng, cấu hình hệ thống và quản lý thiết bị; giao diện hỗ trợ hiển thị tiếng Trung giản thể, tiếng Trung phồn thể, tiếng Anh, tiếng Đức, tiếng Việt và tiếng Bồ Đào Nha Brazil |
|
| Backend quản lý | Cung cấp giao diện quản lý Web, hỗ trợ quản lý người dùng, cấu hình hệ thống và quản lý thiết bị; giao diện hỗ trợ hiển thị tiếng Trung giản thể, tiếng Trung phồn thể, tiếng Anh |
|
||||||
| Công cụ kiểm tra | Cung cấp công cụ kiểm tra hiệu suất phản hồi mô hình và công cụ kiểm tra tương tác âm thanh |
|
| Công cụ kiểm tra | Cung cấp công cụ kiểm tra hiệu suất, công cụ kiểm tra mô hình thị giác và công cụ kiểm tra tương tác âm thanh |
|
||||||
| Hỗ trợ triển khai | Hỗ trợ triển khai Docker và triển khai cục bộ, cung cấp quản lý tệp cấu hình hoàn chỉnh |
|
| Hỗ trợ triển khai | Hỗ trợ triển khai Docker và triển khai cục bộ, cung cấp quản lý tệp cấu hình hoàn chỉnh |
|
||||||
| Hệ thống plugin | Hỗ trợ mở rộng plugin chức năng và phát triển plugin tùy chỉnh; file plugin mới được tải ở lần kết nối thiết bị tiếp theo, thay đổi mã của plugin đã tải cần khởi động lại dịch vụ |
|
| Hệ thống plugin | Hỗ trợ mở rộng plugin chức năng, phát triển plugin tùy chỉnh và hot loading plugin |
|
||||||
|
|
||||||
### Đang phát triển 🚧
|
### Đang phát triển 🚧
|
||||||
|
|
||||||
Muốn hiểu tiến độ kế hoạch phát triển cụ thể, [vui lòng nhấp vào đây](https://github.com/users/xinnan-tech/projects/3). Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](../FAQ.md)
|
Muốn hiểu tiến độ kế hoạch phát triển cụ thể, [vui lòng nhấp vào đây](https://github.com/users/xinnan-tech/projects/3). Câu hỏi thường gặp và hướng dẫn liên quan, vui lòng tham khảo [liên kết này](./docs/FAQ.md)
|
||||||
|
|
||||||
Nếu bạn là một nhà phát triển phần mềm, đây có một [Lá thư mở gửi các nhà phát triển](../contributor_open_letter.md), chào mừng tham gia!
|
Nếu bạn là một nhà phát triển phần mềm, đây có một [Lá thư mở gửi các nhà phát triển](docs/contributor_open_letter.md), chào mừng tham gia!
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -255,7 +269,7 @@ Xiaozhi là một hệ sinh thái, khi bạn sử dụng sản phẩm này, bạ
|
||||||
|
|
||||||
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Gọi giao diện OpenAI | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK, LM Studio | Zhipu, Gemini |
|
| Gọi giao diện openai | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFlytek | Zhipu, Gemini |
|
||||||
| Gọi giao diện ollama | Ollama | - |
|
| Gọi giao diện ollama | Ollama | - |
|
||||||
| Gọi giao diện dify | Dify | - |
|
| Gọi giao diện dify | Dify | - |
|
||||||
| Gọi giao diện fastgpt | Fastgpt | - |
|
| Gọi giao diện fastgpt | Fastgpt | - |
|
||||||
|
|
@ -263,7 +277,7 @@ Xiaozhi là một hệ sinh thái, khi bạn sử dụng sản phẩm này, bạ
|
||||||
| Gọi giao diện xinference | Xinference | - |
|
| Gọi giao diện xinference | Xinference | - |
|
||||||
| Gọi giao diện homeassistant | HomeAssistant | - |
|
| Gọi giao diện homeassistant | HomeAssistant | - |
|
||||||
|
|
||||||
Trên thực tế, bất kỳ LLM nào hỗ trợ gọi giao diện OpenAI đều có thể truy cập sử dụng.
|
Trên thực tế, bất kỳ LLM nào hỗ trợ gọi giao diện openai đều có thể truy cập sử dụng.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -271,9 +285,9 @@ Trên thực tế, bất kỳ LLM nào hỗ trợ gọi giao diện OpenAI đề
|
||||||
|
|
||||||
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Gọi giao diện OpenAI | Alibaba Bailian, Zhipu ChatGLMVLLM, iFLYTEK | Zhipu ChatGLMVLLM |
|
| Gọi giao diện openai | Alibaba Bailian, Zhipu ChatGLMVLLM | Zhipu ChatGLMVLLM |
|
||||||
|
|
||||||
Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện OpenAI đều có thể truy cập sử dụng.
|
Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện openai đều có thể truy cập sử dụng.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -281,8 +295,8 @@ Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện OpenAI đ
|
||||||
|
|
||||||
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Gọi giao diện | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud và Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, CustomTTS, OpenAITTS, MinimaxTTS | EdgeTTS, CosyVoiceSiliconflow(một phần) |
|
| Gọi giao diện | EdgeTTS, iFlytek, Volcano Engine, Tencent Cloud, Alibaba Cloud và Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, GizwitsTTS, ACGNTTS, OpenAITTS, Lingxi streaming TTS, MinimaxTTS | Lingxi streaming TTS, EdgeTTS, CosyVoiceSiliconflow(một phần) |
|
||||||
| Dịch vụ cục bộ | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, IndexStreamTTS, PaddleSpeechTTS | IndexStreamTTS, PaddleSpeechTTS, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
| Dịch vụ cục bộ | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, Index-TTS, PaddleSpeech | Index-TTS, PaddleSpeech, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -298,8 +312,8 @@ Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện OpenAI đ
|
||||||
|
|
||||||
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Sử dụng cục bộ | FunASR, SherpaASR, SherpaParaformerASR, VoskASR | FunASR, SherpaASR, SherpaParaformerASR, VoskASR |
|
| Sử dụng cục bộ | FunASR, SherpaASR | FunASR, SherpaASR |
|
||||||
| Gọi giao diện | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud và Bailian, Baidu Cloud, OpenAI ASR, GroqASR, Qwen3ASRFlash | FunASRServer |
|
| Gọi giao diện | FunASRServer, Volcano Engine, iFlytek, Tencent Cloud, Alibaba Cloud, Baidu Cloud, OpenAI ASR | FunASRServer |
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -307,9 +321,7 @@ Trên thực tế, bất kỳ VLLM nào hỗ trợ gọi giao diện OpenAI đ
|
||||||
|
|
||||||
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
| Phương pháp sử dụng | Nền tảng hỗ trợ | Nền tảng miễn phí |
|
||||||
|:---:|:---:|:---:|
|
|:---:|:---:|:---:|
|
||||||
| Gọi giao diện | Dịch vụ nhận dạng vân giọng (voiceprint-api) | - |
|
| Sử dụng cục bộ | 3D-Speaker | 3D-Speaker |
|
||||||
|
|
||||||
Nhận dạng vân giọng cần dịch vụ [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) được triển khai riêng (dựa trên 3D-Speaker) và MySQL. Xem [hướng dẫn tích hợp voiceprint](../voiceprint-integration.md).
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -318,10 +330,9 @@ Nhận dạng vân giọng cần dịch vụ [voiceprint-api](https://github.com
|
||||||
| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
|
| Loại | Tên nền tảng | Phương pháp sử dụng | Mô hình thu phí | Ghi chú |
|
||||||
|:------:|:---------------:|:----:|:---------:|:--:|
|
|:------:|:---------------:|:----:|:---------:|:--:|
|
||||||
| Memory | mem0ai | Gọi giao diện | Hạn mức 1000 lần/tháng | |
|
| Memory | mem0ai | Gọi giao diện | Hạn mức 1000 lần/tháng | |
|
||||||
| Memory | [powermem](../powermem-integration.md) | Tóm tắt cục bộ | Phụ thuộc vào LLM và DB | OceanBase mã nguồn mở, hỗ trợ tìm kiếm thông minh |
|
| Memory | [powermem](./docs/powermem-integration.md) | Tóm tắt cục bộ | Phụ thuộc vào LLM và DB | OceanBase mã nguồn mở, hỗ trợ tìm kiếm thông minh |
|
||||||
| Memory | mem_local_short | Tóm tắt cục bộ | Miễn phí | |
|
| Memory | mem_local_short | Tóm tắt cục bộ | Miễn phí | |
|
||||||
| Memory | nomem | Chế độ không có bộ nhớ | Miễn phí | |
|
| Memory | nomem | Chế độ không có bộ nhớ | Miễn phí | |
|
||||||
| Memory | mem_report_only | Chỉ báo cáo | Miễn phí | Chỉ báo cáo lịch sử trò chuyện, không tóm tắt bộ nhớ |
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
@ -347,19 +358,20 @@ Nhận dạng vân giọng cần dịch vụ [voiceprint-api](https://github.com
|
||||||
|
|
||||||
| Logo | Dự án/Công ty | Mô tả |
|
| Logo | Dự án/Công ty | Mô tả |
|
||||||
|:---:|:---:|:---|
|
|:---:|:---:|:---|
|
||||||
| <img src="../images/logo_bailing.png" width="160"> | [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) | Dự án này được lấy cảm hứng từ [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) và được triển khai trên cơ sở đó |
|
| <img src="./docs/images/logo_bailing.png" width="160"> | [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) | Dự án này được lấy cảm hứng từ [Robot đối thoại giọng nói Bailing](https://github.com/wwbin2017/bailing) và được triển khai trên cơ sở đó |
|
||||||
| <img src="../images/logo_tenclass.png" width="160"> | [Shifang Ronghai](https://www.tenclass.com/) | Cảm ơn [Shifang Ronghai](https://www.tenclass.com/) đã xây dựng giao thức truyền thông tiêu chuẩn, phương án tương thích đa thiết bị và mô phạm thực hành tình huống đồng thời cao cho hệ sinh thái Xiaozhi; cung cấp tài liệu hỗ trợ kỹ thuật toàn diện cho dự án này |
|
| <img src="./docs/images/logo_tenclass.png" width="160"> | [Shifang Ronghai](https://www.tenclass.com/) | Cảm ơn [Shifang Ronghai](https://www.tenclass.com/) đã xây dựng giao thức truyền thông tiêu chuẩn, phương án tương thích đa thiết bị và mô phạm thực hành tình huống đồng thời cao cho hệ sinh thái Xiaozhi; cung cấp tài liệu hỗ trợ kỹ thuật toàn diện cho dự án này |
|
||||||
| <img src="../images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Cảm ơn [Xuanfeng Technology](https://github.com/Eric0308) đã đóng góp khung gọi hàm, giao thức truyền thông MCP và mã triển khai cơ chế gọi dạng plugin, thông qua hệ thống điều phối lệnh tiêu chuẩn hóa và khả năng mở rộng động, đã cải thiện đáng kể hiệu suất tương tác và khả năng mở rộng chức năng của thiết bị front-end(IoT) |
|
| <img src="./docs/images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology](https://github.com/Eric0308) | Cảm ơn [Xuanfeng Technology](https://github.com/Eric0308) đã đóng góp khung gọi hàm, giao thức truyền thông MCP và mã triển khai cơ chế gọi dạng plugin, thông qua hệ thống điều phối lệnh tiêu chuẩn hóa và khả năng mở rộng động, đã cải thiện đáng kể hiệu suất tương tác và khả năng mở rộng chức năng của thiết bị front-end(IoT) |
|
||||||
| <img src="../images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Cảm ơn [huangjunsen](https://github.com/huangjunsen0406) đã đóng góp module `Bảng điều khiển thông minh di động`, thực hiện điều khiển hiệu quả và tương tác thời gian thực trên thiết bị di động đa nền tảng, cải thiện đáng kể sự tiện lợi vận hành và hiệu quả quản lý của hệ thống trong tình huống di động |
|
| <img src="./docs/images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Cảm ơn [huangjunsen](https://github.com/huangjunsen0406) đã đóng góp module `Bảng điều khiển thông minh di động`, thực hiện điều khiển hiệu quả và tương tác thời gian thực trên thiết bị di động đa nền tảng, cải thiện đáng kể sự tiện lợi vận hành và hiệu quả quản lý của hệ thống trong tình huống di động |
|
||||||
| <img src="../images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Cảm ơn [Huiyuan Design](http://ui.kwd988.net/) đã cung cấp giải pháp thị giác chuyên nghiệp cho dự án này, sử dụng kinh nghiệm thực tế thiết kế phục vụ hơn nghìn doanh nghiệp, trao quyền cho trải nghiệm người dùng sản phẩm của dự án này |
|
| <img src="./docs/images/logo_huiyuan.png" width="160"> | [Huiyuan Design](http://ui.kwd988.net/) | Cảm ơn [Huiyuan Design](http://ui.kwd988.net/) đã cung cấp giải pháp thị giác chuyên nghiệp cho dự án này, sử dụng kinh nghiệm thực tế thiết kế phục vụ hơn nghìn doanh nghiệp, trao quyền cho trải nghiệm người dùng sản phẩm của dự án này |
|
||||||
| <img src="../images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Cảm ơn [Xi'an Qinren Information Technology](https://www.029app.com/) đã làm sâu sắc hệ thống thị giác của dự án này, đảm bảo tính nhất quán và khả năng mở rộng của phong cách thiết kế tổng thể trong ứng dụng đa tình huống |
|
| <img src="./docs/images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology](https://www.029app.com/) | Cảm ơn [Xi'an Qinren Information Technology](https://www.029app.com/) đã làm sâu sắc hệ thống thị giác của dự án này, đảm bảo tính nhất quán và khả năng mở rộng của phong cách thiết kế tổng thể trong ứng dụng đa tình huống |
|
||||||
| <img src="../images/logo_contributors.png" width="160"> | [Người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Cảm ơn [tất cả người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), sự cống hiến của bạn khiến dự án mạnh mẽ và vững chắc hơn. |
|
| <img src="./docs/images/logo_contributors.png" width="160"> | [Người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Cảm ơn [tất cả người đóng góp mã](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors), sự cống hiến của bạn khiến dự án mạnh mẽ và vững chắc hơn. |
|
||||||
|
|
||||||
|
|
||||||
<a href="https://www.star-history.com/?repos=xinnan-tech%2Fxiaozhi-esp32-server&type=date&legend=top-left">
|
<a href="https://star-history.com/#xinnan-tech/xiaozhi-esp32-server&Date">
|
||||||
|
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&theme=dark&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date&theme=dark" />
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
<img alt="Star History Chart" src="https://api.star-history.com/svg?repos=xinnan-tech/xiaozhi-esp32-server&type=Date" />
|
||||||
</picture>
|
</picture>
|
||||||
</a>
|
</a>
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||

|

|
||||||
# 方式一:Docker只运行Server
|
# 方式一:Docker只运行Server
|
||||||
|
|
||||||
本项目发行的docker镜像同时提供`amd64`和`arm64`两种架构,可以直接拉取使用;如需自定义镜像,可按照[这个教程](docker-build.md)在本机编译。
|
`0.8.2`版本开始,本项目发行的docker镜像只支持`x86架构`,如果需要在`arm64架构`的CPU上部署,可按照[这个教程](docker-build.md)在本机编译`arm64的镜像`。
|
||||||
|
|
||||||
## 1. 安装docker
|
## 1. 安装docker
|
||||||
|
|
||||||
|
|
@ -36,9 +36,9 @@ xiaozhi-server
|
||||||
|
|
||||||
#### 1.1.3 下载配置文件
|
#### 1.1.3 下载配置文件
|
||||||
|
|
||||||
你需要下载两个配置文件:`docker-compose.yml` 和 `config.yaml`。需要从项目仓库下载这两个文件。
|
你需要下载两个配置文件:`docker-compose.yaml` 和 `config.yaml`。需要从项目仓库下载这两个文件。
|
||||||
|
|
||||||
##### 1.1.3.1 下载 docker-compose.yml
|
##### 1.1.3.1 下载 docker-compose.yaml
|
||||||
|
|
||||||
用浏览器打开[这个链接](../main/xiaozhi-server/docker-compose.yml)。
|
用浏览器打开[这个链接](../main/xiaozhi-server/docker-compose.yml)。
|
||||||
|
|
||||||
|
|
@ -70,7 +70,7 @@ xiaozhi-server
|
||||||
|
|
||||||
## 2. 配置项目文件
|
## 2. 配置项目文件
|
||||||
|
|
||||||
接下来,程序还不能直接运行,你需要配置一下,你到底使用的是什么模型。你可以看这个教程:
|
接下里,程序还不能直接运行,你需要配置一下,你到底使用的是什么模型。你可以看这个教程:
|
||||||
[跳转到配置项目文件](#配置项目)
|
[跳转到配置项目文件](#配置项目)
|
||||||
|
|
||||||
配置完项目文件后,回到本教程继续往下。
|
配置完项目文件后,回到本教程继续往下。
|
||||||
|
|
@ -91,22 +91,25 @@ docker logs -f xiaozhi-esp32-server
|
||||||
|
|
||||||
这时,你就要留意日志信息,可以根据这个教程,判断是否成功了。[跳转到运行状态确认](#运行状态确认)
|
这时,你就要留意日志信息,可以根据这个教程,判断是否成功了。[跳转到运行状态确认](#运行状态确认)
|
||||||
|
|
||||||
## 4. 版本升级操作
|
## 5. 版本升级操作
|
||||||
|
|
||||||
如果后期想升级版本,可以这么操作
|
如果后期想升级版本,可以这么操作
|
||||||
|
|
||||||
4.1、备份好`data`文件夹中的`.config.yaml`文件,一些关键的配置到时复制到新的`.config.yaml`文件里。
|
5.1、备份好`data`文件夹中的`.config.yaml`文件,一些关键的配置到时复制到新的`.config.yaml`文件里。
|
||||||
请注意是对关键密钥逐个复制,不要直接覆盖。因为新的`.config.yaml`文件可能有一些新的配置项,旧的`.config.yaml`文件不一定有。
|
请注意是对关键密钥逐个复制,不要直接覆盖。因为新的`.config.yaml`文件可能有一些新的配置项,旧的`.config.yaml`文件不一定有。
|
||||||
|
|
||||||
4.2、执行以下命令
|
5.2、执行以下命令
|
||||||
|
|
||||||
```
|
```
|
||||||
docker stop xiaozhi-esp32-server
|
docker stop xiaozhi-esp32-server
|
||||||
docker rm xiaozhi-esp32-server
|
docker rm xiaozhi-esp32-server
|
||||||
|
docker stop xiaozhi-esp32-server-web
|
||||||
|
docker rm xiaozhi-esp32-server-web
|
||||||
docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest
|
docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest
|
||||||
|
docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:web_latest
|
||||||
```
|
```
|
||||||
|
|
||||||
4.3、重新按docker方式部署
|
5.3、重新按docker方式部署
|
||||||
|
|
||||||
# 方式二:本地源码只运行Server
|
# 方式二:本地源码只运行Server
|
||||||
|
|
||||||
|
|
@ -116,7 +119,7 @@ docker rmi ghcr.nju.edu.cn/xinnan-tech/xiaozhi-esp32-server:server_latest
|
||||||
如果确定使用`conda`,则安装好后,开始执行以下命令。
|
如果确定使用`conda`,则安装好后,开始执行以下命令。
|
||||||
|
|
||||||
重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词,
|
重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词,
|
||||||
找到`Anaconda Prompt`,使用管理员身份运行它。如下图。
|
找到`Anaconda Prpmpt`,使用管理员身份运行它。如下图。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
@ -210,14 +213,14 @@ prompt: |
|
||||||
请你像一个人一样说话,请勿返回配置xml及其他特殊字符。
|
请你像一个人一样说话,请勿返回配置xml及其他特殊字符。
|
||||||
|
|
||||||
selected_module:
|
selected_module:
|
||||||
LLM: ChatGLMLLM
|
LLM: DoubaoLLM
|
||||||
|
|
||||||
LLM:
|
LLM:
|
||||||
ChatGLMLLM:
|
ChatGLMLLM:
|
||||||
api_key: xxxxxxxxxxxxxxx.xxxxxx
|
api_key: xxxxxxxxxxxxxxx.xxxxxx
|
||||||
```
|
```
|
||||||
|
|
||||||
建议先将最简单的配置运行起来,然后再去[`../main/xiaozhi-server/config.yaml`](../main/xiaozhi-server/config.yaml)阅读配置的使用说明。
|
建议先将最简单的配置运行起来,然后再去`xiaozhi/config.yaml`阅读配置的使用说明。
|
||||||
比如你要换更换模型,修改`selected_module`下的配置就行。
|
比如你要换更换模型,修改`selected_module`下的配置就行。
|
||||||
|
|
||||||
## 模型文件
|
## 模型文件
|
||||||
|
|
@ -235,12 +238,11 @@ LLM:
|
||||||
如果你能看到,类似以下日志,则是本项目服务启动成功的标志。
|
如果你能看到,类似以下日志,则是本项目服务启动成功的标志。
|
||||||
|
|
||||||
```
|
```
|
||||||
250427 13:04:20[0.9.8_00000000000000][__main__]-INFO-OTA接口是 http://192.168.4.123:8003/xiaozhi/ota/
|
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-OTA接口是 http://192.168.4.123:8003/xiaozhi/ota/
|
||||||
250427 13:04:20[0.9.8_00000000000000][__main__]-INFO-视觉分析接口是 http://192.168.4.123:8003/mcp/vision/explain
|
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-Websocket地址是 ws://192.168.4.123:8000/xiaozhi/v1/
|
||||||
250427 13:04:20[0.9.8_00000000000000][__main__]-INFO-Websocket地址是 ws://192.168.4.123:8000/xiaozhi/v1/
|
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
250427 13:04:20[0.9.8_00000000000000][__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
250427 13:04:20[0.9.8_00000000000000][__main__]-INFO-如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
250427 13:04:20[0.3.11_SiFuChTTnofu][__main__]-INFO-=======================================================
|
||||||
250427 13:04:20[0.9.8_00000000000000][__main__]-INFO-=============================================================
|
|
||||||
```
|
```
|
||||||
|
|
||||||
正常来说,如果您是通过源码运行本项目,日志会有你的接口地址信息。
|
正常来说,如果您是通过源码运行本项目,日志会有你的接口地址信息。
|
||||||
|
|
|
||||||
|
|
@ -198,7 +198,7 @@ docker logs -f xiaozhi-esp32-server
|
||||||
```
|
```
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - Websocket地址是 ws://xxx.xx.xx.xx:8000/xiaozhi/v1/
|
25-02-23 12:01:09[core.websocket_server] - INFO - Websocket地址是 ws://xxx.xx.xx.xx:8000/xiaozhi/v1/
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - 如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
25-02-23 12:01:09[core.websocket_server] - INFO - 如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - =======================================================
|
25-02-23 12:01:09[core.websocket_server] - INFO - =======================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -335,7 +335,7 @@ npm run serve
|
||||||
如果确定使用`conda`,则安装好后,开始执行以下命令。
|
如果确定使用`conda`,则安装好后,开始执行以下命令。
|
||||||
|
|
||||||
重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词,
|
重要提示!windows 用户,可以通过安装`Anaconda`来管理环境。安装好`Anaconda`后,在`开始`那里搜索`anaconda`相关的关键词,
|
||||||
找到`Anaconda Prompt`,使用管理员身份运行它。如下图。
|
找到`Anaconda Prpmpt`,使用管理员身份运行它。如下图。
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
|
@ -418,7 +418,7 @@ manager-api:
|
||||||
secret: 12345678-xxxx-xxxx-xxxx-123456789000
|
secret: 12345678-xxxx-xxxx-xxxx-123456789000
|
||||||
```
|
```
|
||||||
|
|
||||||
## 9.运行项目
|
## 5.运行项目
|
||||||
|
|
||||||
```
|
```
|
||||||
# 确保在xiaozhi-server目录下执行
|
# 确保在xiaozhi-server目录下执行
|
||||||
|
|
@ -431,7 +431,7 @@ python app.py
|
||||||
```
|
```
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - Server is running at ws://xxx.xx.xx.xx:8000/xiaozhi/v1/
|
25-02-23 12:01:09[core.websocket_server] - INFO - Server is running at ws://xxx.xx.xx.xx:8000/xiaozhi/v1/
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
25-02-23 12:01:09[core.websocket_server] - INFO - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - 如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
25-02-23 12:01:09[core.websocket_server] - INFO - 如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
25-02-23 12:01:09[core.websocket_server] - INFO - =======================================================
|
25-02-23 12:01:09[core.websocket_server] - INFO - =======================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
11
docs/FAQ.md
11
docs/FAQ.md
|
|
@ -65,14 +65,13 @@ VAD:
|
||||||
3、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)<br/>
|
3、[如何部署MQTT网关开启MQTT+UDP协议](./mqtt-gateway-integration.md)<br/>
|
||||||
4、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)<br/>
|
4、[如何自动拉取本项目最新代码自动编译和启动](./dev-ops-integration.md)<br/>
|
||||||
5、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)<br/>
|
5、[如何与Nginx集成](https://github.com/xinnan-tech/xiaozhi-esp32-server/issues/791)<br/>
|
||||||
6、[修改代码后怎么编译自己的Docker镜像](./docker-build.md)<br/>
|
|
||||||
|
|
||||||
### 8、编译固件相关教程
|
### 9、编译固件相关教程
|
||||||
1、[如何自己编译小智固件](./firmware-build.md)<br/>
|
1、[如何自己编译小智固件](./firmware-build.md)<br/>
|
||||||
2、[如何基于虾哥编译好的固件修改OTA地址](./firmware-setting.md)<br/>
|
2、[如何基于虾哥编译好的固件修改OTA地址](./firmware-setting.md)<br/>
|
||||||
3、[单模块部署如何配置固件OTA自动升级](./ota-upgrade-guide.md)<br/>
|
3、[单模块部署如何配置固件OTA自动升级](./ota-upgrade-guide.md)<br/>
|
||||||
|
|
||||||
### 9、拓展相关教程
|
### 10、拓展相关教程
|
||||||
1、[如何开启手机号码注册智控台](./ali-sms-integration.md)<br/>
|
1、[如何开启手机号码注册智控台](./ali-sms-integration.md)<br/>
|
||||||
2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)<br/>
|
2、[如何集成HomeAssistant实现智能家居控制](./homeassistant-integration.md)<br/>
|
||||||
3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)<br/>
|
3、[如何开启视觉模型实现拍照识物](./mcp-vision-integration.md)<br/>
|
||||||
|
|
@ -85,12 +84,6 @@ VAD:
|
||||||
10、[如何部署上下文源](./context-provider-integration.md)<br/>
|
10、[如何部署上下文源](./context-provider-integration.md)<br/>
|
||||||
11、[如何集成PowerMem智能记忆](./powermem-integration.md)<br/>
|
11、[如何集成PowerMem智能记忆](./powermem-integration.md)<br/>
|
||||||
12、[如何配置天气插件查询天气](./weather-integration.md)<br/>
|
12、[如何配置天气插件查询天气](./weather-integration.md)<br/>
|
||||||
13、[如何开启设备呼叫插件](./device-call-guide.md)<br/>
|
|
||||||
14、[如何开启联网搜索功能](./web-search-integration.md)<br/>
|
|
||||||
|
|
||||||
### 10、数字人相关教程
|
|
||||||
1、[数字人digital-human启动方法](./digital-human-wakeword.md)<br/>
|
|
||||||
2、[如何在N100迷你主机上部署数字人digital-human](./all-in-one-digital-human-setup.md)<br/>
|
|
||||||
|
|
||||||
### 11、语音克隆、本地语音部署相关教程
|
### 11、语音克隆、本地语音部署相关教程
|
||||||
1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)<br/>
|
1、[如何在智控台克隆音色](./huoshan-streamTTS-voice-cloning.md)<br/>
|
||||||
|
|
|
||||||
|
|
@ -1,442 +0,0 @@
|
||||||
# 一体机数字人配置指南
|
|
||||||
|
|
||||||
本项目用于在 x86 架构设备(如迷你主机、工控机、普通电脑等)上部署一套完整的数字人展示系统,实现以下功能:
|
|
||||||
- 开机自动进入 Kiosk 全屏浏览器,展示指定网页
|
|
||||||
- 后台运行唤醒词检测服务,支持语音交互
|
|
||||||
|
|
||||||
> **说明**:本文档以 **Intel N100 迷你主机(天虹 QN10-100B4)** 为例进行部署演示,其他 x86 设备可参考调整(注意网络配置和声卡设备差异)。
|
|
||||||
|
|
||||||
## 适用环境
|
|
||||||
|
|
||||||
| 项目 | 说明 |
|
|
||||||
|------|------|
|
|
||||||
| 示例硬件 | 天虹 QN10-100B4(Intel N100) |
|
|
||||||
| 操作系统 | Ubuntu 24.04 LTS (Noble Numbat) |
|
|
||||||
| 示例用户 | xz(请根据实际情况替换) |
|
|
||||||
| 网络 | Wi-Fi 连接,固定 IP(可按需改为有线) |
|
|
||||||
|
|
||||||
## 部署流程
|
|
||||||
|
|
||||||
1. 系统初始化(换源、连网)
|
|
||||||
2. 安装图形组件与 Kiosk 浏览器
|
|
||||||
3. 配置自动登录与图形界面
|
|
||||||
4. 部署唤醒词服务(Python 环境 + 麦克风)
|
|
||||||
5. 优化开机速度与隐藏启动信息
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
|
|
||||||
### 系统初始化(换源、连网)
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
|
|
||||||
|
|
||||||
sudo tee /etc/apt/sources.list > /dev/null <<EOF
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
|
|
||||||
# deb-src http://mirrors.aliyun.com/ubuntu/ noble main restricted universe multiverse
|
|
||||||
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
|
|
||||||
# deb-src http://mirrors.aliyun.com/ubuntu/ noble-security main restricted universe multiverse
|
|
||||||
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
|
|
||||||
# deb-src http://mirrors.aliyun.com/ubuntu/ noble-updates main restricted universe multiverse
|
|
||||||
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
|
|
||||||
# deb-src http://mirrors.aliyun.com/ubuntu/ noble-proposed main restricted universe multiverse
|
|
||||||
|
|
||||||
deb http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
|
|
||||||
# deb-src http://mirrors.aliyun.com/ubuntu/ noble-backports main restricted universe multiverse
|
|
||||||
EOF
|
|
||||||
|
|
||||||
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
安装网络管理工具(若已存在可忽略)
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install network-manager -y
|
|
||||||
sudo systemctl start NetworkManager
|
|
||||||
sudo systemctl enable NetworkManager
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
设置wifi密码,固定ip
|
|
||||||
|
|
||||||
> **提醒**:以下命令中的 Wi-Fi 名称、密码、IP 地址均为示例,请务必替换为你自己的实际信息。
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo nmcli device wifi connect "MERCURY_1812" password "12345678"
|
|
||||||
|
|
||||||
sudo nmcli connection modify "MERCURY_1812" ipv4.addresses "192.168.0.86/24" ipv4.gateway "192.168.0.1" ipv4.dns "8.8.8.8,114.114.114.114" ipv4.method "manual"
|
|
||||||
|
|
||||||
sudo nmcli connection up "MERCURY_1812"
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
### 第一步:安装核心图形组件与浏览器
|
|
||||||
|
|
||||||
这里我们坚持“极简主义”,坚决不装多余的桌面环境(如 GNOME/KDE),只装底层驱动、最轻量的窗口管理器(Openbox)、隐藏鼠标工具以及 Chromium 浏览器。
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo timedatectl set-timezone Asia/Shanghai
|
|
||||||
|
|
||||||
|
|
||||||
sudo apt install net-tools vim fonts-wqy-microhei fonts-wqy-zenhei alsa-utils pulseaudio -y
|
|
||||||
sudo apt install --no-install-recommends xserver-xorg x11-xserver-utils xinit openbox unclutter -y
|
|
||||||
|
|
||||||
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
|
|
||||||
sudo apt install ./google-chrome-stable_current_amd64.deb -y
|
|
||||||
rm google-chrome-stable_current_amd64.deb
|
|
||||||
|
|
||||||
sudo apt purge snapd -y
|
|
||||||
|
|
||||||
```
|
|
||||||
|
|
||||||
### 第二步:配置 TTY1 开机免密自动登录
|
|
||||||
|
|
||||||
为了避免手动输入账号密码的尴尬,我们通过修改 systemd 服务,让系统一开机就自动以 `xz` 的身份登录。这里使用一键写入命令,彻底避开由于 `nano` 或 `vi` 操作不当导致的保存失败问题。
|
|
||||||
|
|
||||||
**1. 创建配置目录:**
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo mkdir -p /etc/systemd/system/getty@tty1.service.d/
|
|
||||||
```
|
|
||||||
|
|
||||||
**2. 写入自动登录规则:**
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
echo -e "[Service]\nExecStart=\nExecStart=-/sbin/agetty --autologin xz --noclear %I \$TERM" | sudo tee /etc/systemd/system/getty@tty1.service.d/override.conf
|
|
||||||
```
|
|
||||||
|
|
||||||
**3. 重载服务并设置默认启动目标:**
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl set-default multi-user.target
|
|
||||||
```
|
|
||||||
|
|
||||||
### 第三步:配置登录后自动启动图形界面
|
|
||||||
|
|
||||||
系统自动登录后默认停留在黑底白字的命令行,我们需要配置脚本,让它一旦登录立马启动 X11 图形环境。
|
|
||||||
|
|
||||||
**1. 触发 `startx` 的启动逻辑:**
|
|
||||||
|
|
||||||
直接将触发代码追加写入你的个人环境配置文件中:
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
cat << 'EOF' >> ~/.bash_profile
|
|
||||||
if [ -z "$DISPLAY" ] && [ "$(fgconsole)" -eq 1 ]; then
|
|
||||||
exec startx
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
**2. 告诉 `startx` 去启动 Openbox:**
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
echo "exec openbox-session" > ~/.xinitrc
|
|
||||||
```
|
|
||||||
|
|
||||||
### 第四步:配置“铜墙铁壁”的 Openbox 与浏览器
|
|
||||||
|
|
||||||
这是最核心的一步:关闭屏幕休眠、隐藏鼠标、全屏锁定浏览器,并写一个“死循环”保证浏览器被意外关闭后也能瞬间复活。
|
|
||||||
|
|
||||||
**1. 创建 Openbox 配置目录:**
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
mkdir -p ~/.config/openbox
|
|
||||||
```
|
|
||||||
|
|
||||||
**2. 写入自启动脚本 (`autostart`):**
|
|
||||||
|
|
||||||
复制以下整段代码并回车(这会自动把所有保护规则写进文件里):
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
cat << 'EOF' > ~/.config/openbox/autostart
|
|
||||||
# 关闭屏幕保护
|
|
||||||
xset -dpms
|
|
||||||
xset s noblank
|
|
||||||
xset s off
|
|
||||||
|
|
||||||
# 隐藏鼠标
|
|
||||||
unclutter -idle 0.1 -root &
|
|
||||||
|
|
||||||
# 死循环启动 Chromium(崩溃或被关也能秒重启)
|
|
||||||
while true; do
|
|
||||||
google-chrome \
|
|
||||||
--kiosk \
|
|
||||||
--no-first-run \
|
|
||||||
--no-default-browser-check \
|
|
||||||
--disable-infobars \
|
|
||||||
--disable-session-crashed-bubble \
|
|
||||||
--disable-translate \
|
|
||||||
--disable-external-intent-requests \
|
|
||||||
--autoplay-policy=no-user-gesture-required \
|
|
||||||
--use-fake-ui-for-media-stream \
|
|
||||||
"https://www.douyin.com"
|
|
||||||
sleep 2
|
|
||||||
done &
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
**3. 屏蔽 `Alt+F4` 退出快捷键:**
|
|
||||||
|
|
||||||
为了防止别人插上键盘强行关掉窗口,我们把 Openbox 默认的系统快捷键干掉。
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
cp /etc/xdg/openbox/rc.xml ~/.config/openbox/
|
|
||||||
sed -i '/<keybind key="A-F4">/,/<\/keybind>/d' ~/.config/openbox/rc.xml
|
|
||||||
```
|
|
||||||
|
|
||||||
### 第五步:重启验收成果
|
|
||||||
|
|
||||||
如果拔掉网线或不需要等待所有网络上线,可禁用网络等待服务,避免开机卡顿
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo systemctl mask systemd-networkd-wait-online.service
|
|
||||||
sudo systemctl mask NetworkManager-wait-online.service
|
|
||||||
```
|
|
||||||
|
|
||||||
隐藏开机信息(GRUB)
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT=.*/GRUB_CMDLINE_LINUX_DEFAULT="quiet loglevel=3 systemd.show_status=false vt.global_cursor_default=0"/g' /etc/default/grub
|
|
||||||
|
|
||||||
echo 'GRUB_TIMEOUT_STYLE="hidden"' | sudo tee -a /etc/default/grub
|
|
||||||
echo 'GRUB_RECORDFAIL_TIMEOUT=0' | sudo tee -a /etc/default/grub
|
|
||||||
|
|
||||||
sudo update-grub
|
|
||||||
```
|
|
||||||
|
|
||||||
声音设置成100%,然后 重启:
|
|
||||||
|
|
||||||
Bash
|
|
||||||
|
|
||||||
```
|
|
||||||
amixer -q sset Master 100% unmute
|
|
||||||
sudo reboot
|
|
||||||
```
|
|
||||||
|
|
||||||
### 部署唤醒词服务
|
|
||||||
|
|
||||||
在一体机上部署唤醒词检测服务,需要安装 Python 环境、上传项目文件、配置 Camera 麦克风和开机自启。
|
|
||||||
|
|
||||||
#### 1. 安装 Miniconda
|
|
||||||
|
|
||||||
```bash
|
|
||||||
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
|
|
||||||
bash Miniconda3-latest-Linux-x86_64.sh -b -p $HOME/miniconda3
|
|
||||||
~/miniconda3/bin/conda init bash
|
|
||||||
source ~/.bashrc
|
|
||||||
rm Miniconda3-latest-Linux-x86_64.sh
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
确保登录时自动进入conda环境
|
|
||||||
|
|
||||||
```bash
|
|
||||||
if ! grep -q '.bashrc' ~/.bash_profile; then
|
|
||||||
cat << 'EOF' >> ~/.bash_profile
|
|
||||||
|
|
||||||
if [ -f ~/.bashrc ]; then
|
|
||||||
. ~/.bashrc
|
|
||||||
fi
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
#### 2. 创建 Python 虚拟环境
|
|
||||||
|
|
||||||
```bash
|
|
||||||
conda create -n test python=3.10 -y
|
|
||||||
conda activate test
|
|
||||||
```
|
|
||||||
|
|
||||||
若出现 Terms of Service have not been accepted 错误,执行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main
|
|
||||||
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3. 上传项目文件
|
|
||||||
|
|
||||||
将开发机上的 `main/digital-human/` 整个目录上传到一体机的 `~/digital-human/` 目录:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 在开发机上执行(将 <一体机IP> 替换为实际 IP)
|
|
||||||
scp -r main/digital-human/ xz@<一体机IP>:~/digital-human/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 4. 安装系统依赖
|
|
||||||
|
|
||||||
唤醒词服务需要音频采集库和 ALSA PulseAudio 插件:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo apt install libportaudio2 portaudio19-dev libasound2-plugins -y
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 5. 安装 Python 依赖
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd ~/digital-human/wakeword_runtime
|
|
||||||
pip install numpy
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 6. 下载唤醒词模型
|
|
||||||
|
|
||||||
模型文件不包含在项目中,需要单独下载配置,详见 [docs/digital-human-wakeword.md](digital-human-wakeword.md) 中的“模型下载”章节。
|
|
||||||
|
|
||||||
#### 7. 修改 Openbox 自启动脚本
|
|
||||||
|
|
||||||
需要在 autostart 中加上 PulseAudio 和 Camera 麦克风配置,并将 Chrome 地址改为测试页面。
|
|
||||||
|
|
||||||
先确认 Camera 麦克风在 PulseAudio 中的设备名:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pulseaudio --start
|
|
||||||
pactl list sources short
|
|
||||||
```
|
|
||||||
|
|
||||||
找到包含 `USB_Camera` 的那一行,记下完整名称,例如:
|
|
||||||
|
|
||||||
```
|
|
||||||
alsa_input.usb-SN0002_2K_USB_Camera_46435000_P030D00_SN0002-02.mono-fallback
|
|
||||||
```
|
|
||||||
|
|
||||||
然后用完整内容覆盖 autostart(将 `TARGET_MIC` 替换为你的实际设备名):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cat << 'EOF' > ~/.config/openbox/autostart
|
|
||||||
# 1. 启动声音服务并稍作等待
|
|
||||||
pulseaudio --start
|
|
||||||
sleep 1
|
|
||||||
|
|
||||||
# 2. 锁定 Camera 的麦克风(请替换为你的实际设备名)
|
|
||||||
TARGET_MIC="alsa_input.usb-SN0002_2K_USB_Camera_46435000_P030D00_SN0002-02.mono-fallback"
|
|
||||||
|
|
||||||
# 3. 设为系统默认麦克风
|
|
||||||
pactl set-default-source "$TARGET_MIC"
|
|
||||||
|
|
||||||
# 4. 解除静音
|
|
||||||
pactl set-source-mute "$TARGET_MIC" 0
|
|
||||||
|
|
||||||
# 5. 音量拉到 100%
|
|
||||||
pactl set-source-volume "$TARGET_MIC" 100%
|
|
||||||
|
|
||||||
# --- 极简桌面与浏览器环境配置 ---
|
|
||||||
|
|
||||||
# 关闭屏幕保护
|
|
||||||
xset -dpms
|
|
||||||
xset s noblank
|
|
||||||
xset s off
|
|
||||||
|
|
||||||
# 隐藏鼠标
|
|
||||||
unclutter -idle 0.1 -root &
|
|
||||||
|
|
||||||
# 死循环启动浏览器(崩溃或被关也能秒重启)
|
|
||||||
while true; do
|
|
||||||
google-chrome \
|
|
||||||
--kiosk \
|
|
||||||
--no-first-run \
|
|
||||||
--no-default-browser-check \
|
|
||||||
--disable-infobars \
|
|
||||||
--disable-session-crashed-bubble \
|
|
||||||
--disable-translate \
|
|
||||||
--disable-external-intent-requests \
|
|
||||||
--autoplay-policy=no-user-gesture-required \
|
|
||||||
--use-fake-ui-for-media-stream \
|
|
||||||
"http://127.0.0.1:8006/index.html"
|
|
||||||
sleep 2
|
|
||||||
done &
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 8. 配置唤醒词服务开机自启
|
|
||||||
|
|
||||||
创建 systemd 服务文件,让唤醒词服务开机自动运行。
|
|
||||||
|
|
||||||
先确认当前用户的 UID:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
id -u $(whoami)
|
|
||||||
```
|
|
||||||
|
|
||||||
然后用查到的 UID 替换下面 `1000`(通常第一个用户就是 1000):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo tee /etc/systemd/system/digital-human.service << 'EOF'
|
|
||||||
[Unit]
|
|
||||||
Description=Digital Human Runtime
|
|
||||||
After=network.target sound.target
|
|
||||||
|
|
||||||
[Service]
|
|
||||||
Type=simple
|
|
||||||
User=xz
|
|
||||||
Environment=XDG_RUNTIME_DIR=/run/user/1000
|
|
||||||
Environment=PULSE_SERVER=unix:/run/user/1000/pulse/native
|
|
||||||
WorkingDirectory=/home/xz/digital-human
|
|
||||||
ExecStartPre=/bin/sleep 10
|
|
||||||
ExecStart=/home/xz/miniconda3/envs/test/bin/python start.py
|
|
||||||
Restart=on-failure
|
|
||||||
RestartSec=10
|
|
||||||
|
|
||||||
[Install]
|
|
||||||
WantedBy=multi-user.target
|
|
||||||
EOF
|
|
||||||
```
|
|
||||||
|
|
||||||
> **重要说明**:
|
|
||||||
> - `User=xz` — 替换为你的实际用户名
|
|
||||||
> - `/run/user/1000` — 替换为你实际的 UID
|
|
||||||
> - `WorkingDirectory` 和 `ExecStart` 中的路径 — 替换为你的实际部署路径
|
|
||||||
> - `Environment` 中的 PulseAudio 环境变量**必须保留**,否则唤醒词服务和浏览器无法同时使用 Camera 麦克风
|
|
||||||
|
|
||||||
启用并启动服务:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl daemon-reload
|
|
||||||
sudo systemctl enable digital-human
|
|
||||||
sudo systemctl start digital-human
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 9. 常用服务管理命令
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo systemctl start digital-human # 立即启动
|
|
||||||
sudo systemctl stop digital-human # 停止
|
|
||||||
sudo systemctl restart digital-human # 重启
|
|
||||||
sudo systemctl status digital-human # 查看状态
|
|
||||||
journalctl -u digital-human -f # 查看实时日志
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
@ -7,7 +7,7 @@
|
||||||
`上下文源` 在小智在唤醒那一刻,获取外部系统的数据,并将其动态注入到大模型的系统提示词(System Prompt)中。
|
`上下文源` 在小智在唤醒那一刻,获取外部系统的数据,并将其动态注入到大模型的系统提示词(System Prompt)中。
|
||||||
让其做到唤醒时感知世界某个事物的状态。
|
让其做到唤醒时感知世界某个事物的状态。
|
||||||
|
|
||||||
它和MCP、记忆有本质的区别:`上下文源`是强制让小智感知世界的数据;`记忆(Mem)`是让他知道之前聊了什么内容;`MCP(function_call)`是当需要调用某项能力/知识的时候使用调用。
|
它和MCP、记忆有本质的区别:`上下文源`是强制让小智感知世界的数据;`记忆(Mem)`是让他知道之前聊了什么内容;`MCP(functionc all)`是当需要调用某项能力/知识的时候使用调用。
|
||||||
|
|
||||||
通过这个功能,在小智唤醒的一刹那,“感知”到:
|
通过这个功能,在小智唤醒的一刹那,“感知”到:
|
||||||
- 人体健康传感器状态(体温、血压、血氧状态等)
|
- 人体健康传感器状态(体温、血压、血氧状态等)
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,7 @@ cp 你原来的model.pt完整路径 /home/system/xiaozhi/xiaozhi-esp32-server/ma
|
||||||
|
|
||||||
# 第四步 建立三个自动编译文件
|
# 第四步 建立三个自动编译文件
|
||||||
|
|
||||||
## 4.1 自动编译manager-web模块
|
## 4.1 自动编译mananger-web模块
|
||||||
在`/home/system/xiaozhi/`目录下,创建名字为`update_8001.sh`的文件,内容如下
|
在`/home/system/xiaozhi/`目录下,创建名字为`update_8001.sh`的文件,内容如下
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
@ -106,7 +106,7 @@ fi
|
||||||
|
|
||||||
nohup java -jar xiaozhi-esp32-api.jar --spring.profiles.active=dev &
|
nohup java -jar xiaozhi-esp32-api.jar --spring.profiles.active=dev &
|
||||||
|
|
||||||
tail -f nohup.out
|
tail tail -f nohup.out
|
||||||
```
|
```
|
||||||
|
|
||||||
保存好后执行赋权命令
|
保存好后执行赋权命令
|
||||||
|
|
|
||||||
|
|
@ -1,150 +0,0 @@
|
||||||
# 设备间相互呼叫插件使用指南
|
|
||||||
|
|
||||||
## 概述
|
|
||||||
|
|
||||||
设备呼叫功能允许两个已配置设备之间通过语音/数据通道进行双向通信。设备A呼叫设备B时,系统通过以下流程实现:
|
|
||||||
|
|
||||||
```
|
|
||||||
设备A → 授权校验 → MQTT网关 → 设备B远程唤醒 → 建立连接 → 通话建立
|
|
||||||
```
|
|
||||||
## 使用这个功能的前提条件
|
|
||||||
1. 你必须要有至少两个设备,每个设备型号必须是`ESP32-S3`,因为只有`ESP32-S3`才支持远程唤醒功能。
|
|
||||||
2. 你的设备必须要有`两个麦克风`。但是如果你的设备只有`单个麦克风`,你只是想体验一下这个功能,也是可以的,但是会有强烈的卡顿感。
|
|
||||||
3. 你必须使用[全模块部署](Deployment_all.md)本项目,因为你需要`智控台`来管理设备的权限和通信。
|
|
||||||
4. 你必须安装并配置好`2026年5月27日`以后的[MQTT网关服务](mqtt-gateway-integration.md),如果你已经部署了MQTT网关服务,请确认代码的版本是`2026年5月27日`之后的版本。
|
|
||||||
|
|
||||||
以上是使用这个功能的硬性条件,接下来会详细介绍。
|
|
||||||
|
|
||||||
## 配置步骤
|
|
||||||
|
|
||||||
### 第一步:开启通讯录功能
|
|
||||||
|
|
||||||
1. 确认你的智控台版本是`0.9.4`或以上版本。
|
|
||||||
2. 登录智控台后台
|
|
||||||
3. 进入 **系统功能配置**
|
|
||||||
4. 在左侧功能列表中勾选 **通讯录**
|
|
||||||
5. 点击 **保存配置** 确认
|
|
||||||
|
|
||||||
### 第二步:配置设备间呼叫权限
|
|
||||||
|
|
||||||
1. 在智控台顶部菜单点击 **通讯录**
|
|
||||||
2. 在左侧智能体下,设备列表中选择你的设备A(支持按 MAC地址 或 备注名 搜索)
|
|
||||||
3. 在右侧详情面板中,找到目标设备B的称呼设置,例如 **"小王"**
|
|
||||||
4. 勾选设备B的 **呼叫权限** 复选框
|
|
||||||
5. 点击 **保存**
|
|
||||||
|
|
||||||
**双向授权说明:** 如需设备A和设备B互相通信,必须在两侧智控台分别配置对方权限。例如:
|
|
||||||
|
|
||||||
- 在设备A的配置中勾选设备B → 设备A可与设备B通信
|
|
||||||
- 在设备B的配置中勾选设备A → 设备B可与设备A通信
|
|
||||||
|
|
||||||
### 第三步:在智能体配置添加呼叫工具
|
|
||||||
|
|
||||||
1. 在智控台顶部菜单点击 **智能体管理**
|
|
||||||
2. 在刚刚配置设备联系人的相关智能体中点击 **编辑角色**
|
|
||||||
3. 在右侧详情面板中,点击 **编辑功能**
|
|
||||||
4. 勾选 **设备呼叫设备** 工具
|
|
||||||
5. 点击 **保存配置** 确认
|
|
||||||
6. 在外侧再次点击 **保存配置** ,随即重启设备
|
|
||||||
|
|
||||||
### 第四步:固件端添加远程唤醒工具
|
|
||||||
|
|
||||||
1. 在[xiaozhi-esp32](https://github.com/78/xiaozhi-esp32) 代码的基础上增加远程唤醒工具MCP,版本支持为2.1.0至2.2.6(2026年5月29日的版本)
|
|
||||||
2. 在application.h文件中添加远程唤醒函数声明
|
|
||||||
```cpp
|
|
||||||
void RemoteWakeup(const std::string& reason);
|
|
||||||
```
|
|
||||||
3. 在application.cc文件中添加远程唤醒函数
|
|
||||||
```cpp
|
|
||||||
void Application::RemoteWakeup(const std::string& reason){
|
|
||||||
if (!protocol_) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
auto state = GetDeviceState();
|
|
||||||
|
|
||||||
if (state == kDeviceStateIdle) {
|
|
||||||
audio_service_.EncodeWakeWord();
|
|
||||||
|
|
||||||
if (!protocol_->IsAudioChannelOpened()) {
|
|
||||||
SetDeviceState(kDeviceStateConnecting);
|
|
||||||
if (!protocol_->OpenAudioChannel()) {
|
|
||||||
audio_service_.EnableWakeWordDetection(true);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::string wake_word = reason;
|
|
||||||
#if CONFIG_USE_AFE_WAKE_WORD || CONFIG_USE_CUSTOM_WAKE_WORD
|
|
||||||
// Encode and send the wake word data to the server
|
|
||||||
while (auto packet = audio_service_.PopWakeWordPacket()) {
|
|
||||||
protocol_->SendAudio(std::move(packet));
|
|
||||||
}
|
|
||||||
// Set the chat state to wake word detected
|
|
||||||
protocol_->SendWakeWordDetected(wake_word);
|
|
||||||
SetListeningMode(aec_mode_ == kAecOff ? kListeningModeAutoStop : kListeningModeRealtime);
|
|
||||||
#else
|
|
||||||
// Set flag to play popup sound after state changes to listening
|
|
||||||
// (PlaySound here would be cleared by ResetDecoder in EnableVoiceProcessing)
|
|
||||||
play_popup_on_listening_ = true;
|
|
||||||
SetListeningMode(aec_mode_ == kAecOff ? kListeningModeAutoStop : kListeningModeRealtime);
|
|
||||||
#endif
|
|
||||||
} else if (state == kDeviceStateSpeaking) {
|
|
||||||
AbortSpeaking(kAbortReasonWakeWordDetected);
|
|
||||||
SetDeviceState(kDeviceStateIdle);
|
|
||||||
} else if (state == kDeviceStateActivating) {
|
|
||||||
SetDeviceState(kDeviceStateIdle);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
4. 在mcp_server.cc文件中添加远程唤醒工具
|
|
||||||
```cpp
|
|
||||||
AddUserOnlyTool("self.remote_wakeup", "Remote wakeup function with configurable parameters",
|
|
||||||
PropertyList({
|
|
||||||
Property("reason", kPropertyTypeString, "Wakeup reason"),
|
|
||||||
}),
|
|
||||||
[this](const PropertyList& properties) -> ReturnValue {
|
|
||||||
std::string reason = properties["reason"].value<std::string>();
|
|
||||||
ESP_LOGI(TAG, "Wakeup reason=%s", reason.c_str());
|
|
||||||
auto& app = Application::GetInstance();
|
|
||||||
app.RemoteWakeup(reason);
|
|
||||||
return true;
|
|
||||||
```
|
|
||||||
5. 按照 [固件编译烧录指南](firmware-build.md) 完成固件烧录
|
|
||||||
6. 无论你的设备是单麦还是双麦,请在编译环节,勾选开启AEC功能!
|
|
||||||
7. 无论你的设备是单麦还是双麦,请在编译环节,勾选开启AEC功能!
|
|
||||||
8. 无论你的设备是单麦还是双麦,请在编译环节,勾选开启AEC功能!
|
|
||||||
|
|
||||||
### 第五步:配置MQTT网关服务
|
|
||||||
|
|
||||||
1. 部署MQTT网关服务,参考 [MQTT网关集成文档](mqtt-gateway-integration.md)
|
|
||||||
2. 如果已经部署请确认代码的版本是2026年5月27日的版本
|
|
||||||
|
|
||||||
## 呼叫流程说明
|
|
||||||
|
|
||||||
准备两个设备,在智控台上面配置好通讯权限和在智能体中添加呼叫工具之后,在其中一个小智对话那里对他说:”呼叫XXX“,观察设备B是否响应。
|
|
||||||
|
|
||||||
## 常见问题
|
|
||||||
|
|
||||||
### Q: 设备B没有响应呼叫?
|
|
||||||
|
|
||||||
- 检查设备B是否在线(智控台设备状态)
|
|
||||||
- 确认设备B的固件已正确集成远程唤醒工具
|
|
||||||
- 检查MQTT网关连接是否正常
|
|
||||||
- 验证双向权限配置是否完整
|
|
||||||
|
|
||||||
### Q: 提示"无呼叫权限"?
|
|
||||||
|
|
||||||
- 在智控台确认设备A已勾选设备B的呼叫权限
|
|
||||||
- 确认配置已保存(非仅修改未保存)
|
|
||||||
|
|
||||||
### Q: 如何确认通讯录功能已开启?
|
|
||||||
|
|
||||||
- 智控台顶部菜单如显示"通讯录"入口,则表示已开启
|
|
||||||
|
|
||||||
### Q: 我叫他呼叫"张山",但是他老是识别成"张三",怎么办?
|
|
||||||
- 可以查阅你使用的asr服务的文档,确认是否支持热词识别。
|
|
||||||
- 如果你用的是`FunASRServer`,可以在容器里的`热词文件`里添加"张山",然后重启容器。
|
|
||||||
- 如果你用的是`火山引擎`的服务,可以在`火山引擎的控制台`里添加`热词文件`,然后回到智控台的`模型配置`页面,在`语音识别`里找到模型名称为`豆包语音识别(流式)`的那一条,点`修改`,弹窗里的`供应器`是`火山引擎语音识别(流式)`,在弹窗的`调用信息`区域把`热词文件名称`填到对应的输入框,点`确认保存`。
|
|
||||||
- `豆包语音识别2.0(流式)`(供应器是`火山引擎语音识别(流式)`)和`豆包语音识别`(供应器是`火山引擎语音识别`)这两条也都有`热词文件名称`这个字段,用法一样,配置时注意别选错行。
|
|
||||||
- 改完要让设备重新连接才会生效:设备连上时才会把最新的私有配置拉下来,一直连着的设备不会自动变。
|
|
||||||
|
|
||||||
|
|
@ -1,220 +0,0 @@
|
||||||
# 数字人digital-human启动方法
|
|
||||||
|
|
||||||
## 概述
|
|
||||||
|
|
||||||
测试页面集成了基于 **Sherpa-ONNX** 的高精度语音唤醒功能,支持自定义唤醒词和实时检测。使用轻量级关键词检测模型,提供毫秒级响应速度。
|
|
||||||
|
|
||||||
## 唤醒词模型
|
|
||||||
|
|
||||||
### 模型下载(必需)
|
|
||||||
|
|
||||||
**重要说明**: 项目不包含模型文件,需要提前下载配置。
|
|
||||||
|
|
||||||
### 官方模型下载地址
|
|
||||||
|
|
||||||
- **官方模型列表**: <https://csukuangfj.github.io/sherpa/onnx/kws/pretrained_models/index.html>
|
|
||||||
- **推荐模型**: `sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01`
|
|
||||||
|
|
||||||
### 下载和配置步骤
|
|
||||||
|
|
||||||
#### 1. 下载模型包
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 方法1:直接下载(推荐)
|
|
||||||
cd main/digital-human/wakeword_runtime/
|
|
||||||
wget https://github.com/k2-fsa/sherpa-onnx/releases/download/kws-models/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2
|
|
||||||
|
|
||||||
# 解压
|
|
||||||
tar xvf sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01.tar.bz2
|
|
||||||
|
|
||||||
# 方法2:使用ModelScope
|
|
||||||
pip install modelscope
|
|
||||||
python -c "
|
|
||||||
from modelscope import snapshot_download
|
|
||||||
snapshot_download('pkufool/sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01', cache_dir='./models')
|
|
||||||
"
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 2. 配置模型文件
|
|
||||||
|
|
||||||
模型包下载后包含以下文件:
|
|
||||||
|
|
||||||
```
|
|
||||||
sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01/
|
|
||||||
├── encoder-epoch-12-avg-2-chunk-16-left-64.int8.onnx # 速度优先
|
|
||||||
├── encoder-epoch-12-avg-2-chunk-16-left-64.onnx
|
|
||||||
├── encoder-epoch-99-avg-1-chunk-16-left-64.int8.onnx # 速度优先
|
|
||||||
├── encoder-epoch-99-avg-1-chunk-16-left-64.onnx # 精度优先
|
|
||||||
├── decoder-epoch-12-avg-2-chunk-16-left-64.onnx
|
|
||||||
├── decoder-epoch-99-avg-1-chunk-16-left-64.onnx # 精度优先
|
|
||||||
├── joiner-epoch-12-avg-2-chunk-16-left-64.int8.onnx # 速度优先
|
|
||||||
├── joiner-epoch-12-avg-2-chunk-16-left-64.onnx
|
|
||||||
├── joiner-epoch-99-avg-1-chunk-16-left-64.int8.onnx # 速度优先
|
|
||||||
├── joiner-epoch-99-avg-1-chunk-16-left-64.onnx # 精度优先
|
|
||||||
├── tokens.txt # Token映射表(必需)
|
|
||||||
├── keywords_raw.txt # 模型包里可能附带(可选,runtime 不依赖)
|
|
||||||
├── keywords.txt # 现成的
|
|
||||||
├── test_wavs/ # 测试音频(可选)
|
|
||||||
├── configuration.json # 模型元信息(可选)
|
|
||||||
└── README.md # 说明文档(可选)
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 3. 选择配置方案
|
|
||||||
|
|
||||||
**方案一:精度优先(推荐)**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
|
|
||||||
|
|
||||||
# 创建模型目录
|
|
||||||
mkdir -p ../models
|
|
||||||
|
|
||||||
# 复制精度优先的epoch-99 fp32三件套
|
|
||||||
cp encoder-epoch-99-avg-1-chunk-16-left-64.onnx ../models/encoder.onnx
|
|
||||||
cp decoder-epoch-99-avg-1-chunk-16-left-64.onnx ../models/decoder.onnx
|
|
||||||
cp joiner-epoch-99-avg-1-chunk-16-left-64.onnx ../models/joiner.onnx
|
|
||||||
|
|
||||||
# 复制配套文件
|
|
||||||
cp tokens.txt ../models/tokens.txt
|
|
||||||
# keywords_raw.txt 如果模型包里附带,可自行保留;runtime 不依赖它
|
|
||||||
```
|
|
||||||
|
|
||||||
**方案二:速度优先**
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd sherpa-onnx-kws-zipformer-wenetspeech-3.3M-2024-01-01
|
|
||||||
|
|
||||||
# 创建模型目录
|
|
||||||
mkdir -p ../models
|
|
||||||
|
|
||||||
# 复制速度优先的epoch-99 int8三件套
|
|
||||||
cp encoder-epoch-99-avg-1-chunk-16-left-64.int8.onnx ../models/encoder.onnx
|
|
||||||
cp decoder-epoch-99-avg-1-chunk-16-left-64.onnx ../models/decoder.onnx
|
|
||||||
cp joiner-epoch-99-avg-1-chunk-16-left-64.int8.onnx ../models/joiner.onnx
|
|
||||||
|
|
||||||
# 复制配套文件
|
|
||||||
cp tokens.txt ../models/tokens.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
**注意事项**:
|
|
||||||
|
|
||||||
- **不要混用 fp32 与 int8**:三个模型文件必须保持一致的精度
|
|
||||||
- **优先选择 epoch-99**:比 epoch-12 训练更充分,精度更高
|
|
||||||
- **必需文件**:`encoder.onnx` + `decoder.onnx` + `joiner.onnx` + `tokens.txt` + `keywords.txt`
|
|
||||||
|
|
||||||
### 最终模型文件结构
|
|
||||||
|
|
||||||
配置完成后,模型文件应放在 `wakeword_runtime/models/` 目录下,完整路径为 `main/digital-human/wakeword_runtime/models/`:
|
|
||||||
|
|
||||||
```
|
|
||||||
wakeword_runtime/models/
|
|
||||||
├── encoder.onnx # 编码器模型(重命名后)
|
|
||||||
├── decoder.onnx # 解码器模型(重命名后)
|
|
||||||
├── joiner.onnx # 连接器模型(重命名后)
|
|
||||||
├── tokens.txt # 拼音 Token 映射表(228行版本)
|
|
||||||
├── keywords.txt # 关键词配置文件(首次启动自动生成)
|
|
||||||
└── keywords_raw.txt # 可选,runtime 不依赖
|
|
||||||
```
|
|
||||||
|
|
||||||
## 启动方式
|
|
||||||
|
|
||||||
在 `main/digital-human` 目录执行:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install -r wakeword_runtime/requirements.txt
|
|
||||||
python start.py
|
|
||||||
```
|
|
||||||
|
|
||||||
启动后默认地址:
|
|
||||||
|
|
||||||
- 页面地址:`http://127.0.0.1:8006/index.html`
|
|
||||||
- 事件桥地址:`ws://127.0.0.1:8006/wakeword-ws`
|
|
||||||
- 健康检查:`http://127.0.0.1:8006/health`
|
|
||||||
|
|
||||||
停止方式:
|
|
||||||
|
|
||||||
- 在运行终端按 `Ctrl+C`
|
|
||||||
- 会同时停止静态页面服务、事件桥和唤醒词检测流程
|
|
||||||
|
|
||||||
## 配置文件说明
|
|
||||||
|
|
||||||
配置文件位于 [main/digital-human/wakeword_runtime/config.json](../main/digital-human/wakeword_runtime/config.json)。
|
|
||||||
|
|
||||||
当前主要配置项:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"wakeword": {
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"model_dir": "models",
|
|
||||||
"audio": {
|
|
||||||
"input_device": null,
|
|
||||||
"sample_rate": 16000,
|
|
||||||
"channels": 1
|
|
||||||
},
|
|
||||||
"detector": {
|
|
||||||
"num_threads": 4,
|
|
||||||
"provider": "cpu",
|
|
||||||
"max_active_paths": 2,
|
|
||||||
"keywords_score": 1.8,
|
|
||||||
"keywords_threshold": 0.1,
|
|
||||||
"num_trailing_blanks": 1,
|
|
||||||
"cooldown_seconds": 1.5
|
|
||||||
},
|
|
||||||
"logging": {
|
|
||||||
"level": "INFO",
|
|
||||||
"dir": "logs",
|
|
||||||
"file": "wakeword-runtime.log"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
各字段含义:
|
|
||||||
|
|
||||||
| 参数 | 说明 |
|
|
||||||
| --- | --- |
|
|
||||||
| `wakeword.enabled` | 是否启用本地唤醒词检测 |
|
|
||||||
| `model_dir` | 模型和词表所在目录 |
|
|
||||||
| `audio.input_device` | 麦克风输入设备,默认使用系统默认设备 |
|
|
||||||
| `audio.sample_rate` | 采样率,默认 `16000` |
|
|
||||||
| `audio.channels` | 声道数,默认 `1` |
|
|
||||||
| `detector.num_threads` | 检测器线程数 |
|
|
||||||
| `detector.provider` | 推理 provider,当前通常为 `cpu` |
|
|
||||||
| `detector.max_active_paths` | 搜索路径数 |
|
|
||||||
| `detector.keywords_score` | 关键词增强分数 |
|
|
||||||
| `detector.keywords_threshold` | 检测阈值 |
|
|
||||||
| `detector.num_trailing_blanks` | 尾随空白数量 |
|
|
||||||
| `detector.cooldown_seconds` | 连续触发冷却时间 |
|
|
||||||
| `logging.level` | 日志等级 |
|
|
||||||
| `logging.dir` | 日志目录 |
|
|
||||||
| `logging.file` | 日志文件名 |
|
|
||||||
|
|
||||||
## 推荐使用流程
|
|
||||||
|
|
||||||
### 首次使用
|
|
||||||
|
|
||||||
1. 准备 `models/` 目录下的模型文件和 `tokens.txt`
|
|
||||||
2. 确认 `models/keywords.txt` 存在
|
|
||||||
3. 在 `digital-human` 目录运行 `python start.py`
|
|
||||||
4. 浏览器打开 `http://127.0.0.1:8006/index.html`
|
|
||||||
5. 进入设置页检查“唤醒词”配置
|
|
||||||
|
|
||||||
### 修改唤醒词
|
|
||||||
|
|
||||||
1. 打开数字人页面设置
|
|
||||||
2. 切到“唤醒词”页签
|
|
||||||
3. 修改启用状态或唤醒词列表
|
|
||||||
4. 点击“应用唤醒词”
|
|
||||||
5. 根据提示决定是否立即重启
|
|
||||||
|
|
||||||
### 禁用唤醒词
|
|
||||||
|
|
||||||
1. 将“启用本地唤醒词”改成禁用
|
|
||||||
2. 点击“应用唤醒词”
|
|
||||||
3. 建议立即重启一次
|
|
||||||
|
|
||||||
禁用后:
|
|
||||||
|
|
||||||
- 页面与事件桥仍然可用
|
|
||||||
- 唤醒词检测不会继续运行
|
|
||||||
|
|
@ -1,74 +1,21 @@
|
||||||
# 本地编译docker镜像方法
|
# 本地编译docker镜像方法
|
||||||
|
|
||||||
现在本项目已经使用`github`的`自动编译docker镜像`功能,如果您拉取的是项目发行的镜像,您没有自己编译镜像的需求,那就忽略本文档。
|
现在本项目已经使用github自动编译docker功能,本文档是提供给有本地编译docker镜像需求的朋友准备的。
|
||||||
|
|
||||||
如果您修改了源码,然后想采用`docker`的方式部署运行,可以参照以下步骤操作:
|
1、安装docker
|
||||||
|
```
|
||||||
## 1、环境准备
|
|
||||||
|
|
||||||
安装docker:
|
|
||||||
```bash
|
|
||||||
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
|
||||||
```
|
```
|
||||||
|
2、编译docker镜像
|
||||||
## 2、编译镜像
|
|
||||||
|
|
||||||
当你修改好代码后,需要编译新的镜像时,需要按照以下步骤操作:
|
|
||||||
|
|
||||||
准备好你的`你的用户名`和`新的版本号`。
|
|
||||||
- 这个`你的用户名`是你在`docker hub`注册的用户名,例如`xiaozhi`。当然,如果你不需要推送到`docker hub`,你可以自由定义。
|
|
||||||
- 这个`新的版本号`是你编译的镜像版本,例如`1.2.3`,你可以根据需要自定义或者使用日期格式(例如`20260609`)主要是方便和现在运行的版本号做区分,同时也方便下次回忆你是什么时候构建的,不要和现在你本机运行的版本号相同。
|
|
||||||
|
|
||||||
进入`xiaozhi-esp32-server`项目根目录,编译 server 和 web 两个镜像:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd 项目根目录
|
|
||||||
|
|
||||||
# 编译server镜像
|
|
||||||
docker build -f Dockerfile-server -t 你的用户名/xiaozhi-esp32-server:新的版本号 .
|
|
||||||
|
|
||||||
# 编译web镜像
|
|
||||||
docker build -f Dockerfile-web -t 你的用户名/xiaozhi-esp32-server-web:新的版本号 .
|
|
||||||
|
|
||||||
```
|
```
|
||||||
|
#进入项目根目录
|
||||||
|
# 编译server
|
||||||
|
docker build -t xiaozhi-esp32-server:server_latest -f ./Dockerfile-server .
|
||||||
|
# 编译web
|
||||||
|
docker build -t xiaozhi-esp32-server:web_latest -f ./Dockerfile-web .
|
||||||
|
|
||||||
## 3、修改docker-compose配置
|
# 编译完成后,可以使用docker-compose启动项目
|
||||||
|
# docker-compose.yml你需要修改成自己编译的镜像版本
|
||||||
```bash
|
|
||||||
cd main/xiaozhi-server
|
cd main/xiaozhi-server
|
||||||
```
|
docker compose up -d
|
||||||
|
|
||||||
编辑 `docker-compose_all.yml` 文件,将镜像版本替换为你刚才编译的版本:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
services:
|
|
||||||
xiaozhi-esp32-server:
|
|
||||||
image: 你的用户名/xiaozhi-esp32-server:新的版本号 # 修改为你的镜像地址
|
|
||||||
...
|
|
||||||
|
|
||||||
xiaozhi-esp32-server-web:
|
|
||||||
image: 你的用户名/xiaozhi-esp32-server-web:新的版本号 #修改为你的镜像地址
|
|
||||||
...
|
|
||||||
```
|
|
||||||
|
|
||||||
## 4、重启服务
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 停止旧容器
|
|
||||||
docker compose -f docker-compose_all.yml down
|
|
||||||
|
|
||||||
# 启动新容器
|
|
||||||
docker compose -f docker-compose_all.yml up -d
|
|
||||||
```
|
|
||||||
|
|
||||||
## 5、验证
|
|
||||||
|
|
||||||
查看日志确认服务启动正常:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
# 查看server日志
|
|
||||||
docker logs -f -n 50 xiaozhi-esp32-server
|
|
||||||
|
|
||||||
# 查看web日志
|
|
||||||
docker logs -f -n 50 xiaozhi-esp32-server-web
|
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ http://192.168.1.25:8003/xiaozhi/ota/
|
||||||
```
|
```
|
||||||
如果显示“OTA接口运行正常,向设备发送的websocket地址是:ws://xxx:8000/xiaozhi/v1/
|
如果显示“OTA接口运行正常,向设备发送的websocket地址是:ws://xxx:8000/xiaozhi/v1/
|
||||||
|
|
||||||
你可以启动`digital-human`模块后打开`index.html`测试一下,是否能连上ota页面输出的websocket地址。
|
你可以使用项目自带的`test_page.html`测试一下,是否能连上ota页面输出的websocket地址。
|
||||||
|
|
||||||
如果访问不到,你需要到配置文件`.config.yaml`里修改`server.websocket`的地址,重启后再重新测试,直到`index.html`能正常访问。
|
如果访问不到,你需要到配置文件`.config.yaml`里修改`server.websocket`的地址,重启后再重新测试,直到`test_page.html`能正常访问。
|
||||||
|
|
||||||
成功后,请往下进行第2步
|
成功后,请往下进行第2步
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ python download_models.py
|
||||||
python -m tools.api_server --listen 0.0.0.0:6006
|
python -m tools.api_server --listen 0.0.0.0:6006
|
||||||
```
|
```
|
||||||
|
|
||||||
然后用浏览器去到autodl实例页面
|
然后用浏览器去到aotodl实例页面
|
||||||
```
|
```
|
||||||
https://autodl.com/console/instance/list
|
https://autodl.com/console/instance/list
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ http://homeassistant.local:8123
|
||||||
|
|
||||||
然后在实体中搜索你相关控制的开关,结果出来后,在列表中,点击其中一个结果,这是会出现一个开关的界面。
|
然后在实体中搜索你相关控制的开关,结果出来后,在列表中,点击其中一个结果,这是会出现一个开关的界面。
|
||||||
|
|
||||||
在开关的界面,我们尝试点击开关,看看是否会随着我们的点击开/关。如果能操作,说明是正常联网的。
|
在开关的界面,我们尝试点击开关,看看是开发会随着我们的点击开/关。如果能操作,说明是正常联网的。
|
||||||
|
|
||||||
接着在开关面板找到设置按钮,点击后,可以查看这个开关的`实体标识符`。
|
接着在开关面板找到设置按钮,点击后,可以查看这个开关的`实体标识符`。
|
||||||
|
|
||||||
|
|
@ -107,7 +107,7 @@ http://homeassistant.local:8123
|
||||||
|
|
||||||
保存成功后,即可唤醒设备操作。
|
保存成功后,即可唤醒设备操作。
|
||||||
|
|
||||||
#### 3. 唤醒设备进行控制
|
#### 3. 唤醒设别进行控制
|
||||||
|
|
||||||
尝试和esp32说,“打开XXX灯”
|
尝试和esp32说,“打开XXX灯”
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@
|
||||||
本教程分为4个阶段:准备阶段、配置阶段、克隆阶段、使用阶段。主要是介绍通过智控台配置火山双流式语音合成+音色克隆的过程。
|
本教程分为4个阶段:准备阶段、配置阶段、克隆阶段、使用阶段。主要是介绍通过智控台配置火山双流式语音合成+音色克隆的过程。
|
||||||
|
|
||||||
## 第一阶段:准备阶段
|
## 第一阶段:准备阶段
|
||||||
超级管理员先预先把火山引擎服务开通好,获取到App Id,Access Token。默认火山引擎会赠送一个音色资源。这个音色资源需要把它复制到本项目里。
|
超级管理员先预先把火山引擎服务开通好,获取到App Id,Access Token。默认火上引擎会赠送一个音色资源。这个音色资源需要把它复制到本项目里。
|
||||||
|
|
||||||
如果你想克隆多个音色,需要购买开通多个音色资源。只要把每个音色资源的声音ID(S_xxxxx)复制到本项目。然后分配给系统的账号使用即可。以下是详细步骤:
|
如果你想克隆多个音色,需要购买开通多个音色资源。只要把每个音色资源的声音ID(S_xxxxx)复制到本项目。然后分配给系统的账号使用即可。以下是详细步骤:
|
||||||
|
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 152 KiB After Width: | Height: | Size: 289 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 325 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 108 KiB After Width: | Height: | Size: 280 KiB |
|
|
@ -118,7 +118,7 @@ mcp_endpoint: ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=def
|
||||||
250705[__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
250705[__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
||||||
250705[__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/
|
250705[__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/
|
||||||
250705[__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
250705[__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
250705[__main__]-INFO-如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
250705[__main__]-INFO-如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
250705[__main__]-INFO-=============================================================
|
250705[__main__]-INFO-=============================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@
|
||||||
250705[__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
250705[__main__]-INFO-mcp接入点是 ws://192.168.1.25:8004/mcp_endpoint/mcp/?token=abc
|
||||||
250705[__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/
|
250705[__main__]-INFO-Websocket地址是 ws://192.168.1.25:8000/xiaozhi/v1/
|
||||||
250705[__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
250705[__main__]-INFO-=======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
250705[__main__]-INFO-如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
250705[__main__]-INFO-如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
250705[__main__]-INFO-=============================================================
|
250705[__main__]-INFO-=============================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
打开完,找到页面中一个绿色的按钮,写着`Code`的按钮,点开它,然后你就看到`Download ZIP`的按钮。
|
打开完,找到页面中一个绿色的按钮,写着`Code`的按钮,点开它,然后你就看到`Download ZIP`的按钮。
|
||||||
|
|
||||||
点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`mcp-calculator-main`
|
点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`mcp-calculatorr-main`
|
||||||
你需要把它重命名成`mcp-calculator`。接下来,我们用命令行进入项目目录即安装依赖
|
你需要把它重命名成`mcp-calculator`。接下来,我们用命令行进入项目目录即安装依赖
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ docker restart xiaozhi-esp32-server
|
||||||
2025-06-01 **** - 视觉分析接口是 http://192.168.4.7:8003/mcp/vision/explain
|
2025-06-01 **** - 视觉分析接口是 http://192.168.4.7:8003/mcp/vision/explain
|
||||||
2025-06-01 **** - Websocket地址是 ws://192.168.4.7:8000/xiaozhi/v1/
|
2025-06-01 **** - Websocket地址是 ws://192.168.4.7:8000/xiaozhi/v1/
|
||||||
2025-06-01 **** - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
2025-06-01 **** - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
2025-06-01 **** - 如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
2025-06-01 **** - 如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
2025-06-01 **** - =============================================================
|
2025-06-01 **** - =============================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -113,7 +113,7 @@ server:
|
||||||
|
|
||||||
那我们需要先登录[智谱AI](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)网站,申请密钥。如果你之前已经申请过了密钥,可以复用这个密钥。
|
那我们需要先登录[智谱AI](https://bigmodel.cn/usercenter/proj-mgmt/apikeys)网站,申请密钥。如果你之前已经申请过了密钥,可以复用这个密钥。
|
||||||
|
|
||||||
登录`智控台`,顶部菜单点击`模型配置`,在左侧栏点击`视觉大语言模型`,找到`VLLM_ChatGLMVLLM`,点击修改按钮,在弹框中,在`API密钥`输入你密钥,点击保存。
|
登录`智控台`,顶部菜单点击`模型配置`,在左侧栏点击`视觉打语言模型`,找到`VLLM_ChatGLMVLLM`,点击修改按钮,在弹框中,在`API密钥`输入你密钥,点击保存。
|
||||||
|
|
||||||
保存成功后,去到你需要测试的智能体哪里,点击`配置角色`,在打开的内容里,查看`视觉大语言模型(VLLM)`是否选择了刚才的视觉模型。点击保存。
|
保存成功后,去到你需要测试的智能体哪里,点击`配置角色`,在打开的内容里,查看`视觉大语言模型(VLLM)`是否选择了刚才的视觉模型。点击保存。
|
||||||
|
|
||||||
|
|
@ -133,7 +133,7 @@ docker restart xiaozhi-esp32-server
|
||||||
2025-06-01 **** - 视觉分析接口是 http://192.168.4.7:8003/mcp/vision/explain
|
2025-06-01 **** - 视觉分析接口是 http://192.168.4.7:8003/mcp/vision/explain
|
||||||
2025-06-01 **** - Websocket地址是 ws://192.168.4.7:8000/xiaozhi/v1/
|
2025-06-01 **** - Websocket地址是 ws://192.168.4.7:8000/xiaozhi/v1/
|
||||||
2025-06-01 **** - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
2025-06-01 **** - =======上面的地址是websocket协议地址,请勿用浏览器访问=======
|
||||||
2025-06-01 **** - 如想测试websocket请启动digital-human模块,打开浏览器交互测试
|
2025-06-01 **** - 如想测试websocket请用谷歌浏览器打开test目录下的test_page.html
|
||||||
2025-06-01 **** - =============================================================
|
2025-06-01 **** - =============================================================
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ SERVER_SECRET=Te1st12134 # 服务器密钥,请保持和智控台(server.sec
|
||||||
- 注意不要用简单的密码,比如`123456`、`test`等。
|
- 注意不要用简单的密码,比如`123456`、`test`等。
|
||||||
- 注意不要用简单的密码,比如`123456`、`test`等。
|
- 注意不要用简单的密码,比如`123456`、`test`等。
|
||||||
|
|
||||||
`SERVER_SECRET` 是用于生成websocket连接的认证信息。
|
`SERVER_SECRET` 是用生成websocket连接的认证信息。
|
||||||
|
|
||||||
1、如果你是全模块部署,且你的智控台的参数管理里`server.auth.enabled`设置成了`true`,那么,`SERVER_SECRET`需要和智控台(`server.secret`)保持一致。
|
1、如果你是全模块部署,且你的智控台的参数管理里`server.auth.enabled`设置成了`true`,那么,`SERVER_SECRET`需要和智控台(`server.secret`)保持一致。
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -50,11 +50,10 @@ paddlespeech tts --input "你好,这是一次测试"
|
||||||
|
|
||||||
### 7.修改tts_online_application.yaml配置
|
### 7.修改tts_online_application.yaml配置
|
||||||
参考目录 ```"PaddleSpeech\demos\streaming_tts_server\conf\tts_online_application.yaml"```
|
参考目录 ```"PaddleSpeech\demos\streaming_tts_server\conf\tts_online_application.yaml"```
|
||||||
Linux / WSL 2 用正斜杠写法:```"PaddleSpeech/demos/streaming_tts_server/conf/tts_online_application.yaml"```
|
|
||||||
选择```tts_online_application.yaml```文件用编辑器打开,设置```protocol```为```websocket```
|
选择```tts_online_application.yaml```文件用编辑器打开,设置```protocol```为```websocket```
|
||||||
|
|
||||||
### 8.启动服务
|
### 8.启动服务
|
||||||
```bash
|
```yaml
|
||||||
paddlespeech_server start --config_file ./demos/streaming_tts_server/conf/tts_online_application.yaml
|
paddlespeech_server start --config_file ./demos/streaming_tts_server/conf/tts_online_application.yaml
|
||||||
#官方默认启动命令:
|
#官方默认启动命令:
|
||||||
paddlespeech_server start --config_file ./conf/tts_online_application.yaml
|
paddlespeech_server start --config_file ./conf/tts_online_application.yaml
|
||||||
|
|
@ -69,19 +68,10 @@ INFO: Application startup complete.
|
||||||
INFO: Uvicorn running on http://0.0.0.0:8092 (Press CTRL+C to quit)
|
INFO: Uvicorn running on http://0.0.0.0:8092 (Press CTRL+C to quit)
|
||||||
```
|
```
|
||||||
|
|
||||||
## 三、配置小智服务
|
## 三、修改小智的配置文件
|
||||||
### 1. 无需修改代码(provider 已内置于 main/xiaozhi-server/core/providers/tts/paddle_speech.py)
|
### 1.```main/xiaozhi-server/core/providers/tts/paddle_speech.py```
|
||||||
|
|
||||||
### 2.新建 `main/xiaozhi-server/data/.config.yaml`
|
|
||||||
|
|
||||||
`main/xiaozhi-server/data/` 目录不在仓库里,是被 `.gitignore` 忽略掉的,所以第一次用要先把它建出来,再在里面新建 `.config.yaml` 文件(在仓库根目录执行,上面的 `cd PaddleSpeech` 之后当前目录还停在 PaddleSpeech 源码目录里):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p main/xiaozhi-server/data
|
|
||||||
```
|
|
||||||
|
|
||||||
这个文件是必需的,少了它小智服务起不来,会直接报错退出。
|
|
||||||
|
|
||||||
|
### 2.```main/xiaozhi-server/data/.config.yaml```
|
||||||
使用单模块部署
|
使用单模块部署
|
||||||
```yaml
|
```yaml
|
||||||
selected_module:
|
selected_module:
|
||||||
|
|
@ -89,41 +79,19 @@ selected_module:
|
||||||
TTS:
|
TTS:
|
||||||
PaddleSpeechTTS:
|
PaddleSpeechTTS:
|
||||||
type: paddle_speech
|
type: paddle_speech
|
||||||
protocol: websocket # 当前仅支持 websocket
|
protocol: websocket
|
||||||
url: ws://127.0.0.1:8092/paddlespeech/tts/streaming # TTS 服务的 URL 地址,指向本地服务器 [websocket默认ws://127.0.0.1:8092/paddlespeech/tts/streaming]
|
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 通常表示默认的发音人
|
spk_id: 0 # 发音人 ID,0 通常表示默认的发音人
|
||||||
|
sample_rate: 24000 # 采样率 [websocket默认24000,http默认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 表示减小
|
||||||
save_path: # 保存路径
|
save_path: # 保存路径
|
||||||
```
|
```
|
||||||
采样率固定 24000,provider 内部写死,配置里不用写这一项。
|
|
||||||
|
|
||||||
### 3.启动xiaozhi服务
|
### 3.启动xiaozhi服务
|
||||||
|
```py
|
||||||
小智服务用**另一个** Python 环境,不要用前面给 PaddleSpeech 建的 `paddle_env` —— 那个环境里装的是 PaddleSpeech 自己那套依赖,版本由它决定,跟本项目锁定的版本不一定一致(`paddlespeech` 对 numpy 没写版本上限,装进去的 numpy 未必是本项目要的那个)。本项目推荐的 Python 版本和依赖版本写在 `main/xiaozhi-server/requirements.txt` 里(文件开头写着推荐 python3.10,另外锁了 torch 2.2.2、numpy 1.26.4)。
|
|
||||||
|
|
||||||
先建环境、装依赖(在仓库根目录执行):
|
|
||||||
```bash
|
|
||||||
conda create -n xiaozhi-esp32-server python=3.10 -y
|
|
||||||
conda activate xiaozhi-esp32-server
|
|
||||||
cd main/xiaozhi-server
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
然后在 `main/xiaozhi-server` 目录下启动(目录不能换:provider 是按相对路径 `core/providers/tts/` 找的,见 `core/utils/tts.py:35`):
|
|
||||||
```bash
|
|
||||||
# 上一段已经 cd 到 main/xiaozhi-server 了,这段不用再 cd
|
|
||||||
# 如果是另开的新终端,先 cd main/xiaozhi-server 再执行
|
|
||||||
python app.py
|
python app.py
|
||||||
```
|
```
|
||||||
|
打开test目录下的test_page.html,测试连接和发送消息时paddlespeech端是否有输出日志
|
||||||
要验证语音合成的实际输出,另开一个终端,在仓库根目录下跑数字人页面(这套代码另有一份依赖清单,在 `main/digital-human/wakeword_runtime/requirements.txt` 里,缺了会报缺包;唤醒词那部分还要 numpy —— `core/detector.py:7` 和 `core/microphone.py:4` 在模块顶层就 import numpy,用上面建的 `xiaozhi-esp32-server` 跑的话 numpy 已经在里面,不会有这个问题):
|
|
||||||
```bash
|
|
||||||
cd main/digital-human
|
|
||||||
python start.py
|
|
||||||
```
|
|
||||||
|
|
||||||
打开`http://127.0.0.1:8006/index.html`,测试连接和发送消息时paddlespeech端是否有输出日志
|
|
||||||
|
|
||||||
输出日志参考:
|
输出日志参考:
|
||||||
```
|
```
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,8 @@
|
||||||
# 语音识别、流式语音识别、大语言模型、非流式语音合成、流式语音合成、视觉模型的性能测试工具使用指南
|
# 语音识别、大语言模型、非流式语音合成、流式语音合成、视觉模型的性能测试工具使用指南
|
||||||
|
|
||||||
0.先装依赖(在仓库根目录执行)
|
|
||||||
```
|
|
||||||
cd main/xiaozhi-server
|
|
||||||
pip install -r requirements.txt
|
|
||||||
```
|
|
||||||
测试脚本要 import `yaml`、`aiohttp`、`tabulate`,少一个都起不来。`tabulate` 不在 requirements.txt 里,是 `edge-tts` 间接带进来的。
|
|
||||||
|
|
||||||
1.在main/xiaozhi-server目录下创建data目录
|
1.在main/xiaozhi-server目录下创建data目录
|
||||||
2.在data目录下创建.config.yaml文件
|
2.在data目录下创建.config.yaml文件
|
||||||
3.在data/.config.yaml中,写入你的语音识别、流式语音识别、大语言模型、非流式语音合成、流式语音合成、视觉模型的参数
|
3.在.data/config.yaml中,写入你的语音识别、大语言模型、流式语音合成、视觉模型的参数
|
||||||
例如:
|
例如:
|
||||||
```
|
```
|
||||||
LLM:
|
LLM:
|
||||||
|
|
@ -23,50 +16,12 @@ LLM:
|
||||||
api_key: 你的chat-glm web key
|
api_key: 你的chat-glm web key
|
||||||
|
|
||||||
TTS:
|
TTS:
|
||||||
EdgeTTS:
|
|
||||||
# 定义TTS API类型
|
|
||||||
type: edge
|
|
||||||
voice: zh-CN-XiaoxiaoNeural
|
|
||||||
|
|
||||||
VLLM:
|
VLLM:
|
||||||
ChatGLMVLLM:
|
|
||||||
# 定义视觉模型API类型
|
|
||||||
type: openai
|
|
||||||
# glm-4v-flash 是智谱的视觉模型,需要在智谱平台申请api_key
|
|
||||||
model_name: glm-4v-flash
|
|
||||||
url: https://open.bigmodel.cn/api/paas/v4/
|
|
||||||
api_key: 你的api_key
|
|
||||||
|
|
||||||
ASR:
|
ASR:
|
||||||
FunASR:
|
|
||||||
type: fun_local
|
|
||||||
model_dir: models/SenseVoiceSmall
|
|
||||||
language: auto
|
|
||||||
```
|
```
|
||||||
4.在main/xiaozhi-server目录下运行performance_tester.py:
|
4.在main/xiaozhi-server目录下运行performance_tester.py:
|
||||||
```
|
```
|
||||||
python performance_tester.py
|
python performance_tester.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## 几点说明
|
|
||||||
|
|
||||||
- 脚本第一行提示的 `docs/performance_tester.md` 就是本文档,它在仓库根目录的 `docs/` 下;脚本本身在 `main/xiaozhi-server/` 目录里跑,两处不是一个目录。
|
|
||||||
- LLM、VLLM、非流式语音合成这三项会把 `config.yaml` 和 `data/.config.yaml` 两份配置合并起来再遍历,所以实际会测**所有配好 api_key 的供应器**,不只是你在 `.config.yaml` 里写的那一个;api_key 还是占位符的会被跳过。
|
|
||||||
- 非流式的语音识别这一项读配置的方式和别的不一样:它自己扫 `data/` 目录下的 `*.config.yaml`,只取其中的 `ASR` 段,**不会**用 `config.yaml` 里的默认值。想测语音识别,就得把供应器写进 `data/.config.yaml`。
|
|
||||||
- 流式语音识别读的是合并后的配置,固定测 `DoubaoStreamASR`、`Qwen3ASRFlash`、`XunfeiStreamASR` 这三家。`config.yaml` 里这三项带的 key 是占位符,要在 `data/.config.yaml` 的 `ASR` 段里填上自己的 key 才会测出延迟。
|
|
||||||
- 视觉模型的配置写在 `data/.config.yaml` 的 `VLLM:` 段里,这段**不能只写一个空键**:写空的话合并后整段是空的,这项测试会直接跳过、什么都不测。
|
|
||||||
- 流式语音合成一次会跑这些供应器:
|
|
||||||
|
|
||||||
| 供应器 | 说明 |
|
|
||||||
|---|---|
|
|
||||||
| `AliyunStreamTTS` | 阿里云流式 TTS,无条件调用 |
|
|
||||||
| `HuoshanDoubleStreamTTS` | 火山引擎流式 TTS,无条件调用 |
|
|
||||||
| `PaddleSpeechTTS` | PaddleSpeech 流式 TTS,无条件调用 |
|
|
||||||
| `IndexStreamTTS` | IndexStream 流式 TTS,无条件调用 |
|
|
||||||
| `LinkeraiTTS` | `config.yaml` 的 TTS 段里没有这个供应器,默认不测、整项跳过;要测得自己在 `.config.yaml` 里补上 |
|
|
||||||
| `AliBLTTS` | 阿里百炼流式 TTS,默认就会测:判断读的是合并后的配置,`config.yaml` 里本来就带着这一项 |
|
|
||||||
| `XunFeiTTS` | 讯飞流式 TTS,同上,默认就会测 |
|
|
||||||
|
|
||||||
`AliBLTTS` 和 `XunFeiTTS` 这两项默认带的 key 是占位符,不在 `.config.yaml` 里换成自己的 key 就会报失败;想直接跳过,把这两项在 `.config.yaml` 里写成空的(键名下面不填内容)就行。
|
|
||||||
|
|
||||||
标了「无条件调用」的这几个(`AliyunStreamTTS`、`HuoshanDoubleStreamTTS`、`PaddleSpeechTTS`、`IndexStreamTTS`),供应器缺失或被清空时,那一项会报错,错误被测试方法内部的异常处理吃掉,这一项被记成失败 —— 结果表里会多出一行失败记录,但不影响其它项。带守卫的那几家(`AliBLTTS`、`XunFeiTTS`、`LinkeraiTTS`)是整项跳过:没配就不报错、结果表里也不会有这一行。
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
# ragflow 集成指南
|
# ragflow 集成指南
|
||||||
|
|
||||||
本教程主要是两部分
|
本教程主要是是两部分
|
||||||
|
|
||||||
- 一、如何部署ragflow
|
- 一、如何部署ragflow
|
||||||
- 二、如何在智控台配置ragflow接口
|
- 二、如何在智控台配置ragflow接口
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
ragflow需要依赖`mysql`数据库。如果你之前已经部署`智控台`,说明你已经安装了`mysql`。你可以共用它。
|
ragflow需要依赖`mysql`数据库。如果你之前已经部署`智控台`,说明你已经安装了`mysql`。你可以共用它。
|
||||||
|
|
||||||
你可以试一下在宿主机使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
你可以你试一下在宿主机使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
||||||
``` shell
|
``` shell
|
||||||
telnet 127.0.0.1 3306
|
telnet 127.0.0.1 3306
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,364 +0,0 @@
|
||||||
[](https://github.com/xinnan-tech/xiaozhi-esp32-server)
|
|
||||||
|
|
||||||
<h1 align="center">Servicio backend Xiaozhi xiaozhi-esp32-server</h1>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
Este proyecto desarrolla sistemas de hardware y software para terminales inteligentes a partir de la teoría y la tecnología de la inteligencia simbiótica humano-máquina<br/>y ofrece el servicio backend del proyecto de hardware inteligente de código abierto
|
|
||||||
<a href="https://github.com/78/xiaozhi-esp32">xiaozhi-esp32</a><br/>
|
|
||||||
Implementado en Python, Java y Vue según el <a href="https://ccnphfhqs21z.feishu.cn/wiki/M0XiwldO9iJwHikpXD5cEx71nKh">protocolo de comunicación Xiaozhi</a><br/>
|
|
||||||
Compatible con el protocolo MQTT+UDP, el protocolo WebSocket, puntos de acceso MCP, reconocimiento de huella de voz y bases de conocimiento
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="../FAQ.md">Preguntas frecuentes</a>
|
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/issues">Informar de problemas</a>
|
|
||||||
· <a href="../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3">Documentación de despliegue</a>
|
|
||||||
· <a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">Notas de la versión</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
<a href="../../README.md"><img alt="简体中文版自述文件" src="https://img.shields.io/badge/简体中文-DFE0E5"></a>
|
|
||||||
<a href="./README_en.md"><img alt="README in English" src="https://img.shields.io/badge/English-DFE0E5"></a>
|
|
||||||
<a href="./README_vi.md"><img alt="Tiếng Việt" src="https://img.shields.io/badge/Tiếng Việt-DFE0E5"></a>
|
|
||||||
<a href="./README_de.md"><img alt="Deutsch" src="https://img.shields.io/badge/Deutsch-DFE0E5"></a>
|
|
||||||
<a href="./README_pt_BR.md"><img alt="Português (Brasil)" src="https://img.shields.io/badge/Português (Brasil)-DFE0E5"></a>
|
|
||||||
<a href="./README_es.md"><img alt="Español" src="https://img.shields.io/badge/Español-DBEDFA"></a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/releases">
|
|
||||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/v/release/xinnan-tech/xiaozhi-esp32-server?logo=docker" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/LICENSE">
|
|
||||||
<img alt="GitHub pull requests" src="https://img.shields.io/badge/license-MIT-white?labelColor=black" />
|
|
||||||
</a>
|
|
||||||
<a href="https://github.com/xinnan-tech/xiaozhi-esp32-server">
|
|
||||||
<img alt="stars" src="https://img.shields.io/github/stars/xinnan-tech/xiaozhi-esp32-server?color=ffcb47&labelColor=black" />
|
|
||||||
</a>
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p align="center">
|
|
||||||
Liderado por el equipo del profesor Siyuan Liu (Universidad Tecnológica del Sur de China)
|
|
||||||
</br>
|
|
||||||
刘思源教授团队主导研发(华南理工大学)
|
|
||||||
</br>
|
|
||||||
<img src="../images/hnlg.jpg" alt="Universidad Tecnológica del Sur de China (华南理工大学)" width="50%">
|
|
||||||
</p>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## A quién va dirigido 👥
|
|
||||||
|
|
||||||
Este proyecto debe usarse junto con hardware ESP32. Si ya ha comprado hardware relacionado con ESP32, se ha conectado con éxito al servicio backend desplegado por Brother Xia (虾哥) y quiere montar por su cuenta su propio servicio backend `xiaozhi-esp32`, este proyecto encaja con lo que busca.
|
|
||||||
|
|
||||||
¿Quiere ver cómo se usa? Pulse los vídeos 🎥
|
|
||||||
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1FMFyejExX" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Sensación de la velocidad de respuesta" src="../images/demo9.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1vchQzaEse" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="El secreto para optimizar la velocidad" src="../images/demo6.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1WEcxzFEAT" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Humano digital Xiaozhi con activación por voz" src="../images/demo8.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1CKVz6UEuB" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Llamadas de dispositivo a dispositivo" src="../images/demo0.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1C1tCzUEZh" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Escenario médico complejo" src="../images/demo1.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1VC96Y5EMH" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Reproducir música, consultar el tiempo y leer noticias" src="../images/demo7.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV12J7WzBEaH" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Interrupción en tiempo real" src="../images/demo10.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Co76z7EvK" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Reconocer objetos con una foto" src="../images/demo12.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1pNXWYGEx1" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Controlar el encendido de electrodomésticos" src="../images/demo5.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1TJ7WzzEo6" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Tareas con varias instrucciones" src="../images/demo11.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1ZQKUzYExM" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Punto de acceso MCP" src="../images/demo13.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1zUW5zJEkq" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Envío de instrucciones MQTT" src="../images/demo4.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1Exu3zqEDe" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Reconocimiento de huella de voz" src="../images/demo14.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV1CDKWemEU6" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Tono de voz personalizado" src="../images/demo2.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
<td>
|
|
||||||
<a href="https://www.bilibili.com/video/BV12yA2egEaC" target="_blank">
|
|
||||||
<picture>
|
|
||||||
<img alt="Conversación en cantonés" src="../images/demo3.png" /></picture>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Advertencias ⚠️
|
|
||||||
|
|
||||||
1. Este proyecto es software de código abierto. Este software no mantiene relación comercial alguna con los proveedores de API de terceros a los que se conecta (incluidos, entre otros, plataformas de reconocimiento de voz, modelos de lenguaje y síntesis de voz), y no ofrece ninguna garantía sobre la calidad del servicio de dichos proveedores ni sobre la seguridad de sus fondos. Se recomienda elegir de forma preferente proveedores que cuenten con las licencias de actividad correspondientes y leer con atención sus condiciones de servicio y su política de privacidad. Este software no custodia ninguna clave de cuenta, no interviene en el movimiento de fondos y no asume el riesgo de pérdida del saldo recargado.
|
|
||||||
|
|
||||||
2. Las funciones de este proyecto no están completas y no ha superado una evaluación de seguridad de red. No lo utilice en entornos de producción. Si despliega este proyecto en una red pública con fines de aprendizaje, aplique las protecciones necesarias.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Documentación de despliegue
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
Este proyecto ofrece dos formas de despliegue. Elija según lo que necesite:
|
|
||||||
|
|
||||||
#### 🚀 Elección del método de despliegue
|
|
||||||
| Método de despliegue | Características | Escenarios | Documentación de despliegue | Requisitos | Tutoriales en vídeo |
|
|
||||||
|---------|------|---------|---------|---------|---------|
|
|
||||||
| **Instalación simplificada** | Diálogo inteligente, gestión de un solo agente | Entornos con pocos recursos; los datos se guardan en archivos de configuración y no hace falta base de datos | [①Versión Docker](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E5%8F%AA%E8%BF%90%E8%A1%8Cserver) / [②Despliegue desde el código fuente](../Deployment.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E5%8F%AA%E8%BF%90%E8%A1%8Cserver)| Ejecutar `FunASR` en local consume bastante memoria; si todo va por API, el consumo de recursos es bajo | - |
|
|
||||||
| **Instalación de todos los módulos** | Diálogo inteligente, gestión multiusuario, gestión de varios agentes, uso de la interfaz de la consola inteligente | Experiencia con todas las funciones; los datos se guardan en una base de datos |[①Versión Docker](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%B8%80docker%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [②Despliegue desde el código fuente](../Deployment_all.md#%E6%96%B9%E5%BC%8F%E4%BA%8C%E6%9C%AC%E5%9C%B0%E6%BA%90%E7%A0%81%E8%BF%90%E8%A1%8C%E5%85%A8%E6%A8%A1%E5%9D%97) / [③Tutorial de actualización automática desde el código fuente](../dev-ops-integration.md) | Ejecutar `FunASR` en local consume bastante memoria, y además requiere recursos de base de datos; si todo va por API, el consumo de recursos es bajo | [Tutorial en vídeo para arrancar el código fuente en local](https://www.bilibili.com/video/BV1wBJhz4Ewe) |
|
|
||||||
|
|
||||||
Las preguntas frecuentes y los tutoriales relacionados están en [este enlace](../FAQ.md)
|
|
||||||
|
|
||||||
> 💡 Nota: a continuación hay una plataforma de prueba desplegada con el código más reciente. Si lo necesita, puede grabar el firmware y probarla. La concurrencia es de 6 usuarios y los datos se borran cada día.
|
|
||||||
|
|
||||||
```
|
|
||||||
Dirección de la consola inteligente: https://2662r3426b.vicp.fun
|
|
||||||
Consola inteligente (versión H5): https://2662r3426b.vicp.fun/h5/index.html
|
|
||||||
|
|
||||||
Herramienta de prueba del servicio: https://2662r3426b.vicp.fun/test/
|
|
||||||
Dirección de la interfaz OTA: https://2662r3426b.vicp.fun/xiaozhi/ota/
|
|
||||||
Dirección de la interfaz WebSocket: wss://2662r3426b.vicp.fun/xiaozhi/v1/
|
|
||||||
```
|
|
||||||
|
|
||||||
#### 🚩 Descripción y recomendaciones de configuración
|
|
||||||
> [!Note]
|
|
||||||
> Este proyecto ofrece dos esquemas de configuración:
|
|
||||||
>
|
|
||||||
> 1. `Configuración básica y totalmente gratuita`: adecuada para uso personal y doméstico. Todos los componentes usan opciones gratuitas y no hay que pagar nada más.
|
|
||||||
>
|
|
||||||
> 2. `Configuración en streaming`: adecuada para demostraciones, formación y escenarios con más de 2 usuarios concurrentes. Usa procesamiento en streaming, responde antes y se siente mejor.
|
|
||||||
>
|
|
||||||
> Desde la versión `0.5.2`, el proyecto admite la configuración en streaming. Frente a las versiones anteriores, el tiempo de respuesta mejora unos `2,5 segundos` y la experiencia de uso mejora de forma notable.
|
|
||||||
|
|
||||||
| Módulo | Configuración básica y totalmente gratuita | Configuración en streaming |
|
|
||||||
|:---:|:---:|:---:|
|
|
||||||
| ASR (reconocimiento de voz) | FunASR (local) | 👍XunfeiStreamASR (iFLYTEK en streaming) |
|
|
||||||
| LLM (modelo de lenguaje) | glm-4-flash (Zhipu) | 👍qwen-flash (Alibaba Bailian) |
|
|
||||||
| VLLM (modelo de visión) | glm-4v-flash (Zhipu) | 👍qwen3.5-flash (Alibaba Bailian) |
|
|
||||||
| TTS (síntesis de voz) | EdgeTTS (Microsoft) | 👍HuoshanDoubleStreamTTS (Volcano en streaming) |
|
|
||||||
| Intent (reconocimiento de intención) | function_call (llamada a funciones) | function_call (llamada a funciones) |
|
|
||||||
| Memory (memoria) | mem_local_short (memoria local a corto plazo) | mem_local_short (memoria local a corto plazo) |
|
|
||||||
|
|
||||||
Si le importa el tiempo que tarda cada componente, consulte el [informe de rendimiento de los componentes de Xiaozhi](https://github.com/xinnan-tech/xiaozhi-performance-research) y pruebe en su propio entorno con el método que describe el informe.
|
|
||||||
|
|
||||||
#### 🔧 Herramientas de prueba
|
|
||||||
Este proyecto incluye las siguientes herramientas para comprobar el sistema y elegir un modelo adecuado:
|
|
||||||
|
|
||||||
| Herramienta | Ubicación | Uso | Qué hace |
|
|
||||||
|:---:|:---|:---:|:---:|
|
|
||||||
| Prueba de interacción de audio | main》digital-human》index.html | En `main/digital-human`, instale las dependencias como indica su README, después ejecute `python start.py` y abra `http://127.0.0.1:8006/index.html` | Prueba la reproducción y la recepción de audio, y comprueba que el procesamiento de audio en Python funciona |
|
|
||||||
| Prueba de respuesta de los modelos | main》xiaozhi-server》performance_tester.py | Ejecute `python performance_tester.py` | Mide la velocidad de respuesta de los principales módulos: ASR (reconocimiento de voz), LLM (modelo de lenguaje), VLLM (modelo de visión) y TTS (síntesis de voz) |
|
|
||||||
|
|
||||||
> 💡 Nota: al medir la velocidad de los modelos, solo se prueban los modelos que tienen una clave configurada.
|
|
||||||
|
|
||||||
---
|
|
||||||
## Lista de funciones ✨
|
|
||||||
### Implementado ✅
|
|
||||||

|
|
||||||
| Módulo | Descripción |
|
|
||||||
|:---:|:---|
|
|
||||||
| Arquitectura principal | Basada en la [pasarela MQTT+UDP](https://github.com/xinnan-tech/xiaozhi-esp32-server/blob/main/docs/mqtt-gateway-integration.md) y en servidores WebSocket y HTTP; ofrece un sistema completo de gestión de consola y de autenticación |
|
|
||||||
| Interacción por voz | Admite ASR en streaming (reconocimiento de voz), TTS en streaming (síntesis de voz) y VAD (detección de actividad de voz), además de reconocimiento multilingüe y procesamiento de voz |
|
|
||||||
| Huella de voz | Admite el registro, la gestión y el reconocimiento de la huella de voz de varios usuarios; se procesa en paralelo con el ASR, identifica en tiempo real quién habla y se lo pasa al LLM para una respuesta personalizada |
|
|
||||||
| Diálogo inteligente | Admite varios LLM (modelos de lenguaje) para mantener un diálogo inteligente |
|
|
||||||
| Percepción visual | Admite varios VLLM (modelos de visión) para una interacción multimodal |
|
|
||||||
| Reconocimiento de intención | Admite el reconocimiento de intención con un modelo de lenguaje (LLM) externo y conectable, y la llamada autónoma a funciones del modelo, y ofrece un mecanismo de procesamiento de intenciones mediante plugins |
|
|
||||||
| Sistema de memoria | Admite memoria local a corto plazo, memoria por la interfaz mem0ai y memoria inteligente PowerMem, con resumen de la memoria |
|
|
||||||
| Base de conocimiento | Admite la base de conocimiento RAGFlow, para que el modelo decida si debe consultarla antes de responder |
|
|
||||||
| Llamada a herramientas | Admite el protocolo IOT del cliente, el protocolo MCP del cliente, el protocolo MCP del servidor, el protocolo de punto de acceso MCP y funciones de herramientas personalizadas |
|
|
||||||
| Envío de instrucciones | Apoyado en el protocolo MQTT, permite enviar instrucciones MCP desde la consola inteligente a los dispositivos ESP32 |
|
|
||||||
| Backend de administración | Ofrece una interfaz web de administración, con gestión de usuarios, configuración del sistema y gestión de dispositivos. La interfaz se muestra en chino simplificado, chino tradicional, inglés, alemán, vietnamita y portugués de Brasil |
|
|
||||||
| Herramientas de prueba | Incluye herramientas de prueba de rendimiento y de interacción de audio |
|
|
||||||
| Soporte de despliegue | Admite el despliegue con Docker y el despliegue local, y ofrece una gestión completa de los archivos de configuración |
|
|
||||||
| Sistema de plugins | Admite extensiones de plugins funcionales y el desarrollo de plugins propios; los nuevos archivos de plugin se cargan automáticamente en la siguiente conexión del dispositivo, y los cambios en el código de un plugin ya cargado requieren reiniciar el servicio |
|
|
||||||
|
|
||||||
### En desarrollo 🚧
|
|
||||||
|
|
||||||
Para ver el avance concreto del plan de desarrollo, [pulse aquí](https://github.com/users/xinnan-tech/projects/3). Las preguntas frecuentes y los tutoriales relacionados están en [este enlace](../FAQ.md)
|
|
||||||
|
|
||||||
Si desarrolla software, aquí tiene una [carta abierta a quienes desarrollan](../contributor_open_letter.md). La invitación está hecha.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Ecosistema del producto 👬
|
|
||||||
Xiaozhi es un ecosistema. Al usar este producto, también puede ver otros [proyectos destacados](https://github.com/78/xiaozhi-esp32/blob/main/README_zh.md#%E7%9B%B8%E5%85%B3%E5%BC%80%E6%BA%90%E9%A1%B9%E7%9B%AE) de este ecosistema
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Plataformas y componentes compatibles 📋
|
|
||||||
### LLM, modelos de lenguaje
|
|
||||||
|
|
||||||
| Forma de uso | Plataformas compatibles | Plataformas gratuitas |
|
|
||||||
|:---:|:---:|:---:|
|
|
||||||
| Llamadas por la interfaz OpenAI | Alibaba Bailian, Volcano Engine, DeepSeek, Zhipu, Gemini, iFLYTEK, LM Studio | Zhipu, Gemini |
|
|
||||||
| Llamadas por la interfaz Ollama | Ollama | - |
|
|
||||||
| Llamadas por la interfaz Dify | Dify | - |
|
|
||||||
| Llamadas por la interfaz FastGPT | FastGPT | - |
|
|
||||||
| Llamadas por la interfaz Coze | Coze | - |
|
|
||||||
| Llamadas por la interfaz Xinference | Xinference | - |
|
|
||||||
| Llamadas por la interfaz HomeAssistant | HomeAssistant | - |
|
|
||||||
|
|
||||||
En la práctica, se puede integrar cualquier LLM que admita llamadas por la interfaz OpenAI.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### VLLM, modelos de visión
|
|
||||||
|
|
||||||
| Forma de uso | Plataformas compatibles | Plataformas gratuitas |
|
|
||||||
|:---:|:---:|:---:|
|
|
||||||
| Llamadas por la interfaz OpenAI | Alibaba Bailian, Zhipu ChatGLMVLLM, iFLYTEK | Zhipu ChatGLMVLLM |
|
|
||||||
|
|
||||||
En la práctica, se puede integrar cualquier VLLM que admita llamadas por la interfaz OpenAI.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### TTS, síntesis de voz
|
|
||||||
|
|
||||||
| Forma de uso | Plataformas compatibles | Plataformas gratuitas |
|
|
||||||
|:---:|:---:|:---:|
|
|
||||||
| Llamadas por interfaz | EdgeTTS, iFLYTEK, Volcano Engine, Tencent Cloud, Alibaba Cloud y Bailian, CosyVoiceSiliconflow, TTS302AI, CozeCnTTS, CustomTTS, OpenAITTS, MinimaxTTS | EdgeTTS, CosyVoiceSiliconflow (parcial) |
|
|
||||||
| Servicio local | FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3, IndexStreamTTS, PaddleSpeechTTS | IndexStreamTTS, PaddleSpeechTTS, FishSpeech, GPT_SOVITS_V2, GPT_SOVITS_V3 |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### VAD, detección de actividad de voz
|
|
||||||
|
|
||||||
| Tipo | Plataforma | Forma de uso | Precio | Notas |
|
|
||||||
|:---:|:---------:|:----:|:----:|:--:|
|
|
||||||
| VAD | SileroVAD | Uso local | Gratuito | |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### ASR, reconocimiento de voz
|
|
||||||
|
|
||||||
| Forma de uso | Plataformas compatibles | Plataformas gratuitas |
|
|
||||||
|:---:|:---:|:---:|
|
|
||||||
| Uso local | FunASR, SherpaASR, SherpaParaformerASR, VoskASR | FunASR, SherpaASR, SherpaParaformerASR, VoskASR |
|
|
||||||
| Llamadas por interfaz | FunASRServer, Volcano Engine, iFLYTEK, Tencent Cloud, Alibaba Cloud y Bailian, Baidu Cloud, OpenAI ASR, GroqASR, Qwen3ASRFlash | FunASRServer |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Voiceprint, huella de voz
|
|
||||||
|
|
||||||
| Forma de uso | Plataformas compatibles | Plataformas gratuitas |
|
|
||||||
|:---:|:---:|:---:|
|
|
||||||
| Llamadas por interfaz | Servicio de reconocimiento de huella de voz (voiceprint-api) | - |
|
|
||||||
|
|
||||||
El reconocimiento de huella de voz requiere desplegar por separado el servicio [voiceprint-api](https://github.com/xinnan-tech/voiceprint-api) (basado en 3D-Speaker), que depende de MySQL; consulte la [guía de integración de la huella de voz](../voiceprint-integration.md)
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Memory, almacenamiento de memoria
|
|
||||||
|
|
||||||
| Tipo | Plataforma | Forma de uso | Precio | Notas |
|
|
||||||
|:------:|:---------------:|:----:|:---------:|:--:|
|
|
||||||
| Memory | mem0ai | Llamadas por interfaz | Cuota de 1000 veces al mes | |
|
|
||||||
| Memory | [powermem](../powermem-integration.md) | Resumen local | Depende del LLM y de la base de datos | OceanBase de código abierto; admite búsqueda inteligente |
|
|
||||||
| Memory | mem_local_short | Resumen local | Gratuito | |
|
|
||||||
| Memory | nomem | Modo sin memoria | Gratuito | |
|
|
||||||
| Memory | mem_report_only | Solo informe | Gratuito | Solo informa el historial de chat, sin resumen de memoria |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Intent, reconocimiento de intención
|
|
||||||
|
|
||||||
| Tipo | Plataforma | Forma de uso | Precio | Notas |
|
|
||||||
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
|
||||||
| Intent | intent_llm | Llamadas por interfaz | Según el precio del LLM | Reconoce la intención mediante el modelo de lenguaje (LLM); gran capacidad de generalización |
|
|
||||||
| Intent | function_call | Llamadas por interfaz | Según el precio del LLM | Completa la intención con llamadas a funciones del modelo; rápido y con buen resultado |
|
|
||||||
| Intent | nointent | Modo sin intención | Gratuito | No reconoce la intención y devuelve directamente el resultado del diálogo |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
### Rag, generación aumentada por recuperación
|
|
||||||
|
|
||||||
| Tipo | Plataforma | Forma de uso | Precio | Notas |
|
|
||||||
|:------:|:-------------:|:----:|:-------:|:---------------------:|
|
|
||||||
| Rag | ragflow | Llamadas por interfaz | Cobrado según los tokens consumidos en el troceado y la segmentación | Usa la generación aumentada por recuperación de RagFlow para dar respuestas más precisas |
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## Agradecimientos 🙏
|
|
||||||
|
|
||||||
| Logo | Proyecto o empresa | Descripción |
|
|
||||||
|:---:|:---:|:---|
|
|
||||||
| <img src="../images/logo_bailing.png" width="160"> | [Robot de diálogo por voz Bailing (百聆语音对话机器人)](https://github.com/wwbin2017/bailing) | Este proyecto parte del [robot de diálogo por voz Bailing](https://github.com/wwbin2017/bailing) y se construye sobre esa base |
|
|
||||||
| <img src="../images/logo_tenclass.png" width="160"> | [Tenclass (十方融海)](https://www.tenclass.com/) | Gracias a [Tenclass](https://www.tenclass.com/) por definir el protocolo de comunicación estándar del ecosistema Xiaozhi, las soluciones de compatibilidad con varios dispositivos y los ejemplos prácticos de alta concurrencia, y por el apoyo de documentación técnica de todo el recorrido de este proyecto |
|
|
||||||
| <img src="../images/logo_xuanfeng.png" width="160"> | [Xuanfeng Technology (玄凤科技)](https://github.com/Eric0308) | Gracias a [Xuanfeng Technology](https://github.com/Eric0308) por el código del marco de llamada a funciones, del protocolo de comunicación MCP y del mecanismo de llamadas basado en plugins. Con un sistema estandarizado de despacho de instrucciones y capacidad de ampliación dinámica, mejora de forma clara la eficiencia de interacción y la extensibilidad de los dispositivos de frontend (IoT) |
|
|
||||||
| <img src="../images/logo_junsen.png" width="160"> | [huangjunsen](https://github.com/huangjunsen0406) | Gracias a [huangjunsen](https://github.com/huangjunsen0406) por el módulo `consola inteligente móvil`, que permite controlar con eficacia dispositivos móviles de varias plataformas e interactuar en tiempo real, y mejora mucho la comodidad de uso y la eficiencia de gestión en escenarios móviles |
|
|
||||||
| <img src="../images/logo_huiyuan.png" width="160"> | [Huiyuan Design (汇远设计)](http://ui.kwd988.net/) | Gracias a [Huiyuan Design](http://ui.kwd988.net/) por la solución visual de este proyecto, y por poner al servicio de la experiencia de uso la práctica de diseño acumulada con más de mil empresas |
|
|
||||||
| <img src="../images/logo_qinren.png" width="160"> | [Xi'an Qinren Information Technology (西安勤人信息科技)](https://www.029app.com/) | Gracias a [Xi'an Qinren Information Technology](https://www.029app.com/) por profundizar el sistema visual de este proyecto y mantener un estilo coherente y ampliable en distintos escenarios |
|
|
||||||
| <img src="../images/logo_contributors.png" width="160"> | [Quienes contribuyen código](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors) | Gracias a [todas las personas que contribuyen código](https://github.com/xinnan-tech/xiaozhi-esp32-server/graphs/contributors). Su trabajo hace el proyecto más sólido y más capaz. |
|
|
||||||
|
|
||||||
|
|
||||||
<a href="https://www.star-history.com/?repos=xinnan-tech%2Fxiaozhi-esp32-server&type=date&legend=top-left">
|
|
||||||
<picture>
|
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&theme=dark&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
|
||||||
<source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
|
||||||
<img alt="Star History Chart" src="https://api.star-history.com/chart?repos=xinnan-tech/xiaozhi-esp32-server&type=date&legend=top-left&sealed_token=cQovHKgZjqEnQ-svfYfN392irNvGuq-6pyv4cA8nd2jQEhQLz1ETV4YHTVk2UZyLMFbCQuZA7jduRh3YbeK5WPYaRLrfmIimGQa3lram652jJL9oQk-UuSZA5H6L4dPIhZc8KCc-Ur_UAUNbly7TePpnTR2otGknBLCOjOliD4fk1st6z7tPEDVjSRx5" />
|
|
||||||
</picture>
|
|
||||||
</a>
|
|
||||||
|
|
@ -16,11 +16,11 @@
|
||||||
点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`voiceprint-api-main`
|
点击它,下载本项目源码压缩包。下载到你电脑后,解压它,此时它的名字可能叫`voiceprint-api-main`
|
||||||
你需要把它重命名成`voiceprint-api`。
|
你需要把它重命名成`voiceprint-api`。
|
||||||
|
|
||||||
## 第二步, 确认 MySQL 能访问
|
## 第二步, 创建数据库和表
|
||||||
|
|
||||||
声纹识别需要依赖`mysql`数据库。如果你之前已经部署`智控台`,说明你已经安装了`mysql`。你可以共用它。
|
声纹识别需要依赖`mysql`数据库。如果你之前已经部署`智控台`,说明你已经安装了`mysql`。你可以共用它。
|
||||||
|
|
||||||
你可以试一下在宿主机使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
你可以你试一下在宿主机使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
||||||
```
|
```
|
||||||
telnet 127.0.0.1 3306
|
telnet 127.0.0.1 3306
|
||||||
```
|
```
|
||||||
|
|
@ -39,7 +39,7 @@ telnet 127.0.0.1 3306
|
||||||
networks:
|
networks:
|
||||||
- default
|
- default
|
||||||
expose:
|
expose:
|
||||||
- 3306
|
- "3306:3306"
|
||||||
```
|
```
|
||||||
|
|
||||||
修改后
|
修改后
|
||||||
|
|
@ -58,9 +58,8 @@ telnet 127.0.0.1 3306
|
||||||
# 进入你docker-compose_all.yml所在的文件夹,例如我的是xiaozhi-server
|
# 进入你docker-compose_all.yml所在的文件夹,例如我的是xiaozhi-server
|
||||||
cd xiaozhi-server
|
cd xiaozhi-server
|
||||||
docker compose -f docker-compose_all.yml down
|
docker compose -f docker-compose_all.yml down
|
||||||
docker compose -f docker-compose_all.yml up -d
|
docker compose -f docker-compose.yml up -d
|
||||||
```
|
```
|
||||||
数据库服务`xiaozhi-esp32-server-db`在`docker-compose_all.yml`里,最小化的`docker-compose.yml`只有服务本身,所以两条命令都用`docker-compose_all.yml`。
|
|
||||||
|
|
||||||
启动完后,在宿主机再使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
启动完后,在宿主机再使用`telnet`命令,看看能不能正常访问`mysql`的`3306`端口。
|
||||||
```
|
```
|
||||||
|
|
@ -172,8 +171,6 @@ http://192.168.1.25:8005/voiceprint/health?key=abcd
|
||||||
然后搜索参数`server.voice_print`,此时,它的值应该是`null`值。
|
然后搜索参数`server.voice_print`,此时,它的值应该是`null`值。
|
||||||
点击修改按钮,把上一步得来的`声纹接口地址`粘贴到`参数值`里。然后保存。
|
点击修改按钮,把上一步得来的`声纹接口地址`粘贴到`参数值`里。然后保存。
|
||||||
|
|
||||||
声纹识别的相似度阈值是另一个系统参数`server.voiceprint_similarity_threshold`(默认0.4,范围0.0-1.0,数值越高越严格),要调整就在同一个`参数管理`页面里改。
|
|
||||||
|
|
||||||
如果能保存成功,说明一切顺利,你可以去智能体查看效果了。如果不成功,说明智控台无法访问声纹识别,很大概率是网络防火墙,或者没有填写正确的局域网ip。
|
如果能保存成功,说明一切顺利,你可以去智能体查看效果了。如果不成功,说明智控台无法访问声纹识别,很大概率是网络防火墙,或者没有填写正确的局域网ip。
|
||||||
|
|
||||||
## 第二步 设置智能体记忆模式
|
## 第二步 设置智能体记忆模式
|
||||||
|
|
@ -189,7 +186,7 @@ http://192.168.1.25:8005/voiceprint/health?key=abcd
|
||||||
在智控台,`智能体管理`页面,在智能体的面板里,有一个`声纹识别`按钮,点击它。在底部有一个`新增按钮`。就可以对某个人说的话进行声纹注册。
|
在智控台,`智能体管理`页面,在智能体的面板里,有一个`声纹识别`按钮,点击它。在底部有一个`新增按钮`。就可以对某个人说的话进行声纹注册。
|
||||||
在弹出的框里,`描述`这个属性建议填写上,可以是这个人的职业、性格、爱好。方便智能体对说话人进行分析和了解。
|
在弹出的框里,`描述`这个属性建议填写上,可以是这个人的职业、性格、爱好。方便智能体对说话人进行分析和了解。
|
||||||
|
|
||||||
## 第五步 验证效果
|
## 第三步 和你的智能体聊天
|
||||||
|
|
||||||
将你的设备通电,问它,你知道我是谁吗?如果他能回答得出,说明声纹识别功能正常。
|
将你的设备通电,问它,你知道我是谁吗?如果他能回答得出,说明声纹识别功能正常。
|
||||||
|
|
||||||
|
|
@ -208,9 +205,6 @@ voiceprint:
|
||||||
- "test1,张三,张三是一个程序员"
|
- "test1,张三,张三是一个程序员"
|
||||||
- "test2,李四,李四是一个产品经理"
|
- "test2,李四,李四是一个产品经理"
|
||||||
- "test3,王五,王五是一个设计师"
|
- "test3,王五,王五是一个设计师"
|
||||||
# 声纹识别相似度阈值,范围0.0-1.0,默认0.4
|
|
||||||
# 数值越高越严格,减少误识别但可能增加拒识率
|
|
||||||
similarity_threshold: 0.4
|
|
||||||
```
|
```
|
||||||
|
|
||||||
把上一步得来的 `声纹接口地址` 粘贴到 `url` 里。然后保存。
|
把上一步得来的 `声纹接口地址` 粘贴到 `url` 里。然后保存。
|
||||||
|
|
|
||||||
|
|
@ -1,95 +0,0 @@
|
||||||
# 联网搜索插件使用指南
|
|
||||||
|
|
||||||
## 功能简介
|
|
||||||
|
|
||||||
联网搜索插件 `web_search` 支持在对话过程中实时联网搜索信息并返回结果。插件支持五个搜索源:秘塔(Metaso)、Tavily、Serply、Outcrawl和SpecStream,用户可根据需要选择其中一个。
|
|
||||||
|
|
||||||
## API Key申请指南
|
|
||||||
|
|
||||||
目前我们适配了`秘塔搜索`、`Tavily搜索`、`Serply搜索`、`Outcrawl搜索`和`SpecStream搜索`。
|
|
||||||
- Tavily搜索:每个月1000次免费额度。
|
|
||||||
- 秘塔搜索:拥有较为优质的国内数据源。
|
|
||||||
- Serply搜索:返回谷歌搜索结果,注册赠送2500次免费额度,额度用完后需要付费。
|
|
||||||
- Outcrawl搜索:面向AI智能体的网页搜索接口,每月1000 credits免费额度。
|
|
||||||
- SpecStream搜索:注册赠送10美元,每条结果带来源链接和摘要,有发布日期时一并返回;每1000次搜索5美元(每次最多10条结果)。
|
|
||||||
|
|
||||||
## API Key申请指南
|
|
||||||
|
|
||||||
### 方式一:使用秘塔搜索
|
|
||||||
|
|
||||||
- 访问 [秘塔搜索API](https://metaso.cn/search-api/api-keys),注册并登录账号
|
|
||||||
- 在API密钥管理页面,点击"创建新的Key"
|
|
||||||
- 复制生成的API Key(以 `mk-` 为前缀),这是配置所需的关键信息
|
|
||||||
|
|
||||||
### 方式二:使用Tavily搜索
|
|
||||||
|
|
||||||
- 访问 [Tavily控制台](https://app.tavily.com/home),注册并登录账号
|
|
||||||
- 在控制台中创建API Key
|
|
||||||
- 复制生成的API Key(以 `tvly-` 为前缀),这是配置所需的关键信息
|
|
||||||
|
|
||||||
### 方式三:使用Serply搜索
|
|
||||||
|
|
||||||
- 访问 [Serply](https://serply.io),注册并登录账号
|
|
||||||
- 在控制台中创建API Key
|
|
||||||
- 复制生成的API Key,这是配置所需的关键信息
|
|
||||||
- 接口说明见 [Serply文档](https://serply.io/docs)
|
|
||||||
|
|
||||||
### 方式四:使用Outcrawl搜索
|
|
||||||
|
|
||||||
- 访问 [Outcrawl](https://outcrawl.ai),注册并登录账号
|
|
||||||
- 在控制台中创建API Key
|
|
||||||
- 复制生成的API Key,这是配置所需的关键信息
|
|
||||||
- 接口说明见 [Outcrawl文档](https://outcrawl.ai/docs/search/overview)
|
|
||||||
|
|
||||||
### 方式五:使用SpecStream搜索
|
|
||||||
|
|
||||||
- 访问 [SpecStream](https://specstream.ai/signup?src=xiaozhi-esp32-server),注册并登录账号
|
|
||||||
- 在工作区的 Agents & API 页面创建API Key
|
|
||||||
- 复制生成的API Key,这是配置所需的关键信息
|
|
||||||
- 接口说明见 [SpecStream文档](https://specstream.ai/search-api)
|
|
||||||
|
|
||||||
## 配置方式
|
|
||||||
|
|
||||||
### 方式1. 使用智控台部署(推荐)
|
|
||||||
|
|
||||||
- 登录智控台
|
|
||||||
- 进入"配置角色"页面,选择要配置的智能体
|
|
||||||
- 点击"编辑功能"按钮,在右侧参数配置区域找到"联网搜索"插件
|
|
||||||
- 勾选"联网搜索"
|
|
||||||
- 填入搜索源(`metaso`、`tavily`、`serply`、`outcrawl`或`specstream`),并将对应的`API Key`填入配置项
|
|
||||||
- 保存配置,再保存智能体配置
|
|
||||||
|
|
||||||
### 方式2. 单模块xiaozhi-server部署
|
|
||||||
|
|
||||||
在 `data/.config.yaml` 中配置:
|
|
||||||
|
|
||||||
- 将搜索源填入 `provider`,可选值为 `metaso`、`tavily`、`serply`、`outcrawl` 或 `specstream`
|
|
||||||
- 将申请到的API Key填入 `api_key`
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
plugins:
|
|
||||||
web_search:
|
|
||||||
provider: "metaso"
|
|
||||||
api_key: "你的API Key"
|
|
||||||
```
|
|
||||||
|
|
||||||
如需自定义返回结果数量和工具描述,可额外配置 `max_results` 和 `description`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
plugins:
|
|
||||||
web_search:
|
|
||||||
provider: "metaso"
|
|
||||||
description: "联网搜索工具。当用户明确需要联网搜索问题时使用此工具。"
|
|
||||||
max_results: 5
|
|
||||||
api_key: "你的API Key"
|
|
||||||
```
|
|
||||||
|
|
||||||
同时在 `functions` 列表中确保已启用 `web_search`:
|
|
||||||
|
|
||||||
```yaml
|
|
||||||
plugins:
|
|
||||||
functions:
|
|
||||||
- web_search
|
|
||||||
```
|
|
||||||
|
|
||||||
配置完成后重启服务即可生效。
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
* [3.2. `manager-api` (管理后端 - Java Spring Boot实现)](#32-manager-api-管理后端---java-spring-boot实现)
|
* [3.2. `manager-api` (管理后端 - Java Spring Boot实现)](#32-manager-api-管理后端---java-spring-boot实现)
|
||||||
* [3.3. `manager-web` (Web管理前端 - Vue.js实现)](#33-manager-web-web管理前端---vuejs实现)
|
* [3.3. `manager-web` (Web管理前端 - Vue.js实现)](#33-manager-web-web管理前端---vuejs实现)
|
||||||
* [3.4. `manager-mobile` (移动管理端 - uni-app+Vue3实现)](#34-manager-mobile-移动管理端---uni-appvue3实现)
|
* [3.4. `manager-mobile` (移动管理端 - uni-app+Vue3实现)](#34-manager-mobile-移动管理端---uni-appvue3实现)
|
||||||
* [3.5. `digital-human` (数字人测试模块 - Python+Web实现)](#35-digital-human-数字人测试模块---pythonweb实现)
|
|
||||||
4. [数据流与交互机制](#4-数据流与交互机制)
|
4. [数据流与交互机制](#4-数据流与交互机制)
|
||||||
5. [核心功能概要](#5-核心功能概要)
|
5. [核心功能概要](#5-核心功能概要)
|
||||||
6. [部署与配置概述](#6-部署与配置概述)
|
6. [部署与配置概述](#6-部署与配置概述)
|
||||||
|
|
@ -68,13 +67,6 @@
|
||||||
* 基于alova + @alova/adapter-uniapp实现网络请求,与manager-api无缝集成。
|
* 基于alova + @alova/adapter-uniapp实现网络请求,与manager-api无缝集成。
|
||||||
* 使用pinia进行状态管理,确保数据一致性。
|
* 使用pinia进行状态管理,确保数据一致性。
|
||||||
|
|
||||||
6. **`digital-human` (数字人测试模块 - Python+Web实现):**
|
|
||||||
这是一个独立的数字人测试模块,提供本地测试页面、前端交互资源、唤醒词运行时与事件桥能力,用于联调整个数字人交互链路。其主要能力包括:
|
|
||||||
* 提供浏览器端的数字人测试页面,用于验证音频播放、接收和交互流程。
|
|
||||||
* 集成本地唤醒词运行时,支持基于Sherpa-ONNX的关键词检测。
|
|
||||||
* 通过事件桥将页面状态与本地运行时打通,便于调试唤醒词触发与交互效果。
|
|
||||||
* 作为独立模块与`xiaozhi-server`、`manager-web`、`manager-api`并列,便于单独开发和部署。
|
|
||||||
|
|
||||||
**高层交互流程概述:**
|
**高层交互流程概述:**
|
||||||
|
|
||||||
* **语音交互主线:** **ESP32设备**捕捉到用户语音后,通过**WebSocket**将音频数据实时传输给**`xiaozhi-server`**。`xiaozhi-server`完成一系列AI处理(VAD、ASR、LLM交互、TTS)后,再通过WebSocket将合成的语音回复发送回ESP32设备进行播放。所有与语音直接相关的实时交互均在此链路完成。
|
* **语音交互主线:** **ESP32设备**捕捉到用户语音后,通过**WebSocket**将音频数据实时传输给**`xiaozhi-server`**。`xiaozhi-server`完成一系列AI处理(VAD、ASR、LLM交互、TTS)后,再通过WebSocket将合成的语音回复发送回ESP32设备进行播放。所有与语音直接相关的实时交互均在此链路完成。
|
||||||
|
|
@ -88,8 +80,7 @@ xiaozhi-esp32-server
|
||||||
├─ xiaozhi-server 8000 端口 Python语言开发 负责与esp32通信
|
├─ xiaozhi-server 8000 端口 Python语言开发 负责与esp32通信
|
||||||
├─ manager-web 8001 端口 Node.js+Vue开发 负责提供控制台的web界面
|
├─ manager-web 8001 端口 Node.js+Vue开发 负责提供控制台的web界面
|
||||||
├─ manager-api 8002 端口 Java语言开发 负责提供控制台的api
|
├─ manager-api 8002 端口 Java语言开发 负责提供控制台的api
|
||||||
├─ manager-mobile 跨平台移动应用 uni-app+Vue3开发 负责提供移动版智控台管理
|
└─ manager-mobile 跨平台移动应用 uni-app+Vue3开发 负责提供移动版智控台管理
|
||||||
└─ digital-human 数字人测试模块 Python+Web实现 负责本地测试页面、唤醒词运行时与事件桥
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -375,48 +366,6 @@ xiaozhi-esp32-server
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
### 3.5. `digital-human` (数字人测试模块 - Python+Web实现)
|
|
||||||
|
|
||||||
`digital-human` 组件是一个独立的数字人测试模块,负责提供本地测试页面、页面资源、唤醒词运行时和事件桥能力。它主要用于联调整个数字人交互链路,帮助开发者验证页面交互、音频能力和本地唤醒词流程。
|
|
||||||
|
|
||||||
* **核心目标:**
|
|
||||||
* 提供独立的本地测试页面,用于验证数字人交互效果。
|
|
||||||
* 提供本地唤醒词运行时,支持关键词检测与事件上报。
|
|
||||||
* 为前端页面和本地运行时提供事件桥,打通测试链路。
|
|
||||||
* 以独立模块形式存在,便于单独开发、调试和部署。
|
|
||||||
|
|
||||||
* **核心技术栈:**
|
|
||||||
* **Python 3:** 作为测试运行时的主要语言,负责启动本地服务、管理唤醒词运行时和事件桥。
|
|
||||||
* **原生HTML/CSS/JavaScript:** 用于构建数字人测试页面与交互逻辑。
|
|
||||||
* **Sherpa-ONNX:** 用于本地唤醒词检测。
|
|
||||||
* **ThreadingHTTPServer / WebSocket桥接:** 用于承载测试页面、健康检查和本地事件通信。
|
|
||||||
|
|
||||||
* **关键实现细节:**
|
|
||||||
|
|
||||||
1. **模块入口与页面资源:**
|
|
||||||
* `start.py` 是模块启动入口,负责初始化测试运行时。
|
|
||||||
* `index.html` 是数字人测试页面入口。
|
|
||||||
* `js/`、`css/`、`images/`、`resources/` 目录提供页面脚本、样式和资源文件。
|
|
||||||
|
|
||||||
2. **本地测试运行时:**
|
|
||||||
* `wakeword_runtime/` 目录承载本地唤醒词运行时实现。
|
|
||||||
* 运行时负责配置加载、日志初始化、音频采集、关键词检测和服务生命周期管理。
|
|
||||||
* 模块默认通过本地HTTP服务暴露页面地址、事件桥地址和健康检查接口。
|
|
||||||
|
|
||||||
3. **唤醒词检测链路:**
|
|
||||||
* 基于Sherpa-ONNX关键词检测模型,支持本地唤醒词触发。
|
|
||||||
* 模型文件和关键词配置位于 `wakeword_runtime/models/` 及相应配置文件中。
|
|
||||||
* 页面侧可结合事件桥观察唤醒词服务状态和触发结果。
|
|
||||||
|
|
||||||
4. **调试与联调定位:**
|
|
||||||
* 启动后可通过浏览器访问本地页面,验证音频播放、接收和交互逻辑。
|
|
||||||
* 通过事件桥可以将唤醒词状态同步到页面,便于排查本地链路问题。
|
|
||||||
* 详细的模型下载、运行时配置和使用说明已整理在 `docs/digital-human-wakeword.md` 中。
|
|
||||||
|
|
||||||
`digital-human` 的存在使得数字人相关能力可以脱离主服务独立验证,降低了页面调试、唤醒词联调和本地环境搭建的复杂度。
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## 4. 数据流与交互机制
|
## 4. 数据流与交互机制
|
||||||
|
|
||||||
`xiaozhi-esp32-server` 系统通过各组件间定义清晰的数据流和交互协议来协同工作。主要的通信方式依赖于针对实时交互优化的WebSocket协议和适用于客户端-服务器请求的RESTful API。
|
`xiaozhi-esp32-server` 系统通过各组件间定义清晰的数据流和交互协议来协同工作。主要的通信方式依赖于针对实时交互优化的WebSocket协议和适用于客户端-服务器请求的RESTful API。
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,6 @@
|
||||||
* [3.2. `manager-api` (Management Backend - Java Spring Boot Implementation)](#32-manager-api-management-backend---java-spring-boot-implementation)
|
* [3.2. `manager-api` (Management Backend - Java Spring Boot Implementation)](#32-manager-api-management-backend---java-spring-boot-implementation)
|
||||||
* [3.3. `manager-web` (Web Management Frontend - Vue.js Implementation)](#33-manager-web-web-management-frontend---vuejs-implementation)
|
* [3.3. `manager-web` (Web Management Frontend - Vue.js Implementation)](#33-manager-web-web-management-frontend---vuejs-implementation)
|
||||||
* [3.4. `manager-mobile` (Mobile Management Console - uni-app Implementation)](#34-manager-mobile-mobile-management-console---uniapp-implementation)
|
* [3.4. `manager-mobile` (Mobile Management Console - uni-app Implementation)](#34-manager-mobile-mobile-management-console---uniapp-implementation)
|
||||||
* [3.5. `digital-human` (Digital Human Test Module - Python+Web Implementation)](#35-digital-human-digital-human-test-module---pythonweb-implementation)
|
|
||||||
4. [Data Flow and Interaction Mechanisms](#4-data-flow-and-interaction-mechanisms)
|
4. [Data Flow and Interaction Mechanisms](#4-data-flow-and-interaction-mechanisms)
|
||||||
5. [Key Features Summary](#5-key-features-summary)
|
5. [Key Features Summary](#5-key-features-summary)
|
||||||
6. [Deployment and Configuration Overview](#6-deployment-and-configuration-overview)
|
6. [Deployment and Configuration Overview](#6-deployment-and-configuration-overview)
|
||||||
|
|
@ -61,21 +60,6 @@ The `xiaozhi-esp32-server` system adopts a **distributed, multi-component collab
|
||||||
* (Potential functionality) Monitoring system operation status, viewing logs, troubleshooting, etc.
|
* (Potential functionality) Monitoring system operation status, viewing logs, troubleshooting, etc.
|
||||||
* Comprehensive interaction with all backend management functions provided by `manager-api`.
|
* Comprehensive interaction with all backend management functions provided by `manager-api`.
|
||||||
|
|
||||||
5. **`manager-mobile` (Mobile Management Console - uni-app Implementation):**
|
|
||||||
This is a cross-platform mobile management application based on uni-app v3 + Vue 3 + Vite, supporting App (Android & iOS) and WeChat Mini Program. Its main capabilities include:
|
|
||||||
* Providing a convenient management interface on mobile devices, similar in functionality to manager-web but optimized for mobile platforms.
|
|
||||||
* Supporting core functions such as user login, device management, and AI service configuration.
|
|
||||||
* Cross-platform adaptation, allowing a single codebase to run on iOS, Android, and WeChat Mini Programs.
|
|
||||||
* Integrating with `manager-api` through alova + `@alova/adapter-uniapp`.
|
|
||||||
* Using pinia for state management to ensure data consistency.
|
|
||||||
|
|
||||||
6. **`digital-human` (Digital Human Test Module - Python+Web Implementation):**
|
|
||||||
This is an independent digital human test module that provides a local test page, frontend interaction resources, a wake word runtime, and an event bridge for end-to-end debugging of the digital human interaction flow. Its main capabilities include:
|
|
||||||
* Providing a browser-based digital human test page for validating audio playback, audio reception, and interaction flow.
|
|
||||||
* Integrating a local wake word runtime with keyword detection based on Sherpa-ONNX.
|
|
||||||
* Bridging page state and the local runtime through an event bridge to simplify wake word debugging.
|
|
||||||
* Existing as a standalone module alongside `xiaozhi-server`, `manager-web`, and `manager-api`, making independent development and deployment easier.
|
|
||||||
|
|
||||||
**High-Level Interaction Flow Overview:**
|
**High-Level Interaction Flow Overview:**
|
||||||
|
|
||||||
* **Voice Interaction Main Line:** After the **ESP32 device** captures user voice, it transmits audio data in real-time to **`xiaozhi-server`** through **WebSocket**. After `xiaozhi-server` completes a series of AI processing (VAD, ASR, LLM interaction, TTS), it sends the synthesized voice response back to the ESP32 device for playback through WebSocket. All real-time interactions directly related to voice are completed in this link.
|
* **Voice Interaction Main Line:** After the **ESP32 device** captures user voice, it transmits audio data in real-time to **`xiaozhi-server`** through **WebSocket**. After `xiaozhi-server` completes a series of AI processing (VAD, ASR, LLM interaction, TTS), it sends the synthesized voice response back to the ESP32 device for playback through WebSocket. All real-time interactions directly related to voice are completed in this link.
|
||||||
|
|
@ -89,8 +73,7 @@ xiaozhi-esp32-server
|
||||||
├─ xiaozhi-server Port 8000 Python development Responsible for ESP32 communication
|
├─ xiaozhi-server Port 8000 Python development Responsible for ESP32 communication
|
||||||
├─ manager-web Port 8001 Node.js+Vue development Responsible for providing web interface for console
|
├─ manager-web Port 8001 Node.js+Vue development Responsible for providing web interface for console
|
||||||
├─ manager-api Port 8002 Java development Responsible for providing console API
|
├─ manager-api Port 8002 Java development Responsible for providing console API
|
||||||
├─ manager-mobile Cross-platform mobile application uni-app+Vue3 development Responsible for providing mobile console management
|
└─ manager-mobile Cross-platform mobile application uni-app+Vue3 development Responsible for providing mobile console management
|
||||||
└─ digital-human Digital human test module Python+Web implementation Responsible for local test page, wake word runtime, and event bridge
|
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
@ -274,46 +257,6 @@ The `manager-mobile` component is a cross-platform mobile management application
|
||||||
|
|
||||||
`manager-mobile` provides users with a fully functional, smooth mobile management tool through the application of these technologies, allowing administrators to perform system management and configuration anytime, anywhere.
|
`manager-mobile` provides users with a fully functional, smooth mobile management tool through the application of these technologies, allowing administrators to perform system management and configuration anytime, anywhere.
|
||||||
|
|
||||||
### 3.5. `digital-human` (Digital Human Test Module - Python+Web Implementation)
|
|
||||||
|
|
||||||
The `digital-human` component is an independent digital human test module responsible for providing a local test page, page resources, a wake word runtime, and an event bridge. It is primarily used to debug the complete digital human interaction flow and to validate frontend interaction, audio capability, and local wake word behavior.
|
|
||||||
|
|
||||||
* **Core Objectives:**
|
|
||||||
* Provide an independent local test page for validating digital human interaction effects.
|
|
||||||
* Provide a local wake word runtime for keyword detection and event reporting.
|
|
||||||
* Provide an event bridge between the frontend page and the local runtime to connect the test flow.
|
|
||||||
* Exist as a standalone module for easier independent development, debugging, and deployment.
|
|
||||||
|
|
||||||
* **Core Technologies:**
|
|
||||||
* **Python 3:** Used for the local test runtime, service startup, wake word lifecycle management, and event bridge coordination.
|
|
||||||
* **Native HTML/CSS/JavaScript:** Used to build the digital human test page and interaction logic.
|
|
||||||
* **Sherpa-ONNX:** Used for local wake word keyword detection.
|
|
||||||
* **ThreadingHTTPServer / WebSocket bridge:** Used to serve the local page, health check endpoint, and event communication.
|
|
||||||
|
|
||||||
* **Key Implementation Aspects:**
|
|
||||||
|
|
||||||
1. **Module Entry and Page Resources:**
|
|
||||||
* `start.py` is the module entry point responsible for starting the local test runtime.
|
|
||||||
* `index.html` is the entry page for digital human testing.
|
|
||||||
* The `js/`, `css/`, `images/`, and `resources/` directories provide frontend scripts, styles, and static resources.
|
|
||||||
|
|
||||||
2. **Local Test Runtime:**
|
|
||||||
* The `wakeword_runtime/` directory contains the local wake word runtime implementation.
|
|
||||||
* The runtime is responsible for configuration loading, logging initialization, audio capture, keyword detection, and lifecycle management.
|
|
||||||
* The module exposes a local page URL, event bridge URL, and health check endpoint through a local HTTP service.
|
|
||||||
|
|
||||||
3. **Wake Word Detection Flow:**
|
|
||||||
* Uses Sherpa-ONNX keyword detection models to support local wake word triggering.
|
|
||||||
* Model files and keyword configurations are stored in `wakeword_runtime/models/` and related configuration files.
|
|
||||||
* The page can observe runtime state and trigger results through the event bridge.
|
|
||||||
|
|
||||||
4. **Debugging and Integration Positioning:**
|
|
||||||
* After startup, developers can open the local page in a browser to validate playback, reception, and interaction logic.
|
|
||||||
* The event bridge synchronizes wake word state to the page, which helps with local debugging.
|
|
||||||
* Detailed model download, runtime configuration, and usage instructions are documented in `docs/digital-human-wakeword.md`.
|
|
||||||
|
|
||||||
The `digital-human` module allows digital human related capabilities to be validated independently from the main service, reducing the complexity of page debugging, wake word integration, and local environment setup.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 4. Data Flow and Interaction Mechanisms
|
## 4. Data Flow and Interaction Mechanisms
|
||||||
|
|
|
||||||
|
|
@ -1,46 +0,0 @@
|
||||||
本文档是开发类文档,如需部署小智服务端,[点击这里查看部署教程](../../README.md#%E9%83%A8%E7%BD%B2%E6%96%87%E6%A1%A3)
|
|
||||||
|
|
||||||
如需查看一体机数字人落地部署、Kiosk 全屏启动和系统环境配置,[点击这里查看一体机部署指南](../../docs/all-in-one-digital-human-setup.md)
|
|
||||||
|
|
||||||
如需查看唤醒词模型下载、运行时配置和详细使用说明,[点击这里查看唤醒词专题文档](../../docs/digital-human-wakeword.md)
|
|
||||||
|
|
||||||
# 项目介绍
|
|
||||||
|
|
||||||
digital-human 是独立的数字人测试模块,负责提供本地测试页面、前端交互资源、唤醒词运行时和事件桥能力,用于联调整个数字人交互链路。
|
|
||||||
|
|
||||||
# 快速启动
|
|
||||||
|
|
||||||
安装依赖:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pip install -r wakeword_runtime/requirements.txt
|
|
||||||
```
|
|
||||||
|
|
||||||
启动模块:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python start.py
|
|
||||||
```
|
|
||||||
|
|
||||||
# 访问地址
|
|
||||||
|
|
||||||
启动后可访问:
|
|
||||||
|
|
||||||
- 页面地址:http://127.0.0.1:8006/index.html
|
|
||||||
- 事件桥地址:ws://127.0.0.1:8006/wakeword-ws
|
|
||||||
- 健康检查:http://127.0.0.1:8006/health
|
|
||||||
|
|
||||||
# 目录说明
|
|
||||||
|
|
||||||
- `start.py`:模块启动入口
|
|
||||||
- `index.html`:数字人测试页面入口
|
|
||||||
- `wakeword_runtime`:本地唤醒词运行时与配置目录
|
|
||||||
- `js`、`css`:页面前端脚本与样式
|
|
||||||
- `images`、`resources`:页面资源文件
|
|
||||||
|
|
||||||
# 相关文档
|
|
||||||
|
|
||||||
- 一体机部署指南:适用于 x86 设备整机落地部署、Kiosk 展示和开机自启动配置
|
|
||||||
[../../docs/all-in-one-digital-human-setup.md](../../docs/all-in-one-digital-human-setup.md)
|
|
||||||
- 唤醒词专题文档:适用于唤醒词模型下载、运行时配置和本地调试说明
|
|
||||||
[../../docs/digital-human-wakeword.md](../../docs/digital-human-wakeword.md)
|
|
||||||
|
|
@ -1,225 +0,0 @@
|
||||||
import { uiController } from '../../ui/controller.js?v=0205';
|
|
||||||
import { log } from '../../utils/logger.js?v=0205';
|
|
||||||
|
|
||||||
let wakewordSocket = null;
|
|
||||||
let reconnectTimer = null;
|
|
||||||
let reconnectAttempts = 0;
|
|
||||||
let shouldReconnect = true;
|
|
||||||
let wakewordRequestSeq = 0;
|
|
||||||
let onNextBridgeConnectedCallback = null;
|
|
||||||
|
|
||||||
const pendingWakewordRequests = new Map();
|
|
||||||
|
|
||||||
export function startWakewordBridgeListener() {
|
|
||||||
if (wakewordSocket) {
|
|
||||||
return wakewordSocket;
|
|
||||||
}
|
|
||||||
|
|
||||||
shouldReconnect = true;
|
|
||||||
log('正在连接本地唤醒事件桥...', 'info');
|
|
||||||
tryConnect();
|
|
||||||
return wakewordSocket;
|
|
||||||
}
|
|
||||||
|
|
||||||
function tryConnect() {
|
|
||||||
const bridgeUrl = buildWakewordBridgeUrl();
|
|
||||||
|
|
||||||
try {
|
|
||||||
wakewordSocket = new WebSocket(bridgeUrl);
|
|
||||||
wakewordSocket.onopen = () => {
|
|
||||||
reconnectAttempts = 0;
|
|
||||||
log(`本地唤醒事件桥已连接: ${bridgeUrl}`, 'success');
|
|
||||||
// 连接成功后自动保存地址,刷新后仍能记住
|
|
||||||
localStorage.setItem('xz_tester_wakewordWsUrl', bridgeUrl);
|
|
||||||
const urlInput = document.getElementById('wakewordWsUrl');
|
|
||||||
if (urlInput) urlInput.value = bridgeUrl;
|
|
||||||
};
|
|
||||||
|
|
||||||
wakewordSocket.onerror = () => {
|
|
||||||
log(`本地唤醒事件桥连接失败: ${bridgeUrl}`, 'error');
|
|
||||||
};
|
|
||||||
|
|
||||||
wakewordSocket.onmessage = async (event) => {
|
|
||||||
try {
|
|
||||||
const message = parseWakewordBridgeMessage(event.data);
|
|
||||||
if (message.requestId && pendingWakewordRequests.has(message.requestId)) {
|
|
||||||
settleWakewordRequest(message);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.success === false) {
|
|
||||||
log(`本地唤醒事件桥返回错误: ${message.error || '未知错误'}`, 'error');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.type === 'bridge_connected') {
|
|
||||||
log('本地唤醒监听已就绪', 'info');
|
|
||||||
if (onNextBridgeConnectedCallback) {
|
|
||||||
const cb = onNextBridgeConnectedCallback;
|
|
||||||
onNextBridgeConnectedCallback = null;
|
|
||||||
cb(message);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.type === 'service_ready') {
|
|
||||||
log('本地唤醒服务已启动', 'info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.type === 'wakeword_config') {
|
|
||||||
uiController.applyWakewordConfig(message.payload || {});
|
|
||||||
log('已同步本地唤醒词配置', 'info');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.type === 'service_stopping') {
|
|
||||||
log('本地唤醒服务正在停止', 'warning');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (message.type === 'wake_word_detected') {
|
|
||||||
const wakeWord = message.payload?.wake_word || '唤醒词';
|
|
||||||
log(`检测到本地唤醒事件: ${wakeWord}`, 'info');
|
|
||||||
await uiController.triggerWakewordDial(wakeWord);
|
|
||||||
}
|
|
||||||
} catch (error) {
|
|
||||||
log(`解析本地唤醒事件失败: ${error.message}`, 'error');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
wakewordSocket.onclose = () => {
|
|
||||||
if (wakewordSocket) {
|
|
||||||
wakewordSocket = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
rejectAllWakewordRequests('本地唤醒事件桥已断开');
|
|
||||||
|
|
||||||
if (!shouldReconnect) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (reconnectTimer) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
reconnectAttempts += 1;
|
|
||||||
const delay = Math.min(1000 * reconnectAttempts, 5000);
|
|
||||||
log(`本地唤醒事件桥将在 ${delay}ms 后重连: ${bridgeUrl}`, 'warning');
|
|
||||||
reconnectTimer = window.setTimeout(() => {
|
|
||||||
reconnectTimer = null;
|
|
||||||
tryConnect();
|
|
||||||
}, delay);
|
|
||||||
};
|
|
||||||
|
|
||||||
return wakewordSocket;
|
|
||||||
} catch (error) {
|
|
||||||
log(`启动本地唤醒监听失败: ${error.message}`, 'error');
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export function stopWakewordBridgeListener() {
|
|
||||||
shouldReconnect = false;
|
|
||||||
|
|
||||||
if (reconnectTimer) {
|
|
||||||
window.clearTimeout(reconnectTimer);
|
|
||||||
reconnectTimer = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!wakewordSocket) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
wakewordSocket.onclose = null;
|
|
||||||
wakewordSocket.close();
|
|
||||||
wakewordSocket = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function sendWakewordBridgeMessage(type, payload = {}, requestId = null) {
|
|
||||||
if (!wakewordSocket || wakewordSocket.readyState !== WebSocket.OPEN) {
|
|
||||||
log('本地唤醒事件桥未连接,无法发送消息', 'warning');
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
wakewordSocket.send(JSON.stringify({
|
|
||||||
type,
|
|
||||||
requestId,
|
|
||||||
payload,
|
|
||||||
}));
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
export function requestWakewordBridge(type, payload = {}, timeout = 5000) {
|
|
||||||
const requestId = `wakeword-${Date.now()}-${++wakewordRequestSeq}`;
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const timer = window.setTimeout(() => {
|
|
||||||
pendingWakewordRequests.delete(requestId);
|
|
||||||
reject(new Error('本地唤醒服务响应超时'));
|
|
||||||
}, timeout);
|
|
||||||
|
|
||||||
pendingWakewordRequests.set(requestId, { resolve, reject, timer });
|
|
||||||
|
|
||||||
if (!sendWakewordBridgeMessage(type, payload, requestId)) {
|
|
||||||
window.clearTimeout(timer);
|
|
||||||
pendingWakewordRequests.delete(requestId);
|
|
||||||
reject(new Error('本地唤醒事件桥未连接'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export function getWakewordBridgeUrl() {
|
|
||||||
if (wakewordSocket && wakewordSocket.url) {
|
|
||||||
return wakewordSocket.url;
|
|
||||||
}
|
|
||||||
return buildWakewordBridgeUrl();
|
|
||||||
}
|
|
||||||
|
|
||||||
export function onNextBridgeConnected(callback) {
|
|
||||||
onNextBridgeConnectedCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
function buildWakewordBridgeUrl() {
|
|
||||||
const configured = localStorage.getItem('xz_tester_wakewordWsUrl');
|
|
||||||
if (configured && configured.trim()) {
|
|
||||||
return configured.trim();
|
|
||||||
}
|
|
||||||
return 'ws://127.0.0.1:8006/wakeword-ws';
|
|
||||||
}
|
|
||||||
|
|
||||||
function parseWakewordBridgeMessage(rawData) {
|
|
||||||
const message = JSON.parse(rawData);
|
|
||||||
return {
|
|
||||||
type: message.type || '',
|
|
||||||
requestId: message.requestId || null,
|
|
||||||
success: message.success !== false,
|
|
||||||
payload: message.payload || {},
|
|
||||||
error: message.error || null,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function settleWakewordRequest(message) {
|
|
||||||
const pendingRequest = pendingWakewordRequests.get(message.requestId);
|
|
||||||
if (!pendingRequest) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.clearTimeout(pendingRequest.timer);
|
|
||||||
pendingWakewordRequests.delete(message.requestId);
|
|
||||||
|
|
||||||
if (message.success === false) {
|
|
||||||
pendingRequest.reject(new Error(message.error || '本地唤醒服务返回失败'));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
pendingRequest.resolve(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
function rejectAllWakewordRequests(errorMessage) {
|
|
||||||
pendingWakewordRequests.forEach((pendingRequest) => {
|
|
||||||
window.clearTimeout(pendingRequest.timer);
|
|
||||||
pendingRequest.reject(new Error(errorMessage));
|
|
||||||
});
|
|
||||||
pendingWakewordRequests.clear();
|
|
||||||
}
|
|
||||||
|
|
@ -1,55 +0,0 @@
|
||||||
import threading
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from wakeword_runtime.config import load_config, setup_logging
|
|
||||||
from wakeword_runtime.runtime import TestRuntimeApplication, TestRuntimeHttpServer
|
|
||||||
|
|
||||||
|
|
||||||
def main() -> int:
|
|
||||||
test_root = Path(__file__).resolve().parent
|
|
||||||
runtime_root = test_root / "wakeword_runtime"
|
|
||||||
|
|
||||||
config = load_config(runtime_root)
|
|
||||||
setup_logging(config.log_file, config.log_level)
|
|
||||||
http_server = TestRuntimeHttpServer(test_root)
|
|
||||||
app_lock = threading.RLock()
|
|
||||||
app = TestRuntimeApplication(config, http_server.event_bridge)
|
|
||||||
|
|
||||||
def restart_runtime() -> None:
|
|
||||||
nonlocal app
|
|
||||||
with app_lock:
|
|
||||||
app.shutdown()
|
|
||||||
next_config = load_config(runtime_root)
|
|
||||||
setup_logging(next_config.log_file, next_config.log_level)
|
|
||||||
next_app = TestRuntimeApplication(next_config, http_server.event_bridge)
|
|
||||||
next_app.setup()
|
|
||||||
next_app.start()
|
|
||||||
app = next_app
|
|
||||||
|
|
||||||
http_server.set_restart_handler(restart_runtime)
|
|
||||||
|
|
||||||
print(f"test runtime started: {http_server.page_url}")
|
|
||||||
print(f"wakeword bridge websocket: {http_server.bridge_url}")
|
|
||||||
print(f"wakeword enabled: {config.wakeword_enabled}")
|
|
||||||
print("press Ctrl+C to stop")
|
|
||||||
|
|
||||||
try:
|
|
||||||
with app_lock:
|
|
||||||
try:
|
|
||||||
app.setup()
|
|
||||||
app.start()
|
|
||||||
except Exception as e:
|
|
||||||
print(f"警告: 唤醒词服务启动失败({e}),测试页面仍可正常使用")
|
|
||||||
http_server.serve_forever()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
print("test runtime stopped")
|
|
||||||
finally:
|
|
||||||
with app_lock:
|
|
||||||
app.shutdown()
|
|
||||||
http_server.shutdown()
|
|
||||||
|
|
||||||
return 0
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
raise SystemExit(main())
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
"""Test-side wakeword runtime package."""
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
from .event_bridge import WakewordEventBridge
|
|
||||||
|
|
@ -1,106 +0,0 @@
|
||||||
import json
|
|
||||||
import logging
|
|
||||||
import queue
|
|
||||||
import threading
|
|
||||||
import time
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class WakewordEventBridge:
|
|
||||||
def __init__(self) -> None:
|
|
||||||
self._clients: list[queue.Queue[str]] = []
|
|
||||||
self._clients_lock = threading.Lock()
|
|
||||||
self._running = True
|
|
||||||
|
|
||||||
@property
|
|
||||||
def is_running(self) -> bool:
|
|
||||||
return self._running
|
|
||||||
|
|
||||||
def build_ready_message(self) -> str:
|
|
||||||
return self.build_message(
|
|
||||||
"bridge_connected",
|
|
||||||
{"status": "ready"},
|
|
||||||
)
|
|
||||||
|
|
||||||
def publish_detected(self, wake_word: str) -> None:
|
|
||||||
self.publish(
|
|
||||||
"wake_word_detected",
|
|
||||||
{
|
|
||||||
"wake_word": wake_word,
|
|
||||||
"timestamp": time.time(),
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
def publish(self, event_type: str, payload: dict[str, Any] | None = None) -> None:
|
|
||||||
if not self._running:
|
|
||||||
return
|
|
||||||
|
|
||||||
message = self.build_message(event_type, payload or {})
|
|
||||||
with self._clients_lock:
|
|
||||||
clients = list(self._clients)
|
|
||||||
|
|
||||||
stale_clients: list[queue.Queue[str]] = []
|
|
||||||
for client_queue in clients:
|
|
||||||
try:
|
|
||||||
client_queue.put_nowait(message)
|
|
||||||
except queue.Full:
|
|
||||||
stale_clients.append(client_queue)
|
|
||||||
|
|
||||||
if stale_clients:
|
|
||||||
with self._clients_lock:
|
|
||||||
for client_queue in stale_clients:
|
|
||||||
if client_queue in self._clients:
|
|
||||||
self._clients.remove(client_queue)
|
|
||||||
|
|
||||||
def add_client(self) -> queue.Queue[str]:
|
|
||||||
client_queue: queue.Queue[str] = queue.Queue(maxsize=16)
|
|
||||||
with self._clients_lock:
|
|
||||||
self._clients.append(client_queue)
|
|
||||||
return client_queue
|
|
||||||
|
|
||||||
def build_message(
|
|
||||||
self,
|
|
||||||
event_type: str,
|
|
||||||
payload: dict[str, Any] | None = None,
|
|
||||||
request_id: str | None = None,
|
|
||||||
success: bool = True,
|
|
||||||
error: str | None = None,
|
|
||||||
) -> str:
|
|
||||||
message: dict[str, Any] = {
|
|
||||||
"type": event_type,
|
|
||||||
"requestId": request_id,
|
|
||||||
"success": success,
|
|
||||||
"payload": payload or {},
|
|
||||||
}
|
|
||||||
if error:
|
|
||||||
message["error"] = error
|
|
||||||
return json.dumps(message, ensure_ascii=False)
|
|
||||||
|
|
||||||
def remove_client(self, client_queue: queue.Queue[str]) -> None:
|
|
||||||
with self._clients_lock:
|
|
||||||
if client_queue in self._clients:
|
|
||||||
self._clients.remove(client_queue)
|
|
||||||
|
|
||||||
def publish_service_ready(self) -> None:
|
|
||||||
self.publish("service_ready", {"status": "ready"})
|
|
||||||
|
|
||||||
def publish_service_stopping(self) -> None:
|
|
||||||
self.publish("service_stopping", {"status": "stopping"})
|
|
||||||
|
|
||||||
def close(self) -> None:
|
|
||||||
if not self._running:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.publish_service_stopping()
|
|
||||||
self._running = False
|
|
||||||
with self._clients_lock:
|
|
||||||
clients = list(self._clients)
|
|
||||||
self._clients.clear()
|
|
||||||
|
|
||||||
for client_queue in clients:
|
|
||||||
try:
|
|
||||||
client_queue.put_nowait("__bridge_closed__")
|
|
||||||
except queue.Full:
|
|
||||||
pass
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
{
|
|
||||||
"wakeword": {
|
|
||||||
"enabled": true
|
|
||||||
},
|
|
||||||
"model_dir": "models",
|
|
||||||
"audio": {
|
|
||||||
"input_device": null,
|
|
||||||
"sample_rate": 16000,
|
|
||||||
"channels": 1
|
|
||||||
},
|
|
||||||
"detector": {
|
|
||||||
"num_threads": 4,
|
|
||||||
"provider": "cpu",
|
|
||||||
"max_active_paths": 2,
|
|
||||||
"keywords_score": 1.8,
|
|
||||||
"keywords_threshold": 0.1,
|
|
||||||
"num_trailing_blanks": 1,
|
|
||||||
"cooldown_seconds": 1.5
|
|
||||||
},
|
|
||||||
"logging": {
|
|
||||||
"level": "INFO",
|
|
||||||
"dir": "logs",
|
|
||||||
"file": "wakeword-runtime.log"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from .config_loader import RuntimeConfig, load_config
|
|
||||||
from .logging_setup import setup_logging
|
|
||||||
|
|
@ -1,153 +0,0 @@
|
||||||
import json
|
|
||||||
from dataclasses import dataclass
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class WakewordSettings:
|
|
||||||
enabled: bool = False
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class AudioSettings:
|
|
||||||
input_device: str | int | None = None
|
|
||||||
sample_rate: int = 16000
|
|
||||||
channels: int = 1
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class DetectorSettings:
|
|
||||||
num_threads: int = 4
|
|
||||||
provider: str = "cpu"
|
|
||||||
max_active_paths: int = 2
|
|
||||||
keywords_score: float = 1.8
|
|
||||||
keywords_threshold: float = 0.2
|
|
||||||
num_trailing_blanks: int = 1
|
|
||||||
cooldown_seconds: float = 1.5
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class LoggingSettings:
|
|
||||||
level: str = "INFO"
|
|
||||||
directory: str = "logs"
|
|
||||||
file_name: str = "wakeword-runtime.log"
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class RuntimeConfig:
|
|
||||||
runtime_root: Path
|
|
||||||
wakeword: WakewordSettings
|
|
||||||
wake_words: list[str]
|
|
||||||
model_dir: Path
|
|
||||||
audio: AudioSettings
|
|
||||||
detector: DetectorSettings
|
|
||||||
logging: LoggingSettings
|
|
||||||
|
|
||||||
def validate(self) -> None:
|
|
||||||
if self.wakeword.enabled and not self.wake_words:
|
|
||||||
raise ValueError("keywords.txt cannot be empty when wakeword is enabled")
|
|
||||||
|
|
||||||
if self.audio.sample_rate <= 0:
|
|
||||||
raise ValueError("audio.sample_rate must be greater than 0")
|
|
||||||
|
|
||||||
if self.audio.channels <= 0:
|
|
||||||
raise ValueError("audio.channels must be greater than 0")
|
|
||||||
|
|
||||||
if self.detector.num_threads <= 0:
|
|
||||||
raise ValueError("detector.num_threads must be greater than 0")
|
|
||||||
|
|
||||||
if self.detector.cooldown_seconds < 0:
|
|
||||||
raise ValueError("detector.cooldown_seconds cannot be negative")
|
|
||||||
|
|
||||||
if not self.logging.level:
|
|
||||||
raise ValueError("logging.level cannot be empty")
|
|
||||||
|
|
||||||
@property
|
|
||||||
def wakeword_enabled(self) -> bool:
|
|
||||||
return self.wakeword.enabled
|
|
||||||
|
|
||||||
@property
|
|
||||||
def log_dir(self) -> Path:
|
|
||||||
return (self.runtime_root / self.logging.directory).resolve()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def log_file(self) -> Path:
|
|
||||||
return self.log_dir / self.logging.file_name
|
|
||||||
|
|
||||||
@property
|
|
||||||
def log_level(self) -> str:
|
|
||||||
return self.logging.level.upper()
|
|
||||||
|
|
||||||
|
|
||||||
def load_config(runtime_root: Path) -> RuntimeConfig:
|
|
||||||
config_path = runtime_root / "config.json"
|
|
||||||
raw = json.loads(config_path.read_text(encoding="utf-8"))
|
|
||||||
wakeword_cfg = dict(raw.get("wakeword", {}))
|
|
||||||
raw_model_dir = Path(str(raw.get("model_dir", "models")))
|
|
||||||
model_dir = raw_model_dir.resolve() if raw_model_dir.is_absolute() else (runtime_root / raw_model_dir).resolve()
|
|
||||||
wake_words = _load_wake_words_from_keywords_file(model_dir)
|
|
||||||
|
|
||||||
audio_cfg = dict(raw.get("audio", {}))
|
|
||||||
detector_cfg = dict(raw.get("detector", {}))
|
|
||||||
logging_cfg = dict(raw.get("logging", {}))
|
|
||||||
|
|
||||||
config = RuntimeConfig(
|
|
||||||
runtime_root=runtime_root,
|
|
||||||
wakeword=WakewordSettings(enabled=bool(wakeword_cfg.get("enabled", False))),
|
|
||||||
wake_words=wake_words,
|
|
||||||
model_dir=model_dir,
|
|
||||||
audio=AudioSettings(
|
|
||||||
input_device=audio_cfg.get("input_device"),
|
|
||||||
sample_rate=int(audio_cfg.get("sample_rate", 16000)),
|
|
||||||
channels=int(audio_cfg.get("channels", 1)),
|
|
||||||
),
|
|
||||||
detector=DetectorSettings(
|
|
||||||
num_threads=int(detector_cfg.get("num_threads", 4)),
|
|
||||||
provider=str(detector_cfg.get("provider", "cpu")),
|
|
||||||
max_active_paths=int(detector_cfg.get("max_active_paths", 2)),
|
|
||||||
keywords_score=float(detector_cfg.get("keywords_score", 1.8)),
|
|
||||||
keywords_threshold=float(detector_cfg.get("keywords_threshold", 0.2)),
|
|
||||||
num_trailing_blanks=int(detector_cfg.get("num_trailing_blanks", 1)),
|
|
||||||
cooldown_seconds=float(detector_cfg.get("cooldown_seconds", 1.5)),
|
|
||||||
),
|
|
||||||
logging=LoggingSettings(
|
|
||||||
level=str(logging_cfg.get("level", "INFO")).upper(),
|
|
||||||
directory=str(logging_cfg.get("dir", "logs")),
|
|
||||||
file_name=str(logging_cfg.get("file", "wakeword-runtime.log")),
|
|
||||||
),
|
|
||||||
)
|
|
||||||
config.validate()
|
|
||||||
return config
|
|
||||||
|
|
||||||
|
|
||||||
DEFAULT_WAKE_WORDS = [
|
|
||||||
"你好小智",
|
|
||||||
"你好小志",
|
|
||||||
"小爱同学",
|
|
||||||
"你好小鑫",
|
|
||||||
"你好小新",
|
|
||||||
"小美同学",
|
|
||||||
"小龙小龙",
|
|
||||||
"喵喵同学",
|
|
||||||
"小滨小滨",
|
|
||||||
"小冰小冰",
|
|
||||||
"嘿你好呀",
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def _load_wake_words_from_keywords_file(model_dir: Path) -> list[str]:
|
|
||||||
keywords_file = model_dir / "keywords.txt"
|
|
||||||
if not keywords_file.exists():
|
|
||||||
return DEFAULT_WAKE_WORDS.copy()
|
|
||||||
|
|
||||||
wake_words: list[str] = []
|
|
||||||
for line in keywords_file.read_text(encoding="utf-8").splitlines():
|
|
||||||
text = line.strip()
|
|
||||||
if not text or text.startswith("#") or "@" not in text:
|
|
||||||
continue
|
|
||||||
|
|
||||||
wake_word = text.split("@", 1)[1].strip()
|
|
||||||
if wake_word:
|
|
||||||
wake_words.append(wake_word)
|
|
||||||
|
|
||||||
return wake_words if wake_words else DEFAULT_WAKE_WORDS.copy()
|
|
||||||
|
|
@ -1,23 +0,0 @@
|
||||||
import logging
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
|
|
||||||
def setup_logging(log_file: Path, level: str = "INFO") -> None:
|
|
||||||
log_file.parent.mkdir(parents=True, exist_ok=True)
|
|
||||||
|
|
||||||
logger = logging.getLogger()
|
|
||||||
logger.setLevel(getattr(logging, level.upper(), logging.INFO))
|
|
||||||
logger.handlers.clear()
|
|
||||||
|
|
||||||
formatter = logging.Formatter(
|
|
||||||
"%(asctime)s [%(levelname)s] %(name)s - %(message)s"
|
|
||||||
)
|
|
||||||
|
|
||||||
stream_handler = logging.StreamHandler()
|
|
||||||
stream_handler.setFormatter(formatter)
|
|
||||||
|
|
||||||
file_handler = logging.FileHandler(log_file, encoding="utf-8")
|
|
||||||
file_handler.setFormatter(formatter)
|
|
||||||
|
|
||||||
logger.addHandler(stream_handler)
|
|
||||||
logger.addHandler(file_handler)
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
from .detector_assets import DetectorAssets, DetectorAssetsBuilder
|
|
||||||
from .detector import WakewordDetector
|
|
||||||
from .microphone import MicrophoneListener
|
|
||||||
|
|
@ -1,191 +0,0 @@
|
||||||
import queue
|
|
||||||
import threading
|
|
||||||
import logging
|
|
||||||
import time
|
|
||||||
from typing import Any, Callable
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from ..config import RuntimeConfig
|
|
||||||
from .detector_assets import DetectorAssetsBuilder
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class WakewordDetector:
|
|
||||||
def __init__(self, config: RuntimeConfig) -> None:
|
|
||||||
self.config = config
|
|
||||||
self.enabled = config.wakeword_enabled
|
|
||||||
self.assets_builder = DetectorAssetsBuilder(config)
|
|
||||||
self.audio_source = None
|
|
||||||
self.keyword_spotter: Any | None = None
|
|
||||||
self.stream: Any | None = None
|
|
||||||
self.is_running_flag = False
|
|
||||||
self.paused = False
|
|
||||||
self.on_detected_callback: Callable[[str, str], None] | None = None
|
|
||||||
self.on_error: Callable[[Exception], None] | None = None
|
|
||||||
self._audio_queue: queue.Queue[np.ndarray] = queue.Queue(maxsize=100)
|
|
||||||
self._worker_thread: threading.Thread | None = None
|
|
||||||
self.last_detection_time = 0.0
|
|
||||||
self.detection_cooldown = self.config.detector.cooldown_seconds
|
|
||||||
|
|
||||||
def initialize(self) -> None:
|
|
||||||
if not self.enabled:
|
|
||||||
raise RuntimeError("wakeword detector is disabled")
|
|
||||||
|
|
||||||
try:
|
|
||||||
import sherpa_onnx
|
|
||||||
except ImportError as exc:
|
|
||||||
raise RuntimeError(
|
|
||||||
"Missing dependency: sherpa-onnx. Install runtime dependencies before initializing detector."
|
|
||||||
) from exc
|
|
||||||
|
|
||||||
assets = self.assets_builder.prepare()
|
|
||||||
detector_cfg = self.config.detector
|
|
||||||
|
|
||||||
self.keyword_spotter = sherpa_onnx.KeywordSpotter(
|
|
||||||
tokens=str(assets.tokens_file),
|
|
||||||
encoder=str(assets.encoder_file),
|
|
||||||
decoder=str(assets.decoder_file),
|
|
||||||
joiner=str(assets.joiner_file),
|
|
||||||
keywords_file=str(assets.keywords_file),
|
|
||||||
num_threads=detector_cfg.num_threads,
|
|
||||||
sample_rate=self.config.audio.sample_rate,
|
|
||||||
feature_dim=80,
|
|
||||||
max_active_paths=detector_cfg.max_active_paths,
|
|
||||||
keywords_score=detector_cfg.keywords_score,
|
|
||||||
keywords_threshold=detector_cfg.keywords_threshold,
|
|
||||||
num_trailing_blanks=detector_cfg.num_trailing_blanks,
|
|
||||||
provider=detector_cfg.provider,
|
|
||||||
)
|
|
||||||
self.stream = self.keyword_spotter.create_stream()
|
|
||||||
logger.info("detector initialized")
|
|
||||||
logger.info("detector model root: %s", assets.model_root)
|
|
||||||
logger.info("detector keywords file: %s", assets.keywords_file)
|
|
||||||
|
|
||||||
def on_detected(self, callback: Callable[[str, str], None]) -> None:
|
|
||||||
self.on_detected_callback = callback
|
|
||||||
|
|
||||||
def on_audio_data(self, audio_data: np.ndarray) -> None:
|
|
||||||
if not self.enabled or not self.is_running_flag or self.paused:
|
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
|
||||||
self._audio_queue.put_nowait(audio_data.copy())
|
|
||||||
except queue.Full:
|
|
||||||
try:
|
|
||||||
self._audio_queue.get_nowait()
|
|
||||||
self._audio_queue.put_nowait(audio_data.copy())
|
|
||||||
except queue.Empty:
|
|
||||||
pass
|
|
||||||
except Exception as exc:
|
|
||||||
logger.debug("audio data enqueue failed: %s", exc)
|
|
||||||
|
|
||||||
def start(self, audio_source) -> None:
|
|
||||||
if not self.enabled:
|
|
||||||
logger.info("wakeword detector disabled")
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.keyword_spotter is None or self.stream is None:
|
|
||||||
self.initialize()
|
|
||||||
|
|
||||||
if self.is_running_flag:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.audio_source = audio_source
|
|
||||||
self.audio_source.add_audio_listener(self)
|
|
||||||
self.is_running_flag = True
|
|
||||||
self.paused = False
|
|
||||||
self._worker_thread = threading.Thread(
|
|
||||||
target=self._detection_loop,
|
|
||||||
name="wakeword-detector",
|
|
||||||
daemon=True,
|
|
||||||
)
|
|
||||||
self._worker_thread.start()
|
|
||||||
logger.info("wakeword detector started")
|
|
||||||
|
|
||||||
def stop(self) -> None:
|
|
||||||
if not self.is_running_flag and self.audio_source is None and self._worker_thread is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.is_running_flag = False
|
|
||||||
|
|
||||||
if self.audio_source is not None:
|
|
||||||
self.audio_source.remove_audio_listener(self)
|
|
||||||
self.audio_source = None
|
|
||||||
|
|
||||||
if self._worker_thread is not None:
|
|
||||||
self._worker_thread.join(timeout=1.0)
|
|
||||||
self._worker_thread = None
|
|
||||||
|
|
||||||
while not self._audio_queue.empty():
|
|
||||||
try:
|
|
||||||
self._audio_queue.get_nowait()
|
|
||||||
except queue.Empty:
|
|
||||||
break
|
|
||||||
|
|
||||||
logger.info("wakeword detector stopped")
|
|
||||||
|
|
||||||
def _detection_loop(self) -> None:
|
|
||||||
error_count = 0
|
|
||||||
max_errors = 5
|
|
||||||
|
|
||||||
while self.is_running_flag:
|
|
||||||
try:
|
|
||||||
if self.paused:
|
|
||||||
time.sleep(0.1)
|
|
||||||
continue
|
|
||||||
|
|
||||||
audio_data = self._audio_queue.get(timeout=0.1)
|
|
||||||
result = self.process_audio_chunk(audio_data)
|
|
||||||
if result and self.on_detected_callback is not None:
|
|
||||||
self.on_detected_callback(result, result)
|
|
||||||
error_count = 0
|
|
||||||
except queue.Empty:
|
|
||||||
continue
|
|
||||||
except Exception as exc:
|
|
||||||
error_count += 1
|
|
||||||
logger.error("wakeword detection loop error(%s/%s): %s", error_count, max_errors, exc)
|
|
||||||
if self.on_error is not None:
|
|
||||||
try:
|
|
||||||
self.on_error(exc)
|
|
||||||
except Exception:
|
|
||||||
logger.exception("wakeword error callback failed")
|
|
||||||
if error_count >= max_errors:
|
|
||||||
logger.critical("too many wakeword detection errors, stopping detector")
|
|
||||||
break
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
self.is_running_flag = False
|
|
||||||
|
|
||||||
def process_audio_chunk(self, audio_data: np.ndarray) -> str | None:
|
|
||||||
if self.keyword_spotter is None or self.stream is None:
|
|
||||||
raise RuntimeError("detector is not initialized")
|
|
||||||
|
|
||||||
if audio_data is None or len(audio_data) == 0:
|
|
||||||
return None
|
|
||||||
|
|
||||||
if audio_data.dtype == np.int16:
|
|
||||||
samples = audio_data.astype(np.float32) / 32768.0
|
|
||||||
else:
|
|
||||||
samples = audio_data.astype(np.float32)
|
|
||||||
|
|
||||||
sample_rate = self.config.audio.sample_rate
|
|
||||||
self.stream.accept_waveform(sample_rate=sample_rate, waveform=samples)
|
|
||||||
|
|
||||||
if not self.keyword_spotter.is_ready(self.stream):
|
|
||||||
return None
|
|
||||||
|
|
||||||
self.keyword_spotter.decode_stream(self.stream)
|
|
||||||
result = self.keyword_spotter.get_result(self.stream)
|
|
||||||
if not result:
|
|
||||||
return None
|
|
||||||
|
|
||||||
self.keyword_spotter.reset_stream(self.stream)
|
|
||||||
|
|
||||||
current_time = time.time()
|
|
||||||
if current_time - self.last_detection_time < self.detection_cooldown:
|
|
||||||
return None
|
|
||||||
|
|
||||||
self.last_detection_time = current_time
|
|
||||||
return str(result)
|
|
||||||
|
|
@ -1,94 +0,0 @@
|
||||||
from dataclasses import dataclass
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from ..config import RuntimeConfig
|
|
||||||
|
|
||||||
REQUIRED_MODEL_FILES = (
|
|
||||||
"encoder.onnx",
|
|
||||||
"decoder.onnx",
|
|
||||||
"joiner.onnx",
|
|
||||||
"tokens.txt",
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
|
||||||
class DetectorAssets:
|
|
||||||
model_root: Path
|
|
||||||
tokens_file: Path
|
|
||||||
encoder_file: Path
|
|
||||||
decoder_file: Path
|
|
||||||
joiner_file: Path
|
|
||||||
keywords_file: Path
|
|
||||||
|
|
||||||
|
|
||||||
class DetectorAssetsBuilder:
|
|
||||||
def __init__(self, config: RuntimeConfig) -> None:
|
|
||||||
self.config = config
|
|
||||||
|
|
||||||
def prepare(self) -> DetectorAssets:
|
|
||||||
model_root = self._resolve_model_root()
|
|
||||||
keywords_file = self._write_keywords_file(model_root)
|
|
||||||
return DetectorAssets(
|
|
||||||
model_root=model_root,
|
|
||||||
tokens_file=model_root / "tokens.txt",
|
|
||||||
encoder_file=model_root / "encoder.onnx",
|
|
||||||
decoder_file=model_root / "decoder.onnx",
|
|
||||||
joiner_file=model_root / "joiner.onnx",
|
|
||||||
keywords_file=keywords_file,
|
|
||||||
)
|
|
||||||
|
|
||||||
def _resolve_model_root(self) -> Path:
|
|
||||||
preferred = self.config.model_dir
|
|
||||||
if self._has_required_files(preferred):
|
|
||||||
return preferred
|
|
||||||
|
|
||||||
raise FileNotFoundError(
|
|
||||||
"No valid model directory found. Expected configured model files to exist."
|
|
||||||
)
|
|
||||||
|
|
||||||
def _write_keywords_file(self, model_root: Path) -> Path:
|
|
||||||
try:
|
|
||||||
from pypinyin import Style, pinyin
|
|
||||||
except ImportError as exc:
|
|
||||||
raise RuntimeError(
|
|
||||||
"Missing dependency: pypinyin. Install runtime dependencies before generating keywords."
|
|
||||||
) from exc
|
|
||||||
|
|
||||||
wake_words = self.config.wake_words
|
|
||||||
if not wake_words:
|
|
||||||
raise ValueError("keywords.txt cannot be empty")
|
|
||||||
|
|
||||||
keywords_path = model_root / "keywords.txt"
|
|
||||||
lines: list[str] = []
|
|
||||||
for keyword_text in wake_words:
|
|
||||||
initials = pinyin(keyword_text, style=Style.INITIALS, strict=False)
|
|
||||||
finals = pinyin(
|
|
||||||
keyword_text,
|
|
||||||
style=Style.FINALS_TONE,
|
|
||||||
strict=False,
|
|
||||||
neutral_tone_with_five=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
tokens: list[str] = []
|
|
||||||
for initial_parts, final_parts in zip(initials, finals):
|
|
||||||
initial = initial_parts[0].strip()
|
|
||||||
final = final_parts[0].strip()
|
|
||||||
if initial:
|
|
||||||
tokens.append(initial)
|
|
||||||
if final:
|
|
||||||
tokens.append(final)
|
|
||||||
|
|
||||||
if not tokens:
|
|
||||||
raise ValueError(
|
|
||||||
f"failed to generate pinyin tokens for wake word: {keyword_text}"
|
|
||||||
)
|
|
||||||
|
|
||||||
lines.append(f"{' '.join(tokens)} @{keyword_text}")
|
|
||||||
|
|
||||||
keywords_path.write_text("\n".join(lines) + "\n", encoding="utf-8")
|
|
||||||
return keywords_path
|
|
||||||
|
|
||||||
def _has_required_files(self, directory: Path) -> bool:
|
|
||||||
if not directory.exists():
|
|
||||||
return False
|
|
||||||
return all((directory / file_name).exists() for file_name in REQUIRED_MODEL_FILES)
|
|
||||||
|
|
@ -1,91 +0,0 @@
|
||||||
import logging
|
|
||||||
from typing import Protocol
|
|
||||||
|
|
||||||
import numpy as np
|
|
||||||
|
|
||||||
from ..config import RuntimeConfig
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class AudioListener(Protocol):
|
|
||||||
def on_audio_data(self, audio_data: np.ndarray) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
class MicrophoneListener:
|
|
||||||
|
|
||||||
def __init__(self, config: RuntimeConfig) -> None:
|
|
||||||
self.config = config
|
|
||||||
self._stream = None
|
|
||||||
self._running = False
|
|
||||||
self._listeners: list[AudioListener] = []
|
|
||||||
self._sample_rate = self.config.audio.sample_rate
|
|
||||||
self._channels = self.config.audio.channels
|
|
||||||
self._device = self.config.audio.input_device
|
|
||||||
self._block_duration_ms = 30
|
|
||||||
self._block_size = int(self._sample_rate * (self._block_duration_ms / 1000))
|
|
||||||
|
|
||||||
def add_audio_listener(self, listener: AudioListener) -> None:
|
|
||||||
if listener not in self._listeners:
|
|
||||||
self._listeners.append(listener)
|
|
||||||
|
|
||||||
def remove_audio_listener(self, listener: AudioListener) -> None:
|
|
||||||
if listener in self._listeners:
|
|
||||||
self._listeners.remove(listener)
|
|
||||||
|
|
||||||
def start(self) -> None:
|
|
||||||
try:
|
|
||||||
import sounddevice as sd
|
|
||||||
except ImportError as exc:
|
|
||||||
raise RuntimeError(
|
|
||||||
"Missing dependency: sounddevice. Install runtime dependencies before starting microphone listener."
|
|
||||||
) from exc
|
|
||||||
|
|
||||||
self._stream = sd.InputStream(
|
|
||||||
device=self._device,
|
|
||||||
samplerate=self._sample_rate,
|
|
||||||
channels=self._channels,
|
|
||||||
dtype="int16",
|
|
||||||
blocksize=self._block_size,
|
|
||||||
callback=self._input_callback,
|
|
||||||
latency="low",
|
|
||||||
)
|
|
||||||
self._stream.start()
|
|
||||||
self._running = True
|
|
||||||
|
|
||||||
logger.info("microphone listener started")
|
|
||||||
logger.info("microphone sample rate: %s", self._sample_rate)
|
|
||||||
logger.info("microphone channels: %s", self._channels)
|
|
||||||
logger.info("microphone device: %s", self._device if self._device is not None else "default")
|
|
||||||
logger.info("microphone block size: %s", self._block_size)
|
|
||||||
|
|
||||||
def stop(self) -> None:
|
|
||||||
if not self._running and self._stream is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
self._running = False
|
|
||||||
if self._stream is not None:
|
|
||||||
try:
|
|
||||||
self._stream.stop()
|
|
||||||
finally:
|
|
||||||
self._stream.close()
|
|
||||||
self._stream = None
|
|
||||||
logger.info("microphone listener stopped")
|
|
||||||
|
|
||||||
def _input_callback(self, indata, frames, time_info, status) -> None:
|
|
||||||
_ = frames, time_info
|
|
||||||
if status and "overflow" not in str(status).lower():
|
|
||||||
logger.warning("microphone status: %s", status)
|
|
||||||
|
|
||||||
audio = np.copy(indata)
|
|
||||||
if audio.ndim > 1:
|
|
||||||
audio = audio[:, 0]
|
|
||||||
else:
|
|
||||||
audio = audio.reshape(-1)
|
|
||||||
|
|
||||||
for listener in list(self._listeners):
|
|
||||||
try:
|
|
||||||
listener.on_audio_data(audio)
|
|
||||||
except Exception:
|
|
||||||
logger.exception("audio listener callback failed")
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
from .audio import AudioPlugin
|
|
||||||
from .base import Plugin
|
|
||||||
from .manager import PluginManager
|
|
||||||
from .wake_word import WakeWordPlugin
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
import logging
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from ..core import MicrophoneListener
|
|
||||||
from .base import Plugin
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class AudioPlugin(Plugin):
|
|
||||||
name = "audio"
|
|
||||||
priority = 10
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
|
||||||
self.app = None
|
|
||||||
self.source: MicrophoneListener | None = None
|
|
||||||
|
|
||||||
def setup(self, app: Any) -> None:
|
|
||||||
self.app = app
|
|
||||||
self.source = MicrophoneListener(app.config)
|
|
||||||
self.app.audio_source = self.source
|
|
||||||
|
|
||||||
def start(self) -> None:
|
|
||||||
if self.source is None:
|
|
||||||
logger.warning("audio source not initialized")
|
|
||||||
return
|
|
||||||
self.source.start()
|
|
||||||
|
|
||||||
def stop(self) -> None:
|
|
||||||
if self.source is not None:
|
|
||||||
self.source.stop()
|
|
||||||
|
|
||||||
def shutdown(self) -> None:
|
|
||||||
if self.app is not None:
|
|
||||||
self.app.audio_source = None
|
|
||||||
self.source = None
|
|
||||||
self.app = None
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
|
|
||||||
class Plugin:
|
|
||||||
name: str = "plugin"
|
|
||||||
priority: int = 50
|
|
||||||
|
|
||||||
def setup(self, app: Any) -> None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def start(self) -> None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def stop(self) -> None:
|
|
||||||
return None
|
|
||||||
|
|
||||||
def shutdown(self) -> None:
|
|
||||||
return None
|
|
||||||
|
|
@ -1,37 +0,0 @@
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from .base import Plugin
|
|
||||||
|
|
||||||
|
|
||||||
class PluginManager:
|
|
||||||
def __init__(self) -> None:
|
|
||||||
self._plugins: list[Plugin] = []
|
|
||||||
self._by_name: dict[str, Plugin] = {}
|
|
||||||
|
|
||||||
def register(self, *plugins: Plugin) -> None:
|
|
||||||
for plugin in sorted(plugins, key=lambda item: getattr(item, "priority", 50)):
|
|
||||||
if plugin in self._plugins:
|
|
||||||
continue
|
|
||||||
self._plugins.append(plugin)
|
|
||||||
name = getattr(plugin, "name", "")
|
|
||||||
if isinstance(name, str) and name:
|
|
||||||
self._by_name[name] = plugin
|
|
||||||
|
|
||||||
def get_plugin(self, name: str) -> Plugin | None:
|
|
||||||
return self._by_name.get(name)
|
|
||||||
|
|
||||||
def setup_all(self, app: Any) -> None:
|
|
||||||
for plugin in list(self._plugins):
|
|
||||||
plugin.setup(app)
|
|
||||||
|
|
||||||
def start_all(self) -> None:
|
|
||||||
for plugin in list(self._plugins):
|
|
||||||
plugin.start()
|
|
||||||
|
|
||||||
def stop_all(self) -> None:
|
|
||||||
for plugin in reversed(self._plugins):
|
|
||||||
plugin.stop()
|
|
||||||
|
|
||||||
def shutdown_all(self) -> None:
|
|
||||||
for plugin in reversed(self._plugins):
|
|
||||||
plugin.shutdown()
|
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
import logging
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from ..core import WakewordDetector
|
|
||||||
from .base import Plugin
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class WakeWordPlugin(Plugin):
|
|
||||||
name = "wake_word"
|
|
||||||
priority = 30
|
|
||||||
|
|
||||||
def __init__(self) -> None:
|
|
||||||
self.app = None
|
|
||||||
self.detector: WakewordDetector | None = None
|
|
||||||
|
|
||||||
def setup(self, app: Any) -> None:
|
|
||||||
self.app = app
|
|
||||||
self.detector = WakewordDetector(app.config)
|
|
||||||
if not self.detector.enabled:
|
|
||||||
self.detector = None
|
|
||||||
return
|
|
||||||
self.detector.on_detected(self._on_detected)
|
|
||||||
self.detector.on_error = self._on_error
|
|
||||||
|
|
||||||
def start(self) -> None:
|
|
||||||
if self.detector is None:
|
|
||||||
return
|
|
||||||
|
|
||||||
audio_plugin = self.app.plugins.get_plugin("audio") if self.app else None
|
|
||||||
audio_source = getattr(audio_plugin, "source", None)
|
|
||||||
if audio_source is None:
|
|
||||||
logger.warning("audio source unavailable, wakeword plugin not started")
|
|
||||||
return
|
|
||||||
|
|
||||||
self.detector.start(audio_source)
|
|
||||||
|
|
||||||
def stop(self) -> None:
|
|
||||||
if self.detector is not None:
|
|
||||||
self.detector.stop()
|
|
||||||
|
|
||||||
def shutdown(self) -> None:
|
|
||||||
self.detector = None
|
|
||||||
self.app = None
|
|
||||||
|
|
||||||
def _on_detected(self, wake_word: str, full_text: str) -> None:
|
|
||||||
if self.app is None:
|
|
||||||
return
|
|
||||||
self.app.handle_wake_word_detected(wake_word, full_text)
|
|
||||||
|
|
||||||
def _on_error(self, error: Exception) -> None:
|
|
||||||
logger.error("wakeword detection error: %s", error)
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
sherpa-onnx==1.12.29
|
|
||||||
sounddevice>=0.4.4
|
|
||||||
pypinyin==0.55.0
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
from .app import TestRuntimeApplication
|
|
||||||
from .http_server import TestRuntimeHttpServer
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
import logging
|
|
||||||
from typing import Protocol
|
|
||||||
|
|
||||||
from ..config import RuntimeConfig
|
|
||||||
from ..plugins import AudioPlugin, PluginManager, WakeWordPlugin
|
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
|
|
||||||
class EventPublisher(Protocol):
|
|
||||||
def publish_service_ready(self) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
def publish_service_stopping(self) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
def publish_detected(self, wake_word: str) -> None:
|
|
||||||
...
|
|
||||||
|
|
||||||
|
|
||||||
class TestRuntimeApplication:
|
|
||||||
def __init__(self, config: RuntimeConfig, event_publisher: EventPublisher) -> None:
|
|
||||||
self.config = config
|
|
||||||
self.event_bridge = event_publisher
|
|
||||||
self.plugins = PluginManager()
|
|
||||||
self.audio_source = None
|
|
||||||
self._is_setup = False
|
|
||||||
self._is_running = False
|
|
||||||
|
|
||||||
def setup(self) -> None:
|
|
||||||
if self._is_setup:
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.config.wakeword_enabled:
|
|
||||||
self.plugins.register(
|
|
||||||
AudioPlugin(),
|
|
||||||
WakeWordPlugin(),
|
|
||||||
)
|
|
||||||
self.plugins.setup_all(self)
|
|
||||||
self._is_setup = True
|
|
||||||
|
|
||||||
def start(self) -> None:
|
|
||||||
if self._is_running:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.setup()
|
|
||||||
self.plugins.start_all()
|
|
||||||
if self.config.wakeword_enabled:
|
|
||||||
self.event_bridge.publish_service_ready()
|
|
||||||
self._is_running = True
|
|
||||||
logger.info("test runtime application started")
|
|
||||||
|
|
||||||
def stop(self) -> None:
|
|
||||||
if not self._is_running:
|
|
||||||
return
|
|
||||||
|
|
||||||
self.event_bridge.publish_service_stopping()
|
|
||||||
self.plugins.stop_all()
|
|
||||||
self._is_running = False
|
|
||||||
logger.info("test runtime application stopped")
|
|
||||||
|
|
||||||
def shutdown(self) -> None:
|
|
||||||
self.stop()
|
|
||||||
if self._is_setup:
|
|
||||||
self.plugins.shutdown_all()
|
|
||||||
|
|
||||||
def handle_wake_word_detected(self, wake_word: str, full_text: str) -> None:
|
|
||||||
_ = full_text
|
|
||||||
logger.info("wake word detected: %s", wake_word)
|
|
||||||
self.event_bridge.publish_detected(wake_word)
|
|
||||||
|
|
@ -1,352 +0,0 @@
|
||||||
import base64
|
|
||||||
import hashlib
|
|
||||||
import json
|
|
||||||
import queue
|
|
||||||
import socket
|
|
||||||
import threading
|
|
||||||
from http import HTTPStatus
|
|
||||||
from http.server import SimpleHTTPRequestHandler, ThreadingHTTPServer
|
|
||||||
from pathlib import Path
|
|
||||||
from typing import Callable
|
|
||||||
|
|
||||||
from ..bridge import WakewordEventBridge
|
|
||||||
from ..config.config_loader import load_config
|
|
||||||
|
|
||||||
|
|
||||||
class TestRuntimeHttpServer:
|
|
||||||
def __init__(self, test_root: Path, host: str = "0.0.0.0", port: int = 8006) -> None:
|
|
||||||
self.test_root = test_root
|
|
||||||
self.host = host
|
|
||||||
self.port = port
|
|
||||||
self.event_bridge = WakewordEventBridge()
|
|
||||||
self._restart_handler: Callable[[], None] | None = None
|
|
||||||
self._restart_lock = threading.Lock()
|
|
||||||
self._server = self._build_server()
|
|
||||||
|
|
||||||
@property
|
|
||||||
def page_url(self) -> str:
|
|
||||||
return f"http://127.0.0.1:{self.port}/index.html"
|
|
||||||
|
|
||||||
@property
|
|
||||||
def bridge_url(self) -> str:
|
|
||||||
return f"ws://127.0.0.1:{self.port}/wakeword-ws"
|
|
||||||
|
|
||||||
def serve_forever(self) -> None:
|
|
||||||
self._server.serve_forever()
|
|
||||||
|
|
||||||
def shutdown(self) -> None:
|
|
||||||
self._server.shutdown()
|
|
||||||
self.event_bridge.close()
|
|
||||||
self._server.server_close()
|
|
||||||
|
|
||||||
def set_restart_handler(self, handler: Callable[[], None]) -> None:
|
|
||||||
self._restart_handler = handler
|
|
||||||
|
|
||||||
def request_runtime_restart(self) -> None:
|
|
||||||
with self._restart_lock:
|
|
||||||
handler = self._restart_handler
|
|
||||||
|
|
||||||
if handler is None:
|
|
||||||
raise RuntimeError("restart handler is not configured")
|
|
||||||
|
|
||||||
threading.Thread(
|
|
||||||
target=self._run_restart_handler,
|
|
||||||
name="test-runtime-restart",
|
|
||||||
daemon=True,
|
|
||||||
).start()
|
|
||||||
|
|
||||||
def _run_restart_handler(self) -> None:
|
|
||||||
handler = self._restart_handler
|
|
||||||
if handler is None:
|
|
||||||
return
|
|
||||||
handler()
|
|
||||||
|
|
||||||
def _build_server(self) -> ThreadingHTTPServer:
|
|
||||||
test_root = self.test_root
|
|
||||||
event_bridge = self.event_bridge
|
|
||||||
schedule_restart = self.request_runtime_restart
|
|
||||||
|
|
||||||
class TestRuntimeHandler(SimpleHTTPRequestHandler):
|
|
||||||
protocol_version = "HTTP/1.1"
|
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super().__init__(*args, directory=str(test_root), **kwargs)
|
|
||||||
|
|
||||||
def handle(self) -> None:
|
|
||||||
try:
|
|
||||||
super().handle()
|
|
||||||
except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def do_GET(self) -> None:
|
|
||||||
if self.path == "/wakeword-ws":
|
|
||||||
self._handle_websocket(event_bridge)
|
|
||||||
return
|
|
||||||
|
|
||||||
if self.path == "/health":
|
|
||||||
body = json.dumps({"status": "ok"}).encode("utf-8")
|
|
||||||
self.send_response(HTTPStatus.OK)
|
|
||||||
self.send_header("Content-Type", "application/json; charset=utf-8")
|
|
||||||
self.send_header("Cache-Control", "no-cache")
|
|
||||||
self.send_header("Content-Length", str(len(body)))
|
|
||||||
self.end_headers()
|
|
||||||
self.wfile.write(body)
|
|
||||||
return
|
|
||||||
|
|
||||||
super().do_GET()
|
|
||||||
|
|
||||||
def log_message(self, format: str, *args) -> None:
|
|
||||||
return
|
|
||||||
|
|
||||||
def _handle_websocket(self, bridge: WakewordEventBridge) -> None:
|
|
||||||
if self.headers.get("Upgrade", "").lower() != "websocket":
|
|
||||||
self.send_error(HTTPStatus.BAD_REQUEST, "expected websocket upgrade")
|
|
||||||
return
|
|
||||||
|
|
||||||
websocket_key = self.headers.get("Sec-WebSocket-Key")
|
|
||||||
if not websocket_key:
|
|
||||||
self.send_error(HTTPStatus.BAD_REQUEST, "missing Sec-WebSocket-Key")
|
|
||||||
return
|
|
||||||
|
|
||||||
accept_source = websocket_key + "258EAFA5-E914-47DA-95CA-C5AB0DC85B11"
|
|
||||||
accept_value = base64.b64encode(
|
|
||||||
hashlib.sha1(accept_source.encode("utf-8")).digest()
|
|
||||||
).decode("ascii")
|
|
||||||
|
|
||||||
client_queue = bridge.add_client()
|
|
||||||
self.send_response(HTTPStatus.SWITCHING_PROTOCOLS)
|
|
||||||
self.send_header("Upgrade", "websocket")
|
|
||||||
self.send_header("Connection", "Upgrade")
|
|
||||||
self.send_header("Sec-WebSocket-Accept", accept_value)
|
|
||||||
self.end_headers()
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.connection.settimeout(0.2)
|
|
||||||
self._send_websocket_text(bridge.build_ready_message())
|
|
||||||
self._send_websocket_text(self._build_wakeword_config_message(bridge))
|
|
||||||
|
|
||||||
while bridge.is_running:
|
|
||||||
inbound_message = self._receive_websocket_message()
|
|
||||||
if inbound_message is not None:
|
|
||||||
response_message = self._handle_bridge_request(bridge, inbound_message)
|
|
||||||
if response_message:
|
|
||||||
self._send_websocket_text(response_message)
|
|
||||||
|
|
||||||
try:
|
|
||||||
message = client_queue.get(timeout=0.2)
|
|
||||||
if message == "__bridge_closed__":
|
|
||||||
break
|
|
||||||
self._send_websocket_text(message)
|
|
||||||
except queue.Empty:
|
|
||||||
if not bridge.is_running:
|
|
||||||
break
|
|
||||||
continue
|
|
||||||
except socket.timeout:
|
|
||||||
pass
|
|
||||||
except (BrokenPipeError, ConnectionResetError, ConnectionAbortedError):
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
bridge.remove_client(client_queue)
|
|
||||||
|
|
||||||
def _build_wakeword_config_message(self, bridge: WakewordEventBridge) -> str:
|
|
||||||
try:
|
|
||||||
runtime_root = test_root / "wakeword_runtime"
|
|
||||||
config = load_config(runtime_root)
|
|
||||||
payload = {
|
|
||||||
"enabled": config.wakeword_enabled,
|
|
||||||
"wakeWords": config.wake_words,
|
|
||||||
}
|
|
||||||
return bridge.build_message("wakeword_config", payload)
|
|
||||||
except Exception as exc:
|
|
||||||
return bridge.build_message(
|
|
||||||
"wakeword_config",
|
|
||||||
{},
|
|
||||||
success=False,
|
|
||||||
error=f"读取唤醒词配置失败: {exc}",
|
|
||||||
)
|
|
||||||
|
|
||||||
def _handle_bridge_request(self, bridge: WakewordEventBridge, raw_message: str) -> str | None:
|
|
||||||
try:
|
|
||||||
message = json.loads(raw_message)
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
return None
|
|
||||||
|
|
||||||
message_type = str(message.get("type", "")).strip()
|
|
||||||
request_id = message.get("requestId")
|
|
||||||
payload = message.get("payload") or {}
|
|
||||||
result_type = f"{message_type}_result" if message_type else "bridge_request_result"
|
|
||||||
|
|
||||||
if message_type == "set_wakeword_config":
|
|
||||||
try:
|
|
||||||
result_payload = self._save_wakeword_config(payload)
|
|
||||||
bridge.publish("wakeword_config", result_payload)
|
|
||||||
return bridge.build_message(
|
|
||||||
"set_wakeword_config_result",
|
|
||||||
result_payload,
|
|
||||||
request_id=request_id,
|
|
||||||
)
|
|
||||||
except Exception as exc:
|
|
||||||
return bridge.build_message(
|
|
||||||
"set_wakeword_config_result",
|
|
||||||
{},
|
|
||||||
request_id=request_id,
|
|
||||||
success=False,
|
|
||||||
error=f"保存唤醒词配置失败: {exc}",
|
|
||||||
)
|
|
||||||
|
|
||||||
if message_type == "restart_wakeword_service":
|
|
||||||
schedule_restart()
|
|
||||||
return bridge.build_message(
|
|
||||||
"restart_wakeword_service_result",
|
|
||||||
{"restarting": True},
|
|
||||||
request_id=request_id,
|
|
||||||
)
|
|
||||||
|
|
||||||
return bridge.build_message(
|
|
||||||
result_type,
|
|
||||||
{},
|
|
||||||
request_id=request_id,
|
|
||||||
success=False,
|
|
||||||
error=f"unsupported message type: {message_type}",
|
|
||||||
)
|
|
||||||
|
|
||||||
def _save_wakeword_config(self, payload: dict) -> dict:
|
|
||||||
runtime_root = test_root / "wakeword_runtime"
|
|
||||||
config_path = runtime_root / "config.json"
|
|
||||||
model_root = runtime_root / "models"
|
|
||||||
keywords_path = model_root / "keywords.txt"
|
|
||||||
|
|
||||||
enabled = bool(payload.get("enabled", True))
|
|
||||||
wake_words = payload.get("wakeWords") or []
|
|
||||||
normalized_wake_words = []
|
|
||||||
for item in wake_words:
|
|
||||||
if not isinstance(item, str):
|
|
||||||
continue
|
|
||||||
text = item.strip()
|
|
||||||
if text and text not in normalized_wake_words:
|
|
||||||
normalized_wake_words.append(text)
|
|
||||||
|
|
||||||
if enabled and not normalized_wake_words:
|
|
||||||
raise ValueError("wakeWords cannot be empty when wakeword is enabled")
|
|
||||||
|
|
||||||
raw_config = json.loads(config_path.read_text(encoding="utf-8"))
|
|
||||||
raw_config.setdefault("wakeword", {})["enabled"] = enabled
|
|
||||||
config_path.write_text(
|
|
||||||
json.dumps(raw_config, indent=2, ensure_ascii=False),
|
|
||||||
encoding="utf-8",
|
|
||||||
)
|
|
||||||
|
|
||||||
keywords_lines = [self._build_keyword_line(item) for item in normalized_wake_words]
|
|
||||||
keywords_path.write_text(
|
|
||||||
("\n".join(keywords_lines) + "\n") if keywords_lines else "",
|
|
||||||
encoding="utf-8",
|
|
||||||
)
|
|
||||||
|
|
||||||
return {
|
|
||||||
"enabled": enabled,
|
|
||||||
"wakeWords": normalized_wake_words,
|
|
||||||
}
|
|
||||||
|
|
||||||
def _build_keyword_line(self, keyword_text: str) -> str:
|
|
||||||
from pypinyin import Style, pinyin
|
|
||||||
|
|
||||||
initials = pinyin(keyword_text, style=Style.INITIALS, strict=False)
|
|
||||||
finals = pinyin(
|
|
||||||
keyword_text,
|
|
||||||
style=Style.FINALS_TONE,
|
|
||||||
strict=False,
|
|
||||||
neutral_tone_with_five=True,
|
|
||||||
)
|
|
||||||
|
|
||||||
tokens: list[str] = []
|
|
||||||
for initial_parts, final_parts in zip(initials, finals):
|
|
||||||
initial = initial_parts[0].strip()
|
|
||||||
final = final_parts[0].strip()
|
|
||||||
if initial:
|
|
||||||
tokens.append(initial)
|
|
||||||
if final:
|
|
||||||
tokens.append(final)
|
|
||||||
|
|
||||||
if not tokens:
|
|
||||||
raise ValueError(f"failed to generate pinyin tokens for wake word: {keyword_text}")
|
|
||||||
|
|
||||||
return f"{' '.join(tokens)} @{keyword_text}"
|
|
||||||
|
|
||||||
def _receive_websocket_message(self) -> str | None:
|
|
||||||
try:
|
|
||||||
header = self._read_exact(2)
|
|
||||||
except socket.timeout:
|
|
||||||
return None
|
|
||||||
|
|
||||||
if not header:
|
|
||||||
return None
|
|
||||||
|
|
||||||
first_byte, second_byte = header[0], header[1]
|
|
||||||
opcode = first_byte & 0x0F
|
|
||||||
masked = (second_byte & 0x80) != 0
|
|
||||||
payload_length = second_byte & 0x7F
|
|
||||||
|
|
||||||
if payload_length == 126:
|
|
||||||
payload_length = int.from_bytes(self._read_exact(2), "big")
|
|
||||||
elif payload_length == 127:
|
|
||||||
payload_length = int.from_bytes(self._read_exact(8), "big")
|
|
||||||
|
|
||||||
masking_key = self._read_exact(4) if masked else b""
|
|
||||||
payload = self._read_exact(payload_length) if payload_length else b""
|
|
||||||
|
|
||||||
if masked and payload:
|
|
||||||
payload = bytes(
|
|
||||||
byte ^ masking_key[index % 4]
|
|
||||||
for index, byte in enumerate(payload)
|
|
||||||
)
|
|
||||||
|
|
||||||
if opcode == 0x8:
|
|
||||||
raise ConnectionAbortedError("websocket closed by client")
|
|
||||||
|
|
||||||
if opcode == 0x9:
|
|
||||||
self._send_websocket_frame(0xA, payload)
|
|
||||||
return None
|
|
||||||
|
|
||||||
if opcode == 0xA:
|
|
||||||
return None
|
|
||||||
|
|
||||||
if opcode != 0x1:
|
|
||||||
return None
|
|
||||||
|
|
||||||
return payload.decode("utf-8")
|
|
||||||
|
|
||||||
def _read_exact(self, size: int) -> bytes:
|
|
||||||
if size <= 0:
|
|
||||||
return b""
|
|
||||||
|
|
||||||
chunks = bytearray()
|
|
||||||
while len(chunks) < size:
|
|
||||||
chunk = self.connection.recv(size - len(chunks))
|
|
||||||
if not chunk:
|
|
||||||
raise ConnectionResetError("websocket connection closed")
|
|
||||||
chunks.extend(chunk)
|
|
||||||
return bytes(chunks)
|
|
||||||
|
|
||||||
def _send_websocket_text(self, message: str) -> None:
|
|
||||||
self._send_websocket_frame(0x1, message.encode("utf-8"))
|
|
||||||
|
|
||||||
def _send_websocket_frame(self, opcode: int, payload: bytes) -> None:
|
|
||||||
header = bytearray()
|
|
||||||
header.append(0x80 | opcode)
|
|
||||||
|
|
||||||
payload_length = len(payload)
|
|
||||||
if payload_length < 126:
|
|
||||||
header.append(payload_length)
|
|
||||||
elif payload_length < 65536:
|
|
||||||
header.append(126)
|
|
||||||
header.extend(payload_length.to_bytes(2, "big"))
|
|
||||||
else:
|
|
||||||
header.append(127)
|
|
||||||
header.extend(payload_length.to_bytes(8, "big"))
|
|
||||||
|
|
||||||
self.wfile.write(bytes(header) + payload)
|
|
||||||
self.wfile.flush()
|
|
||||||
|
|
||||||
server = ThreadingHTTPServer((self.host, self.port), TestRuntimeHandler)
|
|
||||||
server.daemon_threads = True
|
|
||||||
return server
|
|
||||||
|
|
@ -16,28 +16,3 @@ Vue 3.x
|
||||||
# 接口文档
|
# 接口文档
|
||||||
启动后打开:http://localhost:8002/xiaozhi/doc.html
|
启动后打开:http://localhost:8002/xiaozhi/doc.html
|
||||||
|
|
||||||
# 跑测试
|
|
||||||
测试分两种:纯单元测试,和要真连 MySQL、Redis 的集成测试(`DeviceTest`、`loginControllerTest`、`ModelConfigPersistenceTest`)。
|
|
||||||
|
|
||||||
集成测试需要先起好 MySQL 8 和 Redis 8。没起的时候这类测试整类跳过,不会让构建变红,日志里会写明缺的是哪个依赖。CI 上不一样:依赖连不上就直接让构建失败,不许跳过,免得门禁被悄悄掏空。
|
|
||||||
|
|
||||||
本地用 Docker 起这两个依赖:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker run -d --name xiaozhi-mysql -p 3306:3306 \
|
|
||||||
-e MYSQL_ROOT_PASSWORD=123456 -e MYSQL_DATABASE=xiaozhi_esp32_server mysql:8.0
|
|
||||||
docker run -d --name xiaozhi-redis -p 6379:6379 redis:8.0
|
|
||||||
```
|
|
||||||
|
|
||||||
跑全部测试:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mvn -B test -DskipTests=false
|
|
||||||
```
|
|
||||||
|
|
||||||
只想编译、不跑测试:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mvn -B package -DskipTests=true
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,20 +20,18 @@
|
||||||
<java.version>21</java.version>
|
<java.version>21</java.version>
|
||||||
<junit.version>5.10.1</junit.version>
|
<junit.version>5.10.1</junit.version>
|
||||||
<druid.version>1.2.20</druid.version>
|
<druid.version>1.2.20</druid.version>
|
||||||
<mybatisplus.version>3.5.17</mybatisplus.version>
|
<mybatisplus.version>3.5.5</mybatisplus.version>
|
||||||
<hutool.version>5.8.46</hutool.version>
|
<hutool.version>5.8.24</hutool.version>
|
||||||
<jsoup.version>1.22.2</jsoup.version>
|
<jsoup.version>1.19.1</jsoup.version>
|
||||||
<knife4j.version>4.6.0</knife4j.version>
|
<knife4j.version>4.6.0</knife4j.version>
|
||||||
<springdoc.version>2.8.8</springdoc.version>
|
<springdoc.version>2.8.8</springdoc.version>
|
||||||
<commons-lang3.version>3.20.0</commons-lang3.version>
|
<commons-lang3.version>3.18.0</commons-lang3.version>
|
||||||
<shiro.version>2.0.2</shiro.version>
|
<shiro.version>2.0.2</shiro.version>
|
||||||
<captcha.version>1.6.2</captcha.version>
|
<captcha.version>1.6.2</captcha.version>
|
||||||
<guava.version>33.6.0-jre</guava.version>
|
<guava.version>33.0.0-jre</guava.version>
|
||||||
<liquibase-core.version>4.20.0</liquibase-core.version>
|
<liquibase-core.version>4.20.0</liquibase-core.version>
|
||||||
<aliyun-sms-version>4.1.0</aliyun-sms-version>
|
<aliyun-sms-version>4.1.0</aliyun-sms-version>
|
||||||
<okio-version>3.4.0</okio-version>
|
<okio-version>3.4.0</okio-version>
|
||||||
<skipTests>false</skipTests>
|
|
||||||
<argLine></argLine>
|
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
|
@ -177,13 +175,13 @@
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
|
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||||
<version>${mybatisplus.version}</version>
|
<version>${mybatisplus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>org.mybatis</groupId>
|
||||||
<artifactId>mybatis-plus-jsqlparser-4.9</artifactId>
|
<artifactId>mybatis-spring</artifactId>
|
||||||
<version>${mybatisplus.version}</version>
|
<version>3.0.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>cn.hutool</groupId>
|
<groupId>cn.hutool</groupId>
|
||||||
|
|
@ -273,22 +271,11 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
<plugin>
|
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<configuration>
|
|
||||||
<proc>full</proc>
|
|
||||||
<compilerArgs>
|
|
||||||
<arg>-Xlint:deprecation,unchecked</arg>
|
|
||||||
</compilerArgs>
|
|
||||||
</configuration>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
<configuration>
|
<configuration>
|
||||||
<skipTests>${skipTests}</skipTests>
|
<skipTests>true</skipTests>
|
||||||
<argLine>@{argLine} -Xshare:off -javaagent:"${settings.localRepository}/org/mockito/mockito-core/${mockito.version}/mockito-core-${mockito.version}.jar"</argLine>
|
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
|
|
|
||||||
|
|
@ -1,44 +0,0 @@
|
||||||
#!/usr/bin/env bash
|
|
||||||
# 检查那几个要连 MySQL 和 Redis 的集成测试是不是真的跑了。
|
|
||||||
# 守卫要是哪天手滑把它们全跳过了,CI 必须红,不能安安静静少跑一半门禁。
|
|
||||||
set -uo pipefail
|
|
||||||
|
|
||||||
REPORT_DIR="${1:-target/surefire-reports}"
|
|
||||||
|
|
||||||
WATCHED=(
|
|
||||||
"xiaozhi.modules.device.DeviceTest"
|
|
||||||
"xiaozhi.modules.model.service.impl.ModelConfigPersistenceTest"
|
|
||||||
"xiaozhi.modules.sys.loginControllerTest"
|
|
||||||
)
|
|
||||||
|
|
||||||
if [ ! -d "$REPORT_DIR" ]; then
|
|
||||||
echo "找不到测试报告目录:$REPORT_DIR"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
missing=()
|
|
||||||
for class in "${WATCHED[@]}"; do
|
|
||||||
count=0
|
|
||||||
for report in "$REPORT_DIR"/TEST-*.xml; do
|
|
||||||
[ -e "$report" ] || continue
|
|
||||||
name=$(sed -n 's/.*<testsuite[^>]*name="\([^"]*\)".*/\1/p' "$report" | head -1)
|
|
||||||
if [ "$name" = "$class" ]; then
|
|
||||||
count=$(sed -n 's/.*<testsuite[^>]*tests="\([0-9]*\)".*/\1/p' "$report" | head -1)
|
|
||||||
count=${count:-0}
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
if [ "$count" -eq 0 ]; then
|
|
||||||
missing+=("$class")
|
|
||||||
else
|
|
||||||
echo "OK $class 跑了 $count 条"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ ${#missing[@]} -ne 0 ]; then
|
|
||||||
echo "这几个集成测试一条都没跑:${missing[*]}"
|
|
||||||
echo "守卫把门禁掏空了,构建必须失败"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "集成测试都跑过了"
|
|
||||||
|
|
@ -95,14 +95,6 @@ public class SwaggerConfig {
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean
|
|
||||||
public GroupedOpenApi correctWordApi() {
|
|
||||||
return GroupedOpenApi.builder()
|
|
||||||
.group("correct-word")
|
|
||||||
.pathsToMatch("/correct-word/**")
|
|
||||||
.build();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public OpenAPI customOpenAPI() {
|
public OpenAPI customOpenAPI() {
|
||||||
return new OpenAPI().info(new Info()
|
return new OpenAPI().info(new Info()
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,6 @@ public interface Constant {
|
||||||
*/
|
*/
|
||||||
String SERVER_AUTH_ENABLED = "server.auth.enabled";
|
String SERVER_AUTH_ENABLED = "server.auth.enabled";
|
||||||
|
|
||||||
/**
|
|
||||||
* 系统功能菜单配置
|
|
||||||
*/
|
|
||||||
String SYSTEM_WEB_MENU = "system-web.menu";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无记忆
|
* 无记忆
|
||||||
*/
|
*/
|
||||||
|
|
@ -324,7 +319,7 @@ public interface Constant {
|
||||||
/**
|
/**
|
||||||
* 版本号
|
* 版本号
|
||||||
*/
|
*/
|
||||||
public static final String VERSION = "0.9.8";
|
public static final String VERSION = "0.9.3";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 无效固件URL
|
* 无效固件URL
|
||||||
|
|
|
||||||
|
|
@ -256,8 +256,4 @@ public interface ErrorCode {
|
||||||
int MCP_ACCESS_POINT_ADDRESS_NO_PERMISSION = 10200; // 没有权限查看该智能体的MCP接入点地址
|
int MCP_ACCESS_POINT_ADDRESS_NO_PERMISSION = 10200; // 没有权限查看该智能体的MCP接入点地址
|
||||||
int MCP_ACCESS_POINT_ADDRESS_NOT_CONFIGURED = 10201; // 请联系管理员进入参数管理配置mcp接入点地址
|
int MCP_ACCESS_POINT_ADDRESS_NOT_CONFIGURED = 10201; // 请联系管理员进入参数管理配置mcp接入点地址
|
||||||
int MCP_ACCESS_POINT_TOOLS_LIST_NO_PERMISSION = 10202; // 没有权限查看该智能体的MCP工具列表
|
int MCP_ACCESS_POINT_TOOLS_LIST_NO_PERMISSION = 10202; // 没有权限查看该智能体的MCP工具列表
|
||||||
|
|
||||||
// 替换词相关错误码
|
|
||||||
int CORRECT_WORD_FILE_NAME_EXISTS = 10203; // 文件名已存在
|
|
||||||
int FILE_SIZE_OVER_LIMIT = 10204; // 文件大小超过限制
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ public class DataFilterInterceptor implements InnerInterceptor {
|
||||||
private String getSelect(String buildSql, DataScope scope) {
|
private String getSelect(String buildSql, DataScope scope) {
|
||||||
try {
|
try {
|
||||||
Select select = (Select) CCJSqlParserUtil.parse(buildSql);
|
Select select = (Select) CCJSqlParserUtil.parse(buildSql);
|
||||||
PlainSelect plainSelect = select.getPlainSelect();
|
PlainSelect plainSelect = (PlainSelect) select.getSelectBody();
|
||||||
|
|
||||||
Expression expression = plainSelect.getWhere();
|
Expression expression = plainSelect.getWhere();
|
||||||
if (expression == null) {
|
if (expression == null) {
|
||||||
|
|
@ -82,4 +82,4 @@ public class DataFilterInterceptor implements InnerInterceptor {
|
||||||
return buildSql;
|
return buildSql;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -188,11 +188,4 @@ public class RedisKeys {
|
||||||
return "ota:upload:count:" + username;
|
return "ota:upload:count:" + username;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备通讯录缓存Key
|
|
||||||
*/
|
|
||||||
public static String getAddressBookKey() {
|
|
||||||
return "device:address_book:all";
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.function.BiFunction;
|
import java.util.function.BiConsumer;
|
||||||
|
|
||||||
import org.apache.ibatis.binding.MapperMethod;
|
import org.apache.ibatis.binding.MapperMethod;
|
||||||
import org.apache.ibatis.logging.Log;
|
import org.apache.ibatis.logging.Log;
|
||||||
|
|
@ -81,8 +81,8 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
|
||||||
// 处理排序字段
|
// 处理排序字段
|
||||||
if (orderField instanceof String) {
|
if (orderField instanceof String) {
|
||||||
orderFields.add((String) orderField);
|
orderFields.add((String) orderField);
|
||||||
} else if (orderField instanceof List<?> fields) {
|
} else if (orderField instanceof List) {
|
||||||
fields.forEach(field -> orderFields.add(String.class.cast(field)));
|
orderFields.addAll((List<String>) orderField);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 有排序字段则排序
|
// 有排序字段则排序
|
||||||
|
|
@ -142,12 +142,11 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
|
||||||
return SqlHelper.retBool(result);
|
return SqlHelper.retBool(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Class<?> currentMapperClass() {
|
protected Class<M> currentMapperClass() {
|
||||||
return ReflectionKit.getSuperClassGenericType(this.getClass(), BaseServiceImpl.class, 0);
|
return (Class<M>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseServiceImpl.class, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
public Class<T> currentModelClass() {
|
public Class<T> currentModelClass() {
|
||||||
return (Class<T>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseServiceImpl.class, 1);
|
return (Class<T>) ReflectionKit.getSuperClassGenericType(this.getClass(), BaseServiceImpl.class, 1);
|
||||||
}
|
}
|
||||||
|
|
@ -182,9 +181,8 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
|
||||||
* 执行批量操作
|
* 执行批量操作
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
protected <E> boolean executeBatch(Collection<E> list, int batchSize, BiFunction<SqlSession, E, Integer> operation) {
|
protected <E> boolean executeBatch(Collection<E> list, int batchSize, BiConsumer<SqlSession, E> consumer) {
|
||||||
return SqlHelper.executeBatch(SqlHelper.sqlSessionFactory(this.currentModelClass()), this.log, list, batchSize,
|
return SqlHelper.executeBatch(this.currentModelClass(), this.log, list, batchSize, consumer);
|
||||||
operation);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -211,7 +209,7 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
|
||||||
return executeBatch(entityList, batchSize, (sqlSession, entity) -> {
|
return executeBatch(entityList, batchSize, (sqlSession, entity) -> {
|
||||||
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
|
MapperMethod.ParamMap<T> param = new MapperMethod.ParamMap<>();
|
||||||
param.put(Constants.ENTITY, entity);
|
param.put(Constants.ENTITY, entity);
|
||||||
return sqlSession.update(sqlStatement, param);
|
sqlSession.update(sqlStatement, param);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,6 +225,6 @@ public abstract class BaseServiceImpl<M extends BaseMapper<T>, T> implements Bas
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean deleteBatchIds(Collection<? extends Serializable> idList) {
|
public boolean deleteBatchIds(Collection<? extends Serializable> idList) {
|
||||||
return SqlHelper.retBool(baseDao.deleteByIds(idList));
|
return SqlHelper.retBool(baseDao.deleteBatchIds(idList));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -24,7 +24,6 @@ import xiaozhi.common.utils.ConvertUtils;
|
||||||
public abstract class CrudServiceImpl<M extends BaseMapper<T>, T, D> extends BaseServiceImpl<M, T>
|
public abstract class CrudServiceImpl<M extends BaseMapper<T>, T, D> extends BaseServiceImpl<M, T>
|
||||||
implements CrudService<T, D> {
|
implements CrudService<T, D> {
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
|
||||||
protected Class<D> currentDtoClass() {
|
protected Class<D> currentDtoClass() {
|
||||||
return (Class<D>) ReflectionKit.getSuperClassGenericType(getClass(), CrudServiceImpl.class, 2);
|
return (Class<D>) ReflectionKit.getSuperClassGenericType(getClass(), CrudServiceImpl.class, 2);
|
||||||
}
|
}
|
||||||
|
|
@ -71,6 +70,6 @@ public abstract class CrudServiceImpl<M extends BaseMapper<T>, T, D> extends Bas
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void delete(Serializable[] ids) {
|
public void delete(Serializable[] ids) {
|
||||||
baseDao.deleteByIds(Arrays.asList(ids));
|
baseDao.deleteBatchIds(Arrays.asList(ids));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,52 @@
|
||||||
|
package xiaozhi.common.utils;
|
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
|
||||||
|
import java.security.MessageDigest;
|
||||||
|
import java.security.NoSuchAlgorithmException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 哈希加密算法的工具类
|
||||||
|
* @author zjy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
public class HashEncryptionUtil {
|
||||||
|
/**
|
||||||
|
* 使用md5进行加密
|
||||||
|
* @param context 被加密的内容
|
||||||
|
* @return 哈希值
|
||||||
|
*/
|
||||||
|
public static String Md5hexDigest(String context){
|
||||||
|
return hexDigest(context,"MD5");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 指定哈希算法进行加密
|
||||||
|
* @param context 被加密的内容
|
||||||
|
* @param algorithm 哈希算法
|
||||||
|
* @return 哈希值
|
||||||
|
*/
|
||||||
|
public static String hexDigest(String context,String algorithm ){
|
||||||
|
// 获取MD5算法实例
|
||||||
|
MessageDigest md = null;
|
||||||
|
try {
|
||||||
|
md = MessageDigest.getInstance(algorithm);
|
||||||
|
} catch (NoSuchAlgorithmException e) {
|
||||||
|
log.error("加密失败的算法:{}",algorithm);
|
||||||
|
throw new RuntimeException("加密失败,"+ algorithm +"哈希算法系统不支持");
|
||||||
|
}
|
||||||
|
// 计算智能体id的MD5值
|
||||||
|
byte[] messageDigest = md.digest(context.getBytes());
|
||||||
|
// 将字节数组转换为十六进制字符串
|
||||||
|
StringBuilder hexString = new StringBuilder();
|
||||||
|
for (byte b : messageDigest) {
|
||||||
|
String hex = Integer.toHexString(0xFF & b);
|
||||||
|
if (hex.length() == 1) {
|
||||||
|
hexString.append('0');
|
||||||
|
}
|
||||||
|
hexString.append(hex);
|
||||||
|
}
|
||||||
|
return hexString.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,9 +1,7 @@
|
||||||
package xiaozhi.common.utils;
|
package xiaozhi.common.utils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.LinkedHashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
import com.fasterxml.jackson.core.type.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||||
|
|
@ -18,10 +16,6 @@ import cn.hutool.core.util.StrUtil;
|
||||||
*/
|
*/
|
||||||
public class JsonUtils {
|
public class JsonUtils {
|
||||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||||
private static final TypeReference<Map<String, Object>> STRING_OBJECT_MAP = new TypeReference<>() {
|
|
||||||
};
|
|
||||||
private static final TypeReference<List<Map<String, Object>>> STRING_OBJECT_MAP_LIST = new TypeReference<>() {
|
|
||||||
};
|
|
||||||
|
|
||||||
public static String toJsonString(Object object) {
|
public static String toJsonString(Object object) {
|
||||||
try {
|
try {
|
||||||
|
|
@ -73,59 +67,4 @@ public class JsonUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Map<String, Object> parseMap(String text) {
|
|
||||||
if (StrUtil.isEmpty(text)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return parseObject(text, STRING_OBJECT_MAP);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Map<String, Object>> parseMapList(String text) {
|
|
||||||
if (StrUtil.isEmpty(text)) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return parseObject(text, STRING_OBJECT_MAP_LIST);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Map<String, Object> toStringObjectMap(Object value) {
|
|
||||||
if (value == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!(value instanceof Map<?, ?> map)) {
|
|
||||||
throw new ClassCastException("Expected Map but got " + value.getClass().getName());
|
|
||||||
}
|
|
||||||
|
|
||||||
Map<String, Object> result = new LinkedHashMap<>(map.size());
|
|
||||||
for (Map.Entry<?, ?> entry : map.entrySet()) {
|
|
||||||
result.put(String.class.cast(entry.getKey()), entry.getValue());
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<Map<String, Object>> toStringObjectMapList(Object value) {
|
|
||||||
if (value == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<?> list = List.class.cast(value);
|
|
||||||
List<Map<String, Object>> result = new ArrayList<>(list.size());
|
|
||||||
for (Object item : list) {
|
|
||||||
result.add(toStringObjectMap(item));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static <T> List<T> toList(Object value, Class<T> elementType) {
|
|
||||||
if (value == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
List<?> list = List.class.cast(value);
|
|
||||||
List<T> result = new ArrayList<>(list.size());
|
|
||||||
for (Object item : list) {
|
|
||||||
result.add(elementType.cast(item));
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,11 +75,11 @@ public class SensitiveDataUtils {
|
||||||
Object value = jsonObject.get(key);
|
Object value = jsonObject.get(key);
|
||||||
|
|
||||||
if (SENSITIVE_FIELDS.contains(key.toLowerCase()) && value instanceof String) {
|
if (SENSITIVE_FIELDS.contains(key.toLowerCase()) && value instanceof String) {
|
||||||
result.set(key, maskMiddle((String) value));
|
result.put(key, maskMiddle((String) value));
|
||||||
} else if (value instanceof JSONObject) {
|
} else if (value instanceof JSONObject) {
|
||||||
result.set(key, maskSensitiveFields((JSONObject) value));
|
result.put(key, maskSensitiveFields((JSONObject) value));
|
||||||
} else {
|
} else {
|
||||||
result.set(key, value);
|
result.put(key, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -162,4 +162,4 @@ public class SensitiveDataUtils {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,89 @@
|
||||||
|
package xiaozhi.common.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ReUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用工具类
|
||||||
|
*/
|
||||||
|
public class ToolUtil {
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(ToolUtil.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象是否不为空(新增)
|
||||||
|
*/
|
||||||
|
public static boolean isNotEmpty(Object o) {
|
||||||
|
return !isEmpty(o);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象是否为空
|
||||||
|
*/
|
||||||
|
public static boolean isEmpty(Object o) {
|
||||||
|
if (o == null) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (o instanceof String) {
|
||||||
|
if (o.toString().trim().equals("")) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (o instanceof List) {
|
||||||
|
if (((List) o).size() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (o instanceof Map) {
|
||||||
|
if (((Map) o).size() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (o instanceof Set) {
|
||||||
|
if (((Set) o).size() == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (o instanceof Object[]) {
|
||||||
|
if (((Object[]) o).length == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (o instanceof int[]) {
|
||||||
|
if (((int[]) o).length == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
} else if (o instanceof long[]) {
|
||||||
|
if (((long[]) o).length == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象组中是否存在空对象
|
||||||
|
*/
|
||||||
|
public static boolean isOneEmpty(Object... os) {
|
||||||
|
for (Object o : os) {
|
||||||
|
if (isEmpty(o)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 对象组中是否全是空对象
|
||||||
|
*/
|
||||||
|
public static boolean isAllEmpty(Object... os) {
|
||||||
|
for (Object o : os) {
|
||||||
|
if (!isEmpty(o)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -22,10 +22,10 @@ public class SqlFilter {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
// 去掉'|"|;|\字符
|
// 去掉'|"|;|\字符
|
||||||
str = str.replace("'", "");
|
str = StringUtils.replace(str, "'", "");
|
||||||
str = str.replace("\"", "");
|
str = StringUtils.replace(str, "\"", "");
|
||||||
str = str.replace(";", "");
|
str = StringUtils.replace(str, ";", "");
|
||||||
str = str.replace("\\", "");
|
str = StringUtils.replace(str, "\\", "");
|
||||||
|
|
||||||
// 转换成小写
|
// 转换成小写
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
|
|
|
||||||
|
|
@ -1,103 +0,0 @@
|
||||||
package xiaozhi.modules.agent.Enums;
|
|
||||||
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Function;
|
|
||||||
|
|
||||||
import lombok.Getter;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentSnapshotDataDTO;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
|
||||||
import xiaozhi.modules.agent.entity.AgentEntity;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
public enum AgentSnapshotField {
|
|
||||||
AGENT_CODE("agentCode", AgentSnapshotDataDTO::getAgentCode, AgentUpdateDTO::getAgentCode,
|
|
||||||
(agent, data) -> agent.setAgentCode(data.getAgentCode())),
|
|
||||||
AGENT_NAME("agentName", AgentSnapshotDataDTO::getAgentName, AgentUpdateDTO::getAgentName,
|
|
||||||
(agent, data) -> agent.setAgentName(data.getAgentName())),
|
|
||||||
ASR_MODEL_ID("asrModelId", AgentSnapshotDataDTO::getAsrModelId, AgentUpdateDTO::getAsrModelId,
|
|
||||||
(agent, data) -> agent.setAsrModelId(data.getAsrModelId())),
|
|
||||||
VAD_MODEL_ID("vadModelId", AgentSnapshotDataDTO::getVadModelId, AgentUpdateDTO::getVadModelId,
|
|
||||||
(agent, data) -> agent.setVadModelId(data.getVadModelId())),
|
|
||||||
LLM_MODEL_ID("llmModelId", AgentSnapshotDataDTO::getLlmModelId, AgentUpdateDTO::getLlmModelId,
|
|
||||||
(agent, data) -> agent.setLlmModelId(data.getLlmModelId())),
|
|
||||||
SLM_MODEL_ID("slmModelId", AgentSnapshotDataDTO::getSlmModelId, AgentUpdateDTO::getSlmModelId,
|
|
||||||
(agent, data) -> agent.setSlmModelId(data.getSlmModelId())),
|
|
||||||
VLLM_MODEL_ID("vllmModelId", AgentSnapshotDataDTO::getVllmModelId, AgentUpdateDTO::getVllmModelId,
|
|
||||||
(agent, data) -> agent.setVllmModelId(data.getVllmModelId())),
|
|
||||||
TTS_MODEL_ID("ttsModelId", AgentSnapshotDataDTO::getTtsModelId, AgentUpdateDTO::getTtsModelId,
|
|
||||||
(agent, data) -> agent.setTtsModelId(data.getTtsModelId())),
|
|
||||||
TTS_VOICE_ID("ttsVoiceId", AgentSnapshotDataDTO::getTtsVoiceId, AgentUpdateDTO::getTtsVoiceId,
|
|
||||||
(agent, data) -> agent.setTtsVoiceId(data.getTtsVoiceId())),
|
|
||||||
TTS_LANGUAGE("ttsLanguage", AgentSnapshotDataDTO::getTtsLanguage, AgentUpdateDTO::getTtsLanguage,
|
|
||||||
(agent, data) -> agent.setTtsLanguage(data.getTtsLanguage())),
|
|
||||||
TTS_VOLUME("ttsVolume", AgentSnapshotDataDTO::getTtsVolume, AgentUpdateDTO::getTtsVolume,
|
|
||||||
(agent, data) -> agent.setTtsVolume(data.getTtsVolume())),
|
|
||||||
TTS_RATE("ttsRate", AgentSnapshotDataDTO::getTtsRate, AgentUpdateDTO::getTtsRate,
|
|
||||||
(agent, data) -> agent.setTtsRate(data.getTtsRate())),
|
|
||||||
TTS_PITCH("ttsPitch", AgentSnapshotDataDTO::getTtsPitch, AgentUpdateDTO::getTtsPitch,
|
|
||||||
(agent, data) -> agent.setTtsPitch(data.getTtsPitch())),
|
|
||||||
MEM_MODEL_ID("memModelId", AgentSnapshotDataDTO::getMemModelId, AgentUpdateDTO::getMemModelId,
|
|
||||||
(agent, data) -> agent.setMemModelId(data.getMemModelId())),
|
|
||||||
INTENT_MODEL_ID("intentModelId", AgentSnapshotDataDTO::getIntentModelId, AgentUpdateDTO::getIntentModelId,
|
|
||||||
(agent, data) -> agent.setIntentModelId(data.getIntentModelId())),
|
|
||||||
CHAT_HISTORY_CONF("chatHistoryConf", AgentSnapshotDataDTO::getChatHistoryConf, AgentUpdateDTO::getChatHistoryConf,
|
|
||||||
(agent, data) -> agent.setChatHistoryConf(data.getChatHistoryConf())),
|
|
||||||
SYSTEM_PROMPT("systemPrompt", AgentSnapshotDataDTO::getSystemPrompt, AgentUpdateDTO::getSystemPrompt,
|
|
||||||
(agent, data) -> agent.setSystemPrompt(data.getSystemPrompt())),
|
|
||||||
SUMMARY_MEMORY("summaryMemory", AgentSnapshotDataDTO::getSummaryMemory, AgentUpdateDTO::getSummaryMemory,
|
|
||||||
(agent, data) -> agent.setSummaryMemory(data.getSummaryMemory())),
|
|
||||||
LANG_CODE("langCode", AgentSnapshotDataDTO::getLangCode, AgentUpdateDTO::getLangCode,
|
|
||||||
(agent, data) -> agent.setLangCode(data.getLangCode())),
|
|
||||||
LANGUAGE("language", AgentSnapshotDataDTO::getLanguage, AgentUpdateDTO::getLanguage,
|
|
||||||
(agent, data) -> agent.setLanguage(data.getLanguage())),
|
|
||||||
SORT("sort", AgentSnapshotDataDTO::getSort, AgentUpdateDTO::getSort,
|
|
||||||
(agent, data) -> agent.setSort(data.getSort())),
|
|
||||||
FUNCTIONS("functions", AgentSnapshotDataDTO::getFunctions, AgentUpdateDTO::getFunctions, null),
|
|
||||||
CONTEXT_PROVIDERS("contextProviders", AgentSnapshotDataDTO::getContextProviders,
|
|
||||||
AgentUpdateDTO::getContextProviders, null),
|
|
||||||
CORRECT_WORD_FILE_IDS("correctWordFileIds", AgentSnapshotDataDTO::getCorrectWordFileIds,
|
|
||||||
AgentUpdateDTO::getCorrectWordFileIds, null),
|
|
||||||
TAG_NAMES("tagNames", AgentSnapshotDataDTO::getTagNames, AgentUpdateDTO::getTagNames, null);
|
|
||||||
|
|
||||||
private final String fieldName;
|
|
||||||
private final Function<AgentSnapshotDataDTO, Object> snapshotGetter;
|
|
||||||
private final Function<AgentUpdateDTO, Object> updateGetter;
|
|
||||||
private final BiConsumer<AgentEntity, AgentSnapshotDataDTO> restoreApplier;
|
|
||||||
|
|
||||||
AgentSnapshotField(String fieldName, Function<AgentSnapshotDataDTO, Object> snapshotGetter,
|
|
||||||
Function<AgentUpdateDTO, Object> updateGetter,
|
|
||||||
BiConsumer<AgentEntity, AgentSnapshotDataDTO> restoreApplier) {
|
|
||||||
this.fieldName = fieldName;
|
|
||||||
this.snapshotGetter = snapshotGetter;
|
|
||||||
this.updateGetter = updateGetter;
|
|
||||||
this.restoreApplier = restoreApplier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static List<String> names() {
|
|
||||||
return Arrays.stream(values()).map(AgentSnapshotField::getFieldName).toList();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String canonicalName(String fieldName) {
|
|
||||||
return "tags".equals(fieldName) ? TAG_NAMES.getFieldName() : fieldName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object snapshotValue(AgentSnapshotDataDTO data) {
|
|
||||||
return data == null ? null : snapshotGetter.apply(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Object updateValue(AgentUpdateDTO data) {
|
|
||||||
return data == null ? null : updateGetter.apply(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isRestorableAgentField() {
|
|
||||||
return restoreApplier != null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void applyTo(AgentEntity agent, AgentSnapshotDataDTO data) {
|
|
||||||
if (restoreApplier != null) {
|
|
||||||
restoreApplier.accept(agent, data);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -19,6 +19,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.Parameter;
|
||||||
import io.swagger.v3.oas.annotations.Parameters;
|
import io.swagger.v3.oas.annotations.Parameters;
|
||||||
|
|
@ -26,13 +28,10 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import jakarta.validation.Valid;
|
import jakarta.validation.Valid;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import xiaozhi.common.constant.Constant;
|
import xiaozhi.common.constant.Constant;
|
||||||
import xiaozhi.common.exception.ErrorCode;
|
|
||||||
import xiaozhi.common.exception.RenException;
|
|
||||||
import xiaozhi.common.page.PageData;
|
import xiaozhi.common.page.PageData;
|
||||||
import xiaozhi.common.redis.RedisKeys;
|
import xiaozhi.common.redis.RedisKeys;
|
||||||
import xiaozhi.common.redis.RedisUtils;
|
import xiaozhi.common.redis.RedisUtils;
|
||||||
import xiaozhi.common.user.UserDetail;
|
import xiaozhi.common.user.UserDetail;
|
||||||
import xiaozhi.common.utils.JsonUtils;
|
|
||||||
import xiaozhi.common.utils.Result;
|
import xiaozhi.common.utils.Result;
|
||||||
import xiaozhi.common.utils.ResultUtils;
|
import xiaozhi.common.utils.ResultUtils;
|
||||||
import xiaozhi.modules.agent.dto.AgentChatHistoryDTO;
|
import xiaozhi.modules.agent.dto.AgentChatHistoryDTO;
|
||||||
|
|
@ -42,15 +41,21 @@ import xiaozhi.modules.agent.dto.AgentDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentMemoryDTO;
|
import xiaozhi.modules.agent.dto.AgentMemoryDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
||||||
import xiaozhi.modules.agent.entity.AgentEntity;
|
import xiaozhi.modules.agent.entity.AgentEntity;
|
||||||
|
import xiaozhi.modules.agent.entity.AgentTemplateEntity;
|
||||||
import xiaozhi.modules.agent.dto.AgentTagDTO;
|
import xiaozhi.modules.agent.dto.AgentTagDTO;
|
||||||
import xiaozhi.modules.agent.entity.AgentTagEntity;
|
import xiaozhi.modules.agent.entity.AgentTagEntity;
|
||||||
import xiaozhi.modules.agent.service.AgentTagService;
|
import xiaozhi.modules.agent.service.AgentTagService;
|
||||||
import xiaozhi.modules.agent.service.AgentChatAudioService;
|
import xiaozhi.modules.agent.service.AgentChatAudioService;
|
||||||
import xiaozhi.modules.agent.service.AgentChatHistoryService;
|
import xiaozhi.modules.agent.service.AgentChatHistoryService;
|
||||||
import xiaozhi.modules.agent.service.AgentChatSummaryService;
|
import xiaozhi.modules.agent.service.AgentChatSummaryService;
|
||||||
|
import xiaozhi.modules.agent.service.AgentContextProviderService;
|
||||||
|
import xiaozhi.modules.agent.service.AgentPluginMappingService;
|
||||||
import xiaozhi.modules.agent.service.AgentService;
|
import xiaozhi.modules.agent.service.AgentService;
|
||||||
|
import xiaozhi.modules.agent.service.AgentTemplateService;
|
||||||
import xiaozhi.modules.agent.vo.AgentChatHistoryUserVO;
|
import xiaozhi.modules.agent.vo.AgentChatHistoryUserVO;
|
||||||
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
||||||
|
import xiaozhi.modules.device.entity.DeviceEntity;
|
||||||
|
import xiaozhi.modules.device.service.DeviceService;
|
||||||
import xiaozhi.modules.security.user.SecurityUser;
|
import xiaozhi.modules.security.user.SecurityUser;
|
||||||
|
|
||||||
@Tag(name = "智能体管理")
|
@Tag(name = "智能体管理")
|
||||||
|
|
@ -58,39 +63,17 @@ import xiaozhi.modules.security.user.SecurityUser;
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/agent")
|
@RequestMapping("/agent")
|
||||||
public class AgentController {
|
public class AgentController {
|
||||||
private static final long AUDIO_PLAY_TOKEN_EXPIRE_SECONDS = 300L;
|
|
||||||
|
|
||||||
private final AgentService agentService;
|
private final AgentService agentService;
|
||||||
|
private final AgentTemplateService agentTemplateService;
|
||||||
|
private final DeviceService deviceService;
|
||||||
private final AgentChatHistoryService agentChatHistoryService;
|
private final AgentChatHistoryService agentChatHistoryService;
|
||||||
private final AgentChatAudioService agentChatAudioService;
|
private final AgentChatAudioService agentChatAudioService;
|
||||||
|
private final AgentPluginMappingService agentPluginMappingService;
|
||||||
|
private final AgentContextProviderService agentContextProviderService;
|
||||||
private final AgentChatSummaryService agentChatSummaryService;
|
private final AgentChatSummaryService agentChatSummaryService;
|
||||||
private final RedisUtils redisUtils;
|
private final RedisUtils redisUtils;
|
||||||
private final AgentTagService agentTagService;
|
private final AgentTagService agentTagService;
|
||||||
|
|
||||||
private void requireAgentPermission(String agentId) {
|
|
||||||
if (!agentService.checkAgentPermission(agentId, SecurityUser.getUserId())) {
|
|
||||||
throw new RenException(ErrorCode.NO_PERMISSION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private String requireSessionAgent(String sessionId) {
|
|
||||||
String agentId = agentChatHistoryService.getAgentIdBySessionId(sessionId);
|
|
||||||
if (StringUtils.isBlank(agentId)) {
|
|
||||||
throw new RenException(ErrorCode.AGENT_NOT_FOUND);
|
|
||||||
}
|
|
||||||
agentService.getAgentById(agentId);
|
|
||||||
return agentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String requireAudioPermission(String audioId) {
|
|
||||||
String agentId = agentChatHistoryService.getAgentIdByAudioId(audioId);
|
|
||||||
if (StringUtils.isBlank(agentId)) {
|
|
||||||
throw new RenException(ErrorCode.NO_PERMISSION);
|
|
||||||
}
|
|
||||||
requireAgentPermission(agentId);
|
|
||||||
return agentId;
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/list")
|
@GetMapping("/list")
|
||||||
@Operation(summary = "获取用户智能体列表")
|
@Operation(summary = "获取用户智能体列表")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
|
@ -121,7 +104,7 @@ public class AgentController {
|
||||||
@Operation(summary = "获取智能体详情")
|
@Operation(summary = "获取智能体详情")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<AgentInfoVO> getAgentById(@PathVariable("id") String id) {
|
public Result<AgentInfoVO> getAgentById(@PathVariable("id") String id) {
|
||||||
AgentInfoVO agent = agentService.getAgentById(id, SecurityUser.getUserId());
|
AgentInfoVO agent = agentService.getAgentById(id);
|
||||||
return ResultUtils.success(agent);
|
return ResultUtils.success(agent);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -135,16 +118,20 @@ public class AgentController {
|
||||||
|
|
||||||
@PutMapping("/saveMemory/{macAddress}")
|
@PutMapping("/saveMemory/{macAddress}")
|
||||||
@Operation(summary = "根据设备id更新智能体")
|
@Operation(summary = "根据设备id更新智能体")
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<Void> updateByDeviceId(@PathVariable String macAddress, @RequestBody @Valid AgentMemoryDTO dto) {
|
public Result<Void> updateByDeviceId(@PathVariable String macAddress, @RequestBody @Valid AgentMemoryDTO dto) {
|
||||||
agentService.updateAgentMemoryByDeviceMacAddress(macAddress, dto, SecurityUser.getUserId());
|
DeviceEntity device = deviceService.getDeviceByMacAddress(macAddress);
|
||||||
return new Result<Void>().ok(null);
|
if (device == null) {
|
||||||
|
return new Result<>();
|
||||||
|
}
|
||||||
|
AgentUpdateDTO agentUpdateDTO = new AgentUpdateDTO();
|
||||||
|
agentUpdateDTO.setSummaryMemory(dto.getSummaryMemory());
|
||||||
|
agentService.updateAgentById(device.getAgentId(), agentUpdateDTO);
|
||||||
|
return new Result<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/chat-summary/{sessionId}/save")
|
@PostMapping("/chat-summary/{sessionId}/save")
|
||||||
@Operation(summary = "根据会话ID生成聊天记录总结并保存(异步执行)")
|
@Operation(summary = "根据会话ID生成聊天记录总结并保存(异步执行)")
|
||||||
public Result<Void> generateAndSaveChatSummary(@PathVariable String sessionId) {
|
public Result<Void> generateAndSaveChatSummary(@PathVariable String sessionId) {
|
||||||
requireSessionAgent(sessionId);
|
|
||||||
try {
|
try {
|
||||||
// 异步执行总结生成任务,立即返回成功响应
|
// 异步执行总结生成任务,立即返回成功响应
|
||||||
new Thread(() -> {
|
new Thread(() -> {
|
||||||
|
|
@ -166,7 +153,6 @@ public class AgentController {
|
||||||
@PostMapping("/chat-title/{sessionId}/generate")
|
@PostMapping("/chat-title/{sessionId}/generate")
|
||||||
@Operation(summary = "根据会话ID生成聊天标题")
|
@Operation(summary = "根据会话ID生成聊天标题")
|
||||||
public Result<Void> generateAndSaveChatTitle(@PathVariable String sessionId) {
|
public Result<Void> generateAndSaveChatTitle(@PathVariable String sessionId) {
|
||||||
requireSessionAgent(sessionId);
|
|
||||||
agentChatSummaryService.generateAndSaveChatTitle(sessionId);
|
agentChatSummaryService.generateAndSaveChatTitle(sessionId);
|
||||||
return new Result<Void>().ok(null);
|
return new Result<Void>().ok(null);
|
||||||
}
|
}
|
||||||
|
|
@ -175,7 +161,7 @@ public class AgentController {
|
||||||
@Operation(summary = "更新智能体")
|
@Operation(summary = "更新智能体")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<Void> update(@PathVariable String id, @RequestBody @Valid AgentUpdateDTO dto) {
|
public Result<Void> update(@PathVariable String id, @RequestBody @Valid AgentUpdateDTO dto) {
|
||||||
agentService.updateAgentById(id, dto, SecurityUser.getUserId());
|
agentService.updateAgentById(id, dto);
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -183,10 +169,28 @@ public class AgentController {
|
||||||
@Operation(summary = "删除智能体")
|
@Operation(summary = "删除智能体")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<Void> delete(@PathVariable String id) {
|
public Result<Void> delete(@PathVariable String id) {
|
||||||
agentService.deleteAgentById(id, SecurityUser.getUserId());
|
// 先删除关联的设备
|
||||||
|
deviceService.deleteByAgentId(id);
|
||||||
|
// 删除关联的聊天记录
|
||||||
|
agentChatHistoryService.deleteByAgentId(id, true, true);
|
||||||
|
// 删除关联的插件
|
||||||
|
agentPluginMappingService.deleteByAgentId(id);
|
||||||
|
// 删除关联的上下文源配置
|
||||||
|
agentContextProviderService.deleteByAgentId(id);
|
||||||
|
// 再删除智能体
|
||||||
|
agentService.deleteById(id);
|
||||||
return new Result<>();
|
return new Result<>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/template")
|
||||||
|
@Operation(summary = "智能体模板模板列表")
|
||||||
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
public Result<List<AgentTemplateEntity>> templateList() {
|
||||||
|
List<AgentTemplateEntity> list = agentTemplateService
|
||||||
|
.list(new QueryWrapper<AgentTemplateEntity>().orderByAsc("sort"));
|
||||||
|
return new Result<List<AgentTemplateEntity>>().ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
@GetMapping("/{id}/sessions")
|
@GetMapping("/{id}/sessions")
|
||||||
@Operation(summary = "获取智能体会话列表")
|
@Operation(summary = "获取智能体会话列表")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
|
|
@ -197,7 +201,6 @@ public class AgentController {
|
||||||
public Result<PageData<AgentChatSessionDTO>> getAgentSessions(
|
public Result<PageData<AgentChatSessionDTO>> getAgentSessions(
|
||||||
@PathVariable("id") String id,
|
@PathVariable("id") String id,
|
||||||
@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
@Parameter(hidden = true) @RequestParam Map<String, Object> params) {
|
||||||
requireAgentPermission(id);
|
|
||||||
params.put("agentId", id);
|
params.put("agentId", id);
|
||||||
PageData<AgentChatSessionDTO> page = agentChatHistoryService.getSessionListByAgentId(params);
|
PageData<AgentChatSessionDTO> page = agentChatHistoryService.getSessionListByAgentId(params);
|
||||||
return new Result<PageData<AgentChatSessionDTO>>().ok(page);
|
return new Result<PageData<AgentChatSessionDTO>>().ok(page);
|
||||||
|
|
@ -245,7 +248,6 @@ public class AgentController {
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<String> getContentByAudioId(
|
public Result<String> getContentByAudioId(
|
||||||
@PathVariable("id") String id) {
|
@PathVariable("id") String id) {
|
||||||
requireAudioPermission(id);
|
|
||||||
// 查询聊天记录
|
// 查询聊天记录
|
||||||
String data = agentChatHistoryService.getContentByAudioId(id);
|
String data = agentChatHistoryService.getContentByAudioId(id);
|
||||||
return new Result<String>().ok(data);
|
return new Result<String>().ok(data);
|
||||||
|
|
@ -255,13 +257,12 @@ public class AgentController {
|
||||||
@Operation(summary = "获取音频下载ID")
|
@Operation(summary = "获取音频下载ID")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<String> getAudioId(@PathVariable("audioId") String audioId) {
|
public Result<String> getAudioId(@PathVariable("audioId") String audioId) {
|
||||||
requireAudioPermission(audioId);
|
|
||||||
byte[] audioData = agentChatAudioService.getAudio(audioId);
|
byte[] audioData = agentChatAudioService.getAudio(audioId);
|
||||||
if (audioData == null) {
|
if (audioData == null) {
|
||||||
return new Result<String>().error("音频不存在");
|
return new Result<String>().error("音频不存在");
|
||||||
}
|
}
|
||||||
String uuid = UUID.randomUUID().toString();
|
String uuid = UUID.randomUUID().toString();
|
||||||
redisUtils.set(RedisKeys.getAgentAudioIdKey(uuid), audioId, AUDIO_PLAY_TOKEN_EXPIRE_SECONDS);
|
redisUtils.set(RedisKeys.getAgentAudioIdKey(uuid), audioId);
|
||||||
return new Result<String>().ok(uuid);
|
return new Result<String>().ok(uuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -317,7 +318,6 @@ public class AgentController {
|
||||||
@Operation(summary = "获取智能体的标签")
|
@Operation(summary = "获取智能体的标签")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<List<AgentTagDTO>> getAgentTags(@PathVariable String id) {
|
public Result<List<AgentTagDTO>> getAgentTags(@PathVariable String id) {
|
||||||
requireAgentPermission(id);
|
|
||||||
List<AgentTagDTO> tags = agentTagService.getTagsByAgentId(id);
|
List<AgentTagDTO> tags = agentTagService.getTagsByAgentId(id);
|
||||||
return new Result<List<AgentTagDTO>>().ok(tags);
|
return new Result<List<AgentTagDTO>>().ok(tags);
|
||||||
}
|
}
|
||||||
|
|
@ -326,14 +326,10 @@ public class AgentController {
|
||||||
@Operation(summary = "保存智能体的标签")
|
@Operation(summary = "保存智能体的标签")
|
||||||
@RequiresPermissions("sys:role:normal")
|
@RequiresPermissions("sys:role:normal")
|
||||||
public Result<Void> saveAgentTags(@PathVariable String id, @RequestBody Map<String, Object> params) {
|
public Result<Void> saveAgentTags(@PathVariable String id, @RequestBody Map<String, Object> params) {
|
||||||
requireAgentPermission(id);
|
List<String> tagIds = (List<String>) params.get("tagIds");
|
||||||
List<String> tagIds = JsonUtils.toList(params.get("tagIds"), String.class);
|
List<String> tagNames = (List<String>) params.get("tagNames");
|
||||||
List<String> tagNames = JsonUtils.toList(params.get("tagNames"), String.class);
|
agentTagService.saveAgentTags(id, tagIds, tagNames);
|
||||||
AgentUpdateDTO dto = new AgentUpdateDTO();
|
|
||||||
dto.setTagIds(tagIds);
|
|
||||||
dto.setTagNames(tagNames);
|
|
||||||
agentService.updateAgentById(id, dto);
|
|
||||||
return new Result<Void>().ok(null);
|
return new Result<Void>().ok(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
package xiaozhi.modules.agent.controller;
|
|
||||||
|
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
|
||||||
import org.springdoc.core.annotations.ParameterObject;
|
|
||||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
||||||
import jakarta.validation.Valid;
|
|
||||||
import lombok.AllArgsConstructor;
|
|
||||||
import xiaozhi.common.exception.RenException;
|
|
||||||
import xiaozhi.common.page.PageData;
|
|
||||||
import xiaozhi.common.user.UserDetail;
|
|
||||||
import xiaozhi.common.utils.Result;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentSnapshotPageDTO;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentSnapshotRestoreDTO;
|
|
||||||
import xiaozhi.modules.agent.service.AgentService;
|
|
||||||
import xiaozhi.modules.agent.service.AgentSnapshotService;
|
|
||||||
import xiaozhi.modules.agent.vo.AgentSnapshotVO;
|
|
||||||
import xiaozhi.modules.security.user.SecurityUser;
|
|
||||||
|
|
||||||
@Tag(name = "智能体快照")
|
|
||||||
@AllArgsConstructor
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/agent/{agentId}/snapshots")
|
|
||||||
public class AgentSnapshotController {
|
|
||||||
private final AgentSnapshotService agentSnapshotService;
|
|
||||||
private final AgentService agentService;
|
|
||||||
|
|
||||||
@GetMapping
|
|
||||||
@Operation(summary = "获取智能体快照列表")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<PageData<AgentSnapshotVO>> page(
|
|
||||||
@PathVariable String agentId,
|
|
||||||
@ParameterObject AgentSnapshotPageDTO params) {
|
|
||||||
checkPermission(agentId);
|
|
||||||
return new Result<PageData<AgentSnapshotVO>>().ok(agentSnapshotService.page(agentId, params));
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/{snapshotId}")
|
|
||||||
@Operation(summary = "获取智能体快照详情")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<AgentSnapshotVO> getSnapshot(@PathVariable String agentId, @PathVariable String snapshotId) {
|
|
||||||
checkPermission(agentId);
|
|
||||||
return new Result<AgentSnapshotVO>().ok(agentSnapshotService.getSnapshot(agentId, snapshotId));
|
|
||||||
}
|
|
||||||
|
|
||||||
@PostMapping("/{snapshotId}/restore")
|
|
||||||
@Operation(summary = "恢复智能体快照")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<Void> restore(@PathVariable String agentId, @PathVariable String snapshotId,
|
|
||||||
@RequestBody @Valid AgentSnapshotRestoreDTO request) {
|
|
||||||
checkPermission(agentId);
|
|
||||||
agentSnapshotService.restoreSnapshot(agentId, snapshotId, request.getCurrentStateToken());
|
|
||||||
return new Result<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@DeleteMapping("/{snapshotId}")
|
|
||||||
@Operation(summary = "删除智能体历史快照")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<Void> deleteSnapshot(@PathVariable String agentId, @PathVariable String snapshotId) {
|
|
||||||
checkPermission(agentId);
|
|
||||||
agentSnapshotService.deleteSnapshot(agentId, snapshotId);
|
|
||||||
return new Result<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkPermission(String agentId) {
|
|
||||||
UserDetail user = SecurityUser.getUser();
|
|
||||||
if (user == null || !agentService.checkAgentPermission(agentId, user.getId())) {
|
|
||||||
throw new RenException("没有权限访问该智能体快照");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -41,17 +41,6 @@ public class AgentTemplateController {
|
||||||
|
|
||||||
private final AgentTemplateService agentTemplateService;
|
private final AgentTemplateService agentTemplateService;
|
||||||
|
|
||||||
// 单独用 normal 权限(而非类级 superAdmin)是有意保留:
|
|
||||||
// 普通用户也需查询可用模板,与 /page 的管理入口分离,保持原行为契约。
|
|
||||||
@GetMapping
|
|
||||||
@Operation(summary = "智能体模板列表")
|
|
||||||
@RequiresPermissions("sys:role:normal")
|
|
||||||
public Result<List<AgentTemplateEntity>> getAgentTemplates() {
|
|
||||||
List<AgentTemplateEntity> list = agentTemplateService
|
|
||||||
.list(new QueryWrapper<AgentTemplateEntity>().orderByAsc("sort"));
|
|
||||||
return new Result<List<AgentTemplateEntity>>().ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获取模板分页列表")
|
@Operation(summary = "获取模板分页列表")
|
||||||
@RequiresPermissions("sys:role:superAdmin")
|
@RequiresPermissions("sys:role:superAdmin")
|
||||||
|
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
package xiaozhi.modules.agent.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import xiaozhi.common.dao.BaseDao;
|
|
||||||
import xiaozhi.modules.agent.entity.AgentCorrectWordMappingEntity;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AgentCorrectWordMappingDao extends BaseDao<AgentCorrectWordMappingEntity> {
|
|
||||||
|
|
||||||
int deleteByAgentId(@Param("agentId") String agentId);
|
|
||||||
|
|
||||||
int deleteByFileId(@Param("fileId") String fileId);
|
|
||||||
|
|
||||||
int batchInsertMapping(@Param("list") List<AgentCorrectWordMappingEntity> mappings);
|
|
||||||
|
|
||||||
List<AgentCorrectWordMappingEntity> selectByAgentId(@Param("agentId") String agentId);
|
|
||||||
}
|
|
||||||
|
|
@ -36,20 +36,4 @@ public interface AgentDao extends BaseDao<AgentEntity> {
|
||||||
* @param agentId 智能体ID
|
* @param agentId 智能体ID
|
||||||
*/
|
*/
|
||||||
AgentInfoVO selectAgentInfoById(@Param("agentId") String agentId);
|
AgentInfoVO selectAgentInfoById(@Param("agentId") String agentId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 锁定智能体主记录,用于串行化同一智能体的配置写入
|
|
||||||
*
|
|
||||||
* @param agentId 智能体ID
|
|
||||||
*/
|
|
||||||
AgentEntity selectByIdForUpdate(@Param("agentId") String agentId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 精确写入快照覆盖的智能体字段,包括目标快照中的 null 值。
|
|
||||||
* 不更新所属用户、创建信息等不属于快照的字段。
|
|
||||||
*
|
|
||||||
* @param agent 已应用目标快照的智能体
|
|
||||||
* @return 受影响行数
|
|
||||||
*/
|
|
||||||
int updateSnapshotFields(@Param("agent") AgentEntity agent);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,29 +0,0 @@
|
||||||
package xiaozhi.modules.agent.dao;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import xiaozhi.common.dao.BaseDao;
|
|
||||||
import xiaozhi.modules.agent.entity.AgentSnapshotEntity;
|
|
||||||
|
|
||||||
@Mapper
|
|
||||||
public interface AgentSnapshotDao extends BaseDao<AgentSnapshotEntity> {
|
|
||||||
Integer selectMaxVersionNo(@Param("agentId") String agentId);
|
|
||||||
|
|
||||||
AgentSnapshotEntity selectLatestSnapshot(@Param("agentId") String agentId);
|
|
||||||
|
|
||||||
AgentSnapshotEntity selectNextSnapshot(@Param("agentId") String agentId, @Param("versionNo") Integer versionNo);
|
|
||||||
|
|
||||||
int insertWithNextVersion(@Param("snapshot") AgentSnapshotEntity snapshot);
|
|
||||||
|
|
||||||
int deleteOlderThanKeepLimit(@Param("agentId") String agentId, @Param("keepLimit") int keepLimit);
|
|
||||||
|
|
||||||
List<AgentSnapshotEntity> selectLegacyRedactionBatch(@Param("afterId") String afterId,
|
|
||||||
@Param("limit") int limit,
|
|
||||||
@Param("targetRedactionVersion") int targetRedactionVersion);
|
|
||||||
|
|
||||||
int updateRedactedSnapshots(@Param("snapshots") List<AgentSnapshotEntity> snapshots,
|
|
||||||
@Param("redactionVersion") int redactionVersion);
|
|
||||||
}
|
|
||||||
|
|
@ -39,7 +39,7 @@ public class AgentDTO {
|
||||||
private String systemPrompt;
|
private String systemPrompt;
|
||||||
|
|
||||||
@Schema(description = "总结记忆", example = "构建可生长的动态记忆网络,在有限空间内保留关键信息的同时,智能维护信息演变轨迹\n" +
|
@Schema(description = "总结记忆", example = "构建可生长的动态记忆网络,在有限空间内保留关键信息的同时,智能维护信息演变轨迹\n" +
|
||||||
"根据对话记录,总结user的重要信息,以便在未来的对话中提供更个性化的服务", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
"根据对话记录,总结user的重要信息,以便在未来的对话中提供更个性化的服务", required = false)
|
||||||
private String summaryMemory;
|
private String summaryMemory;
|
||||||
|
|
||||||
@Schema(description = "最后连接时间", example = "2024-03-20 10:00:00")
|
@Schema(description = "最后连接时间", example = "2024-03-20 10:00:00")
|
||||||
|
|
@ -50,4 +50,4 @@ public class AgentDTO {
|
||||||
|
|
||||||
@Schema(description = "标签列表")
|
@Schema(description = "标签列表")
|
||||||
private List<AgentTagDTO> tags;
|
private List<AgentTagDTO> tags;
|
||||||
}
|
}
|
||||||
|
|
@ -14,6 +14,6 @@ public class AgentMemoryDTO implements Serializable {
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
@Schema(description = "总结记忆", example = "构建可生长的动态记忆网络,在有限空间内保留关键信息的同时,智能维护信息演变轨迹\n" +
|
@Schema(description = "总结记忆", example = "构建可生长的动态记忆网络,在有限空间内保留关键信息的同时,智能维护信息演变轨迹\n" +
|
||||||
"根据对话记录,总结user的重要信息,以便在未来的对话中提供更个性化的服务", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
"根据对话记录,总结user的重要信息,以便在未来的对话中提供更个性化的服务", required = false)
|
||||||
private String summaryMemory;
|
private String summaryMemory;
|
||||||
}
|
}
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
package xiaozhi.modules.agent.dto;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Schema(description = "智能体快照数据")
|
|
||||||
public class AgentSnapshotDataDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String agentCode;
|
|
||||||
private String agentName;
|
|
||||||
private String asrModelId;
|
|
||||||
private String vadModelId;
|
|
||||||
private String llmModelId;
|
|
||||||
private String slmModelId;
|
|
||||||
private String vllmModelId;
|
|
||||||
private String ttsModelId;
|
|
||||||
private String ttsVoiceId;
|
|
||||||
private String ttsLanguage;
|
|
||||||
private Integer ttsVolume;
|
|
||||||
private Integer ttsRate;
|
|
||||||
private Integer ttsPitch;
|
|
||||||
private String memModelId;
|
|
||||||
private String intentModelId;
|
|
||||||
private Integer chatHistoryConf;
|
|
||||||
private String systemPrompt;
|
|
||||||
private String summaryMemory;
|
|
||||||
private String langCode;
|
|
||||||
private String language;
|
|
||||||
private Integer sort;
|
|
||||||
private List<AgentUpdateDTO.FunctionInfo> functions;
|
|
||||||
private List<ContextProviderDTO> contextProviders;
|
|
||||||
private List<String> correctWordFileIds;
|
|
||||||
private List<String> tagNames;
|
|
||||||
private List<AgentSnapshotTagDTO> tags;
|
|
||||||
}
|
|
||||||
|
|
@ -1,28 +0,0 @@
|
||||||
package xiaozhi.modules.agent.dto;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Schema(description = "智能体快照分页查询参数")
|
|
||||||
public class AgentSnapshotPageDTO {
|
|
||||||
@Schema(description = "当前页码,从1开始", example = "1")
|
|
||||||
private Integer page = 1;
|
|
||||||
|
|
||||||
@Schema(description = "每页数量", example = "10")
|
|
||||||
private Integer limit = 10;
|
|
||||||
|
|
||||||
@Schema(description = "版本锚点,只查询小于等于该版本号的历史快照", example = "20")
|
|
||||||
private Integer maxVersionNo;
|
|
||||||
|
|
||||||
public int pageOrDefault() {
|
|
||||||
return page == null || page < 1 ? 1 : page;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int limitOrDefault() {
|
|
||||||
if (limit == null || limit < 1) {
|
|
||||||
return 10;
|
|
||||||
}
|
|
||||||
return limit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +0,0 @@
|
||||||
package xiaozhi.modules.agent.dto;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import jakarta.validation.constraints.NotBlank;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Schema(description = "智能体快照恢复请求")
|
|
||||||
public class AgentSnapshotRestoreDTO {
|
|
||||||
@NotBlank
|
|
||||||
@Schema(description = "预览时由服务端生成的当前配置状态指纹")
|
|
||||||
private String currentStateToken;
|
|
||||||
}
|
|
||||||
|
|
@ -1,16 +0,0 @@
|
||||||
package xiaozhi.modules.agent.dto;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@Schema(description = "智能体快照标签")
|
|
||||||
public class AgentSnapshotTagDTO implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String id;
|
|
||||||
private String tagName;
|
|
||||||
private Integer sort;
|
|
||||||
}
|
|
||||||
|
|
@ -4,12 +4,9 @@ import java.io.Serializable;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import xiaozhi.common.utils.JsonUtils;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 智能体更新DTO
|
* 智能体更新DTO
|
||||||
|
|
@ -39,10 +36,10 @@ public class AgentUpdateDTO implements Serializable {
|
||||||
@Schema(description = "小模型标识", example = "slm_model_02", nullable = true)
|
@Schema(description = "小模型标识", example = "slm_model_02", nullable = true)
|
||||||
private String slmModelId;
|
private String slmModelId;
|
||||||
|
|
||||||
@Schema(description = "VLLM模型标识", example = "vllm_model_02", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "VLLM模型标识", example = "vllm_model_02", required = false)
|
||||||
private String vllmModelId;
|
private String vllmModelId;
|
||||||
|
|
||||||
@Schema(description = "语音合成模型标识", example = "tts_model_02", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
@Schema(description = "语音合成模型标识", example = "tts_model_02", required = false)
|
||||||
private String ttsModelId;
|
private String ttsModelId;
|
||||||
|
|
||||||
@Schema(description = "音色标识", example = "voice_02", nullable = true)
|
@Schema(description = "音色标识", example = "voice_02", nullable = true)
|
||||||
|
|
@ -91,53 +88,15 @@ public class AgentUpdateDTO implements Serializable {
|
||||||
@Schema(description = "上下文源配置", nullable = true)
|
@Schema(description = "上下文源配置", nullable = true)
|
||||||
private List<ContextProviderDTO> contextProviders;
|
private List<ContextProviderDTO> contextProviders;
|
||||||
|
|
||||||
@Schema(description = "替换词文件ID列表", nullable = true)
|
|
||||||
private List<String> correctWordFileIds;
|
|
||||||
|
|
||||||
@Schema(description = "标签名称列表", nullable = true)
|
|
||||||
private List<String> tagNames;
|
|
||||||
|
|
||||||
@Schema(description = "标签ID列表", nullable = true)
|
|
||||||
private List<String> tagIds;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Schema(description = "插件函数信息")
|
@Schema(description = "插件函数信息")
|
||||||
public static class FunctionInfo implements Serializable {
|
public static class FunctionInfo implements Serializable {
|
||||||
private static final TypeReference<HashMap<String, Object>> PARAM_INFO_TYPE = new TypeReference<>() {
|
|
||||||
};
|
|
||||||
|
|
||||||
@Schema(description = "插件ID", example = "plugin_01")
|
@Schema(description = "插件ID", example = "plugin_01")
|
||||||
private String pluginId;
|
private String pluginId;
|
||||||
|
|
||||||
@Schema(description = "函数参数信息", nullable = true)
|
@Schema(description = "函数参数信息", nullable = true)
|
||||||
private HashMap<String, Object> paramInfo = new HashMap<>();
|
private HashMap<String, Object> paramInfo;
|
||||||
|
|
||||||
public void setParamInfo(Object paramInfo) {
|
|
||||||
this.paramInfo = normalizeParamInfo(paramInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static HashMap<String, Object> normalizeParamInfo(Object paramInfo) {
|
|
||||||
if (paramInfo == null) {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
if (paramInfo instanceof String value) {
|
|
||||||
if (value.trim().isEmpty()) {
|
|
||||||
return new HashMap<>();
|
|
||||||
}
|
|
||||||
return JsonUtils.parseObject(value, PARAM_INFO_TYPE);
|
|
||||||
}
|
|
||||||
if (paramInfo instanceof Map<?, ?> value) {
|
|
||||||
HashMap<String, Object> normalized = new HashMap<>();
|
|
||||||
value.forEach((key, val) -> {
|
|
||||||
if (key != null) {
|
|
||||||
normalized.put(String.valueOf(key), val);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return normalized;
|
|
||||||
}
|
|
||||||
return JsonUtils.parseObject(JsonUtils.toJsonString(paramInfo), PARAM_INFO_TYPE);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
private static final long serialVersionUID = 1L;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
package xiaozhi.modules.agent.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* MCP JSON-RPC 响应 DTO
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class McpJsonRpcResponse {
|
||||||
|
private String jsonrpc = "2.0";
|
||||||
|
private Integer id;
|
||||||
|
private McpResult result;
|
||||||
|
private McpError error;
|
||||||
|
|
||||||
|
public McpJsonRpcResponse() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class McpResult {
|
||||||
|
private String type;
|
||||||
|
private String message;
|
||||||
|
private String agent_id;
|
||||||
|
private McpTool[] tools;
|
||||||
|
|
||||||
|
public McpResult() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class McpTool {
|
||||||
|
private String name;
|
||||||
|
private String description;
|
||||||
|
private Object inputSchema;
|
||||||
|
|
||||||
|
public McpTool() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class McpError {
|
||||||
|
private Integer code;
|
||||||
|
private String message;
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
public McpError() {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,11 +7,11 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import xiaozhi.modules.agent.dto.ContextProviderDTO;
|
import xiaozhi.modules.agent.dto.ContextProviderDTO;
|
||||||
import xiaozhi.modules.agent.typehandler.ContextProviderListTypeHandler;
|
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@TableName(value = "ai_agent_context_provider", autoResultMap = true)
|
@TableName(value = "ai_agent_context_provider", autoResultMap = true)
|
||||||
|
|
@ -26,7 +26,7 @@ public class AgentContextProviderEntity {
|
||||||
private String agentId;
|
private String agentId;
|
||||||
|
|
||||||
@Schema(description = "上下文源配置")
|
@Schema(description = "上下文源配置")
|
||||||
@TableField(typeHandler = ContextProviderListTypeHandler.class)
|
@TableField(typeHandler = JacksonTypeHandler.class)
|
||||||
private List<ContextProviderDTO> contextProviders;
|
private List<ContextProviderDTO> contextProviders;
|
||||||
|
|
||||||
@Schema(description = "创建者")
|
@Schema(description = "创建者")
|
||||||
|
|
|
||||||
|
|
@ -1,38 +0,0 @@
|
||||||
package xiaozhi.modules.agent.entity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@TableName("ai_agent_correct_word_mapping")
|
|
||||||
@Schema(description = "智能体替换词文件关联")
|
|
||||||
public class AgentCorrectWordMappingEntity {
|
|
||||||
|
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
|
||||||
@Schema(description = "主键")
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Schema(description = "智能体ID")
|
|
||||||
private String agentId;
|
|
||||||
|
|
||||||
@Schema(description = "替换词文件ID")
|
|
||||||
private String fileId;
|
|
||||||
|
|
||||||
@Schema(description = "创建者")
|
|
||||||
private Long creator;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private Date createdAt;
|
|
||||||
|
|
||||||
@Schema(description = "更新者")
|
|
||||||
private Long updater;
|
|
||||||
|
|
||||||
@Schema(description = "更新时间")
|
|
||||||
private Date updatedAt;
|
|
||||||
}
|
|
||||||
|
|
@ -74,7 +74,7 @@ public class AgentEntity {
|
||||||
private String systemPrompt;
|
private String systemPrompt;
|
||||||
|
|
||||||
@Schema(description = "总结记忆", example = "构建可生长的动态记忆网络,在有限空间内保留关键信息的同时,智能维护信息演变轨迹\n" +
|
@Schema(description = "总结记忆", example = "构建可生长的动态记忆网络,在有限空间内保留关键信息的同时,智能维护信息演变轨迹\n" +
|
||||||
"根据对话记录,总结user的重要信息,以便在未来的对话中提供更个性化的服务", requiredMode = Schema.RequiredMode.NOT_REQUIRED)
|
"根据对话记录,总结user的重要信息,以便在未来的对话中提供更个性化的服务", required = false)
|
||||||
private String summaryMemory;
|
private String summaryMemory;
|
||||||
|
|
||||||
@Schema(description = "语言编码")
|
@Schema(description = "语言编码")
|
||||||
|
|
@ -97,4 +97,4 @@ public class AgentEntity {
|
||||||
|
|
||||||
@Schema(description = "更新时间")
|
@Schema(description = "更新时间")
|
||||||
private Date updatedAt;
|
private Date updatedAt;
|
||||||
}
|
}
|
||||||
|
|
@ -1,53 +0,0 @@
|
||||||
package xiaozhi.modules.agent.entity;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.IdType;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
|
||||||
|
|
||||||
import io.swagger.v3.oas.annotations.media.Schema;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
@TableName("ai_agent_snapshot")
|
|
||||||
@Schema(description = "智能体配置快照")
|
|
||||||
public class AgentSnapshotEntity {
|
|
||||||
|
|
||||||
@TableId(type = IdType.ASSIGN_UUID)
|
|
||||||
@Schema(description = "快照ID")
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@Schema(description = "智能体ID")
|
|
||||||
private String agentId;
|
|
||||||
|
|
||||||
@Schema(description = "所属用户ID")
|
|
||||||
private Long userId;
|
|
||||||
|
|
||||||
@Schema(description = "版本号")
|
|
||||||
private Integer versionNo;
|
|
||||||
|
|
||||||
@Schema(description = "快照数据JSON")
|
|
||||||
private String snapshotData;
|
|
||||||
|
|
||||||
@Schema(description = "变更字段JSON")
|
|
||||||
private String changedFields;
|
|
||||||
|
|
||||||
@Schema(description = "快照来源")
|
|
||||||
private String source;
|
|
||||||
|
|
||||||
@Schema(description = "恢复来源快照ID")
|
|
||||||
private String restoreFromSnapshotId;
|
|
||||||
|
|
||||||
@Schema(description = "恢复来源版本号")
|
|
||||||
private Integer restoreFromVersionNo;
|
|
||||||
|
|
||||||
@Schema(description = "创建者")
|
|
||||||
private Long creator;
|
|
||||||
|
|
||||||
@Schema(description = "创建时间")
|
|
||||||
private Date createdAt;
|
|
||||||
|
|
||||||
@Schema(description = "快照数据脱敏规则版本")
|
|
||||||
private Integer redactionVersion;
|
|
||||||
}
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
package xiaozhi.modules.agent.service;
|
package xiaozhi.modules.agent.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.repository.IRepository;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import xiaozhi.modules.agent.entity.AgentChatAudioEntity;
|
import xiaozhi.modules.agent.entity.AgentChatAudioEntity;
|
||||||
|
|
||||||
|
|
@ -11,7 +11,7 @@ import xiaozhi.modules.agent.entity.AgentChatAudioEntity;
|
||||||
* @version 1.0, 2025/5/8
|
* @version 1.0, 2025/5/8
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public interface AgentChatAudioService extends IRepository<AgentChatAudioEntity> {
|
public interface AgentChatAudioService extends IService<AgentChatAudioEntity> {
|
||||||
/**
|
/**
|
||||||
* 保存音频数据
|
* 保存音频数据
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,9 @@ package xiaozhi.modules.agent.service;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.repository.IRepository;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import xiaozhi.common.page.PageData;
|
import xiaozhi.common.page.PageData;
|
||||||
import xiaozhi.modules.agent.dto.AgentChatHistoryDTO;
|
import xiaozhi.modules.agent.dto.AgentChatHistoryDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentChatSessionDTO;
|
import xiaozhi.modules.agent.dto.AgentChatSessionDTO;
|
||||||
import xiaozhi.modules.agent.entity.AgentChatHistoryEntity;
|
import xiaozhi.modules.agent.entity.AgentChatHistoryEntity;
|
||||||
|
|
@ -18,7 +18,7 @@ import xiaozhi.modules.agent.vo.AgentChatHistoryUserVO;
|
||||||
* @version 1.0, 2025/4/30
|
* @version 1.0, 2025/4/30
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
*/
|
*/
|
||||||
public interface AgentChatHistoryService extends IRepository<AgentChatHistoryEntity> {
|
public interface AgentChatHistoryService extends IService<AgentChatHistoryEntity> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据智能体ID获取会话列表
|
* 根据智能体ID获取会话列表
|
||||||
|
|
@ -37,14 +37,6 @@ public interface AgentChatHistoryService extends IRepository<AgentChatHistoryEnt
|
||||||
*/
|
*/
|
||||||
List<AgentChatHistoryDTO> getChatHistoryBySessionId(String agentId, String sessionId);
|
List<AgentChatHistoryDTO> getChatHistoryBySessionId(String agentId, String sessionId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据会话ID获取智能体ID
|
|
||||||
*
|
|
||||||
* @param sessionId 会话ID
|
|
||||||
* @return 智能体ID
|
|
||||||
*/
|
|
||||||
String getAgentIdBySessionId(String sessionId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据智能体ID删除聊天记录
|
* 根据智能体ID删除聊天记录
|
||||||
*
|
*
|
||||||
|
|
@ -70,14 +62,6 @@ public interface AgentChatHistoryService extends IRepository<AgentChatHistoryEnt
|
||||||
*/
|
*/
|
||||||
String getContentByAudioId(String audioId);
|
String getContentByAudioId(String audioId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据音频ID获取智能体ID
|
|
||||||
*
|
|
||||||
* @param audioId 音频ID
|
|
||||||
* @return 智能体ID
|
|
||||||
*/
|
|
||||||
String getAgentIdByAudioId(String audioId);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询此音频id是否属于此智能体
|
* 查询此音频id是否属于此智能体
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ package xiaozhi.modules.agent.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.repository.IRepository;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
|
||||||
import xiaozhi.modules.agent.entity.AgentPluginMapping;
|
import xiaozhi.modules.agent.entity.AgentPluginMapping;
|
||||||
|
|
||||||
|
|
@ -10,11 +10,11 @@ import xiaozhi.modules.agent.entity.AgentPluginMapping;
|
||||||
* @description 针对表【ai_agent_plugin_mapping(Agent与插件的唯一映射表)】的数据库操作Service
|
* @description 针对表【ai_agent_plugin_mapping(Agent与插件的唯一映射表)】的数据库操作Service
|
||||||
* @createDate 2025-05-25 22:33:17
|
* @createDate 2025-05-25 22:33:17
|
||||||
*/
|
*/
|
||||||
public interface AgentPluginMappingService extends IRepository<AgentPluginMapping> {
|
public interface AgentPluginMappingService extends IService<AgentPluginMapping> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据智能体id获取插件参数
|
* 根据智能体id获取插件参数
|
||||||
*
|
*
|
||||||
* @param agentId
|
* @param agentId
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
|
|
@ -22,15 +22,8 @@ public interface AgentPluginMappingService extends IRepository<AgentPluginMappin
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据智能体id删除插件参数
|
* 根据智能体id删除插件参数
|
||||||
*
|
*
|
||||||
* @param agentId
|
* @param agentId
|
||||||
*/
|
*/
|
||||||
void deleteByAgentId(String agentId);
|
void deleteByAgentId(String agentId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据插件ID删除所有智能体的插件映射
|
|
||||||
*
|
|
||||||
* @param pluginId 插件ID
|
|
||||||
*/
|
|
||||||
void deleteByPluginId(String pluginId);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,6 @@ import xiaozhi.common.page.PageData;
|
||||||
import xiaozhi.common.service.BaseService;
|
import xiaozhi.common.service.BaseService;
|
||||||
import xiaozhi.modules.agent.dto.AgentCreateDTO;
|
import xiaozhi.modules.agent.dto.AgentCreateDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentDTO;
|
import xiaozhi.modules.agent.dto.AgentDTO;
|
||||||
import xiaozhi.modules.agent.dto.AgentMemoryDTO;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
import xiaozhi.modules.agent.dto.AgentUpdateDTO;
|
||||||
import xiaozhi.modules.agent.entity.AgentEntity;
|
import xiaozhi.modules.agent.entity.AgentEntity;
|
||||||
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
import xiaozhi.modules.agent.vo.AgentInfoVO;
|
||||||
|
|
@ -36,15 +35,6 @@ public interface AgentService extends BaseService<AgentEntity> {
|
||||||
*/
|
*/
|
||||||
AgentInfoVO getAgentById(String id);
|
AgentInfoVO getAgentById(String id);
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据ID获取当前用户有权访问的智能体
|
|
||||||
*
|
|
||||||
* @param id 智能体ID
|
|
||||||
* @param userId 当前用户ID
|
|
||||||
* @return 智能体实体
|
|
||||||
*/
|
|
||||||
AgentInfoVO getAgentById(String id, Long userId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 插入智能体
|
* 插入智能体
|
||||||
*
|
*
|
||||||
|
|
@ -60,13 +50,6 @@ public interface AgentService extends BaseService<AgentEntity> {
|
||||||
*/
|
*/
|
||||||
void deleteAgentByUserId(Long userId);
|
void deleteAgentByUserId(Long userId);
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除智能体及其关联数据
|
|
||||||
*
|
|
||||||
* @param agentId 智能体ID
|
|
||||||
*/
|
|
||||||
void deleteAgent(String agentId);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户智能体列表
|
* 获取用户智能体列表
|
||||||
*
|
*
|
||||||
|
|
@ -110,41 +93,6 @@ public interface AgentService extends BaseService<AgentEntity> {
|
||||||
*/
|
*/
|
||||||
void updateAgentById(String agentId, AgentUpdateDTO dto);
|
void updateAgentById(String agentId, AgentUpdateDTO dto);
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新当前用户有权访问的智能体
|
|
||||||
*
|
|
||||||
* @param agentId 智能体ID
|
|
||||||
* @param dto 更新智能体所需的信息
|
|
||||||
* @param userId 当前用户ID
|
|
||||||
*/
|
|
||||||
void updateAgentById(String agentId, AgentUpdateDTO dto, Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备MAC地址更新当前用户有权访问的智能体记忆
|
|
||||||
*
|
|
||||||
* @param macAddress 设备MAC地址
|
|
||||||
* @param dto 智能体记忆
|
|
||||||
* @param userId 当前用户ID
|
|
||||||
*/
|
|
||||||
void updateAgentMemoryByDeviceMacAddress(String macAddress, AgentMemoryDTO dto, Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除当前用户有权访问的智能体
|
|
||||||
*
|
|
||||||
* @param agentId 智能体ID
|
|
||||||
* @param userId 当前用户ID
|
|
||||||
*/
|
|
||||||
void deleteAgentById(String agentId, Long userId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新智能体
|
|
||||||
*
|
|
||||||
* @param agentId 智能体ID
|
|
||||||
* @param dto 更新智能体所需的信息
|
|
||||||
* @param createSnapshot 是否创建配置快照
|
|
||||||
*/
|
|
||||||
void updateAgentById(String agentId, AgentUpdateDTO dto, boolean createSnapshot);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建智能体
|
* 创建智能体
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -1,25 +0,0 @@
|
||||||
package xiaozhi.modules.agent.service;
|
|
||||||
|
|
||||||
import xiaozhi.common.page.PageData;
|
|
||||||
import xiaozhi.common.service.BaseService;
|
|
||||||
import xiaozhi.modules.agent.dto.AgentSnapshotPageDTO;
|
|
||||||
import xiaozhi.modules.agent.entity.AgentSnapshotEntity;
|
|
||||||
import xiaozhi.modules.agent.vo.AgentSnapshotVO;
|
|
||||||
|
|
||||||
public interface AgentSnapshotService extends BaseService<AgentSnapshotEntity> {
|
|
||||||
void createSnapshot(String agentId, String source);
|
|
||||||
|
|
||||||
PageData<AgentSnapshotVO> page(String agentId, AgentSnapshotPageDTO params);
|
|
||||||
|
|
||||||
AgentSnapshotVO getSnapshot(String agentId, String snapshotId);
|
|
||||||
|
|
||||||
void restoreSnapshot(String agentId, String snapshotId, String currentStateToken);
|
|
||||||
|
|
||||||
void deleteSnapshot(String agentId, String snapshotId);
|
|
||||||
|
|
||||||
Integer getCurrentVersionNo(String agentId);
|
|
||||||
|
|
||||||
void deleteByAgentId(String agentId);
|
|
||||||
|
|
||||||
long redactLegacySnapshots();
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue