nzjsdsk commited on
Commit
27e74f3
·
verified ·
1 Parent(s): f09aa04

Upload 169 files

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +35 -0
  2. .github/ISSUE_TEMPLATE/bug_report.md +32 -0
  3. .github/ISSUE_TEMPLATE/code_improvement.md +19 -0
  4. .github/ISSUE_TEMPLATE/documentation_improvement.md +16 -0
  5. .github/ISSUE_TEMPLATE/feature_request.md +19 -0
  6. .github/workflows/vitepress.yml +46 -0
  7. .gitignore +32 -0
  8. LICENSE +21 -0
  9. README.en.md +165 -0
  10. README.md +167 -12
  11. assets/emojis/angry.gif +3 -0
  12. assets/emojis/confident.gif +3 -0
  13. assets/emojis/confused.gif +3 -0
  14. assets/emojis/cool.gif +3 -0
  15. assets/emojis/crying.gif +3 -0
  16. assets/emojis/delicious.gif +3 -0
  17. assets/emojis/embarrassed.gif +3 -0
  18. assets/emojis/funny.gif +3 -0
  19. assets/emojis/happy.gif +3 -0
  20. assets/emojis/kissy.gif +3 -0
  21. assets/emojis/laughing.gif +3 -0
  22. assets/emojis/loving.gif +3 -0
  23. assets/emojis/neutral.gif +3 -0
  24. assets/emojis/relaxed.gif +3 -0
  25. assets/emojis/sad.gif +3 -0
  26. assets/emojis/shocked.gif +3 -0
  27. assets/emojis/silly.gif +3 -0
  28. assets/emojis/sleepy.gif +3 -0
  29. assets/emojis/surprised.gif +3 -0
  30. assets/emojis/thinking.gif +3 -0
  31. assets/emojis/winking.gif +3 -0
  32. build.json +46 -0
  33. documents/.gitignore +2 -0
  34. documents/README.md +74 -0
  35. documents/docs/.vitepress/config.mts +74 -0
  36. documents/docs/.vitepress/guide/index.ts +15 -0
  37. documents/docs/.vitepress/theme/index.ts +7 -0
  38. documents/docs/.vitepress/theme/styles/badges.css +28 -0
  39. documents/docs/.vitepress/theme/styles/custom.scss +26 -0
  40. documents/docs/.vitepress/theme/styles/index.css +7 -0
  41. documents/docs/.vitepress/theme/styles/inline-demo.css +90 -0
  42. documents/docs/.vitepress/theme/styles/options-boxes.css +27 -0
  43. documents/docs/.vitepress/theme/styles/pages.css +15 -0
  44. documents/docs/.vitepress/theme/styles/style-guide.css +65 -0
  45. documents/docs/.vitepress/theme/styles/utilities.css +14 -0
  46. documents/docs/.vitepress/theme/styles/vue-mastery.css +65 -0
  47. documents/docs/.vitepress/utils/index.ts +26 -0
  48. documents/docs/about/images/ben-hong.jpeg +0 -0
  49. documents/docs/about/images/evan-you.jpeg +0 -0
  50. documents/docs/about/team.md +11 -0
.gitattributes CHANGED
@@ -33,3 +33,38 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ assets/emojis/angry.gif filter=lfs diff=lfs merge=lfs -text
37
+ assets/emojis/confident.gif filter=lfs diff=lfs merge=lfs -text
38
+ assets/emojis/confused.gif filter=lfs diff=lfs merge=lfs -text
39
+ assets/emojis/cool.gif filter=lfs diff=lfs merge=lfs -text
40
+ assets/emojis/crying.gif filter=lfs diff=lfs merge=lfs -text
41
+ assets/emojis/delicious.gif filter=lfs diff=lfs merge=lfs -text
42
+ assets/emojis/embarrassed.gif filter=lfs diff=lfs merge=lfs -text
43
+ assets/emojis/funny.gif filter=lfs diff=lfs merge=lfs -text
44
+ assets/emojis/happy.gif filter=lfs diff=lfs merge=lfs -text
45
+ assets/emojis/kissy.gif filter=lfs diff=lfs merge=lfs -text
46
+ assets/emojis/laughing.gif filter=lfs diff=lfs merge=lfs -text
47
+ assets/emojis/loving.gif filter=lfs diff=lfs merge=lfs -text
48
+ assets/emojis/neutral.gif filter=lfs diff=lfs merge=lfs -text
49
+ assets/emojis/relaxed.gif filter=lfs diff=lfs merge=lfs -text
50
+ assets/emojis/sad.gif filter=lfs diff=lfs merge=lfs -text
51
+ assets/emojis/shocked.gif filter=lfs diff=lfs merge=lfs -text
52
+ assets/emojis/silly.gif filter=lfs diff=lfs merge=lfs -text
53
+ assets/emojis/sleepy.gif filter=lfs diff=lfs merge=lfs -text
54
+ assets/emojis/surprised.gif filter=lfs diff=lfs merge=lfs -text
55
+ assets/emojis/thinking.gif filter=lfs diff=lfs merge=lfs -text
56
+ assets/emojis/winking.gif filter=lfs diff=lfs merge=lfs -text
57
+ documents/docs/ecosystem/projects/open-xiaoai/images/logo.png filter=lfs diff=lfs merge=lfs -text
58
+ documents/docs/ecosystem/projects/xiaozhi-android-client/images/界面2.jpg filter=lfs diff=lfs merge=lfs -text
59
+ documents/docs/ecosystem/projects/xiaozhi-unity/images/界面1.png filter=lfs diff=lfs merge=lfs -text
60
+ documents/docs/ecosystem/projects/xiaozhi-unity/images/界面2.png filter=lfs diff=lfs merge=lfs -text
61
+ documents/docs/ecosystem/projects/xiaozhi-unity/images/logo.png filter=lfs diff=lfs merge=lfs -text
62
+ libs/libopus/linux/arm64/libopus.so filter=lfs diff=lfs merge=lfs -text
63
+ libs/libopus/linux/x64/libopus.so filter=lfs diff=lfs merge=lfs -text
64
+ libs/libopus/mac/arm64/libopus.dylib filter=lfs diff=lfs merge=lfs -text
65
+ libs/libopus/mac/x64/libopus.dylib filter=lfs diff=lfs merge=lfs -text
66
+ libs/libopus/win/x86_64/opus.dll filter=lfs diff=lfs merge=lfs -text
67
+ libs/webrtc_apm/linux/x64/libwebrtc_apm.so filter=lfs diff=lfs merge=lfs -text
68
+ libs/webrtc_apm/mac/arm64/libwebrtc_apm.dylib filter=lfs diff=lfs merge=lfs -text
69
+ libs/webrtc_apm/mac/x64/libwebrtc_apm.dylib filter=lfs diff=lfs merge=lfs -text
70
+ libs/webrtc_apm/win/x86_64/libwebrtc_apm.dll filter=lfs diff=lfs merge=lfs -text
.github/ISSUE_TEMPLATE/bug_report.md ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: Bug 报告(Bug Report)
3
+ about: 反馈项目中的缺陷或问题
4
+ title: "[Bug] 简短描述问题"
5
+ labels: bug
6
+ assignees: ''
7
+ ---
8
+
9
+ ## 🐛 问题描述
10
+ <!-- 清晰简洁地描述问题是什么 -->
11
+
12
+ ## 🔍 复现步骤
13
+ <!-- 详细描述复现问题的步骤 -->
14
+ 1. 打开 '...'
15
+ 2. 点击 '...'
16
+ 3. 滚动到 '...'
17
+ 4. 看到错误
18
+
19
+ ## 🤔 预期行为
20
+ <!-- 简要描述预期的正确行为 -->
21
+
22
+ ## 😯 截图
23
+ <!-- 如果适用,添加问题的截图 -->
24
+
25
+ ## 🖥️ 环境信息
26
+ - 操作系统: [例如 Windows 10]
27
+ - 项目版本: [例如 1.0.0]
28
+ - Python版本: [例如 3.9.13]
29
+ - Nodejs版本: [例如 v20.14.0]
30
+
31
+ ## 📋 其他信息
32
+ <!-- 在此添加关于此问题的任何其他上下文信息 -->
.github/ISSUE_TEMPLATE/code_improvement.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: 代码优化建议(Code Improvement)
3
+ about: 提出对现有代码的优化或改进建议
4
+ title: "[Improvement] 简短描述改进内容"
5
+ labels: refactor
6
+ assignees: ''
7
+ ---
8
+
9
+ ## 💡 改进描述
10
+ <!-- 描述需要改进的代码部分以及存在的问题 -->
11
+
12
+ ## 🌟 改进建议
13
+ <!-- 提出具体的改进方案或思路 -->
14
+
15
+ ## 🛠️ 相关代码
16
+ <!-- 如果可能,提供相关代码片段或链接 -->
17
+
18
+ ## 📋 其他信息
19
+ <!-- 在此添加任何其他相关信息 -->
.github/ISSUE_TEMPLATE/documentation_improvement.md ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: 文档改进建议(Documentation Improvement)
3
+ about: 提出对项目文档的改进或补充建议
4
+ title: "[Docs] 简短描述改进内容"
5
+ labels: documentation
6
+ assignees: ''
7
+ ---
8
+
9
+ ## 📚 改进描述
10
+ <!-- 描述需要改进的文档部分以及存在的问题 -->
11
+
12
+ ## ✨ 改进建议
13
+ <!-- 提出具体的改进方案或内容 -->
14
+
15
+ ## 📋 其他信息
16
+ <!-- 在此添加任何其他相关信息 -->
.github/ISSUE_TEMPLATE/feature_request.md ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ name: 功能请求(Feature Request)
3
+ about: 提出新的功能或改进建议
4
+ title: "[Feature] 简短描述功能"
5
+ labels: enhancement
6
+ assignees: ''
7
+ ---
8
+
9
+ ## 🚀 需求描述
10
+ <!-- 清晰简洁地描述你希望发生什么 -->
11
+
12
+ ## 🎯 解决方案
13
+ <!-- 描述你认为可行的解决方案或实现方式 -->
14
+
15
+ ## 📝 备选方案
16
+ <!-- 描述你考虑过的替代方案或功能 -->
17
+
18
+ ## 📋 其他信息
19
+ <!-- 在此添加关于需求的任何其他上下文信息 -->
.github/workflows/vitepress.yml ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # workflow 名称,可以自定义
2
+ name: Deploy GitHub Pages
3
+
4
+ # 触发条件:在代码 push 到 master 分支后,自动执行该 workflow
5
+ on:
6
+ push:
7
+ branches:
8
+ - main
9
+
10
+ # 任务
11
+ jobs:
12
+ build-and-deploy:
13
+ # 服务器环境:最新版 Ubuntu,也可以自定义版本
14
+ runs-on: ubuntu-latest
15
+ steps:
16
+ # 拉取代码
17
+ - name: Checkout
18
+ uses: actions/checkout@v2
19
+ with:
20
+ fetch-depth: 0
21
+
22
+ # 设置 Node.js 版本
23
+ - name: Setup Node.js environment
24
+ uses: actions/setup-node@v1
25
+ with:
26
+ node-version: "18.20.3"
27
+ # 安装yarn
28
+ - name: Install yarn
29
+ run: npm i yarn -g
30
+
31
+ # 如果缓存没有命中,安装依赖
32
+ - name: Install dependencies
33
+ run: cd documents && yarn install
34
+
35
+ # 生成静态文件
36
+ - name: Build
37
+ run: cd documents && yarn docs:build
38
+
39
+ # 部署到 GitHub Pages
40
+ - name: Deploy
41
+ uses: crazy-max/ghaction-github-pages@v2
42
+ env:
43
+ GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # ACCESS_TOKEN 是创建的 Secret 名称,替换为你自己创建的名称
44
+ with:
45
+ target-branch: gh-pages # 部署到 gh-pages 分支,master 分支存放的是项目源码,而 gh-pages 分支则用来存放生成的静态文件
46
+ build_dir: documents/docs/.vitepress/dist # vuepress 生成的静态文件存放的地方
.gitignore ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /logs
2
+ /config
3
+
4
+ .venv
5
+ **/__pycache__/
6
+
7
+ .idea/
8
+ venv/
9
+
10
+ # 音乐缓存
11
+ cache/
12
+
13
+
14
+ /models
15
+
16
+ # 打包相关
17
+ /build
18
+ /dist
19
+
20
+ # MACOS
21
+ .DS_Store
22
+
23
+ # IDE - VSCode
24
+ .vscode/*
25
+ !.vscode/settings.json
26
+ !.vscode/tasks.json
27
+ !.vscode/launch.json
28
+ !.vscode/extensions.json
29
+
30
+ xiaozhi.spec
31
+
32
+ /installer
LICENSE ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Junsen
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
README.en.md ADDED
@@ -0,0 +1,165 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # py-xiaozhi
2
+ <p align="center">
3
+ <a href="https://github.com/huangjunsen0406/py-xiaozhi/releases/latest">
4
+ <img src="https://img.shields.io/github/v/release/huangjunsen0406/py-xiaozhi?style=flat-square&logo=github&color=blue" alt="Release"/>
5
+ </a>
6
+ <a href="https://opensource.org/licenses/MIT">
7
+ <img src="https://img.shields.io/badge/License-MIT-green.svg?style=flat-square" alt="License: MIT"/>
8
+ </a>
9
+ <a href="https://github.com/huangjunsen0406/py-xiaozhi/stargazers">
10
+ <img src="https://img.shields.io/github/stars/huangjunsen0406/py-xiaozhi?style=flat-square&logo=github" alt="Stars"/>
11
+ </a>
12
+ <a href="https://github.com/huangjunsen0406/py-xiaozhi/releases/latest">
13
+ <img src="https://img.shields.io/github/downloads/huangjunsen0406/py-xiaozhi/total?style=flat-square&logo=github&color=52c41a1&maxAge=86400" alt="Download"/>
14
+ </a>
15
+ <a href="https://gitee.com/huang-jun-sen/py-xiaozhi">
16
+ <img src="https://img.shields.io/badge/Gitee-FF5722?style=flat-square&logo=gitee" alt="Gitee"/>
17
+ </a>
18
+ </p>
19
+
20
+ English | [简体中文](README.md)
21
+
22
+ ## Project Introduction
23
+ py-xiaozhi is a Python-based Xiaozhi voice client, designed to learn coding and experience AI voice interaction without hardware requirements. This repository is ported from [xiaozhi-esp32](https://github.com/78/xiaozhi-esp32).
24
+
25
+ ## Demo
26
+ - [Bilibili Demo Video](https://www.bilibili.com/video/BV1HmPjeSED2/#reply255921347937)
27
+
28
+ ![Image](https://github.com/user-attachments/assets/df8bd5d2-a8e6-4203-8084-46789fc8e9ad)
29
+
30
+ ## Features
31
+ - **AI Voice Interaction**: Supports voice input and recognition, enabling smart human-computer interaction with natural conversation flow.
32
+ - **Visual Multimodal**: Supports image recognition and processing, providing multimodal interaction capabilities and image content understanding.
33
+ - **IoT Device Integration**: Supports smart home device control, enabling more IoT functions and building a smart home ecosystem.
34
+ - **Online Music Playback**: Advanced Music Player: A high-performance music player built on Pygame, supporting play/pause/stop, progress control, lyric display, and local caching, delivering a more stable and smooth listening experience.
35
+ - **Voice Wake-up**: Supports wake word activation, eliminating manual operation (disabled by default, manual activation required).
36
+ - **Auto Dialogue Mode**: Implements continuous dialogue experience, enhancing user interaction fluidity.
37
+ - **Graphical Interface**: Provides intuitive GUI with Xiaozhi expressions and text display, enhancing visual experience.
38
+ - **Command Line Mode**: Supports CLI operation, suitable for embedded devices or environments without GUI.
39
+ - **Cross-platform Support**: Compatible with Windows 10+, macOS 10.15+, and Linux systems for use anywhere.
40
+ - **Volume Control**: Supports volume adjustment to adapt to different environmental requirements with unified sound control interface.
41
+ - **Session Management**: Effectively manages multi-turn dialogues to maintain interaction continuity.
42
+ - **Encrypted Audio Transmission**: Supports WSS protocol to ensure audio data security and prevent information leakage.
43
+ - **Automatic Verification Code Handling**: Automatically copies verification codes and opens browsers during first use, simplifying user operations.
44
+ - **Automatic MAC Address Acquisition**: Avoids MAC address conflicts and improves connection stability.
45
+ - **Modular Code**: Code is split and encapsulated into classes with clear responsibilities, facilitating secondary development.
46
+ - **Stability Optimization**: Fixes multiple issues including reconnection and cross-platform compatibility.
47
+
48
+ ## System Requirements
49
+ - Python version: 3.9 >= version <= 3.12
50
+ - Supported operating systems: Windows 10+, macOS 10.15+, Linux
51
+ - Microphone and speaker devices
52
+
53
+ ## Read This First!
54
+ - Carefully read [项目文档](https://huangjunsen0406.github.io/py-xiaozhi/) for startup tutorials and file descriptions
55
+ - The main branch has the latest code; manually reinstall pip dependencies after each update to ensure you have new dependencies
56
+
57
+ [Zero to Xiaozhi Client (Video Tutorial)](https://www.bilibili.com/video/BV1dWQhYEEmq/?vd_source=2065ec11f7577e7107a55bbdc3d12fce)
58
+
59
+ ## State Transition Diagram
60
+
61
+ ```
62
+ +----------------+
63
+ | |
64
+ v |
65
+ +------+ Wake/Button +------------+ | +------------+
66
+ | IDLE | -----------> | CONNECTING | --+-> | LISTENING |
67
+ +------+ +------------+ +------------+
68
+ ^ |
69
+ | | Voice Recognition Complete
70
+ | +------------+ v
71
+ +--------- | SPEAKING | <-----------------+
72
+ Playback +------------+
73
+ Complete
74
+ ```
75
+
76
+ ## Upcoming Features
77
+ - [ ] **New GUI (Electron)**: Provides a more modern and beautiful user interface, optimizing the interaction experience.
78
+
79
+ ## FAQ
80
+ - **Can't find audio device**: Please check if your microphone and speakers are properly connected and enabled.
81
+ - **Wake word not responding**: Check if the `USE_WAKE_WORD` setting in `config.json` is set to `true` and the model path is correct.
82
+ - **Network connection failure**: Check network settings and firewall configuration to ensure WebSocket or MQTT communication is not blocked.
83
+ - **Packaging failure**: Make sure PyInstaller is installed (`pip install pyinstaller`) and all dependencies are installed. Then re-execute `python scripts/build.py`
84
+
85
+ ## Related Third-party Open Source Projects
86
+ [Xiaozhi Mobile Client](https://github.com/TOM88812/xiaozhi-android-client)
87
+
88
+ [xiaozhi-esp32-server (Open source server)](https://github.com/xinnan-tech/xiaozhi-esp32-server)
89
+
90
+ [XiaoZhiAI_server32_Unity(Unity Development)](https://gitee.com/vw112266/XiaoZhiAI_server32_Unity)
91
+
92
+ [IntelliConnect(Aiot Middleware)](https://github.com/ruanrongman/IntelliConnect)
93
+
94
+ [open-xiaoai(Xiaoai Audio Access Xiaozhi)](https://github.com/idootop/open-xiaoai.git)
95
+
96
+ ## Related Branches
97
+ - main: Main branch
98
+ - feature/v1: First version
99
+ - feature/visual: Visual branch
100
+ - feature/raspberry_pi embedded device branch
101
+ ## Project Structure
102
+
103
+ ```
104
+ ├── .github # GitHub related configurations
105
+ ├── assets # Resource files (emotion animations, etc.)
106
+ ├── cache # Cache directory (music and temporary files)
107
+ ├── config # Configuration directory
108
+ ├── documents # Documentation directory
109
+ ├── hooks # PyInstaller hooks directory
110
+ ├── libs # Dependencies directory
111
+ ├── scripts # Utility scripts directory
112
+ ├── src # Source code directory
113
+ │ ├── audio_codecs # Audio encoding/decoding module
114
+ │ ├── audio_processing # Audio processing module
115
+ │ ├── constants # Constants definition
116
+ │ ├── display # Display interface module
117
+ │ ├── iot # IoT device related module
118
+ │ │ └── things # Specific device implementation directory
119
+ │ ├── network # Network communication module
120
+ │ ├── protocols # Communication protocol module
121
+ │ └── utils # Utility classes module
122
+ ```
123
+
124
+ ## Contribution Guidelines
125
+ We welcome issue reports and code contributions. Please ensure you follow these specifications:
126
+
127
+ 1. Code style complies with PEP8 standards
128
+ 2. PR submissions include appropriate tests
129
+ 3. Update relevant documentation
130
+
131
+ ## Community and Support
132
+
133
+ ### Thanks to the Following Open Source Contributors
134
+ > In no particular order
135
+
136
+ [Xiaoxia](https://github.com/78)
137
+ [zhh827](https://github.com/zhh827)
138
+ [SmartArduino-Li Honggang](https://github.com/SmartArduino)
139
+ [HonestQiao](https://github.com/HonestQiao)
140
+ [vonweller](https://github.com/vonweller)
141
+ [Sun Weigong](https://space.bilibili.com/416954647)
142
+ [isamu2025](https://github.com/isamu2025)
143
+ [Rain120](https://github.com/Rain120)
144
+ [kejily](https://github.com/kejily)
145
+ [Radio bilibili Jun](https://space.bilibili.com/119751)
146
+
147
+ ### Sponsorship Support
148
+
149
+ <div align="center">
150
+ <h3>Thanks to All Sponsors ❤️</h3>
151
+ <p>Whether it's API resources, device compatibility testing, or financial support, every contribution makes the project more complete</p>
152
+
153
+ <a href="https://huangjunsen0406.github.io/py-xiaozhi/sponsors/" target="_blank">
154
+ <img src="https://img.shields.io/badge/View-Sponsors-brightgreen?style=for-the-badge&logo=github" alt="View Sponsors">
155
+ </a>
156
+ <a href="https://huangjunsen0406.github.io/py-xiaozhi/sponsors/" target="_blank">
157
+ <img src="https://img.shields.io/badge/Become-Sponsor-orange?style=for-the-badge&logo=heart" alt="Become a Sponsor">
158
+ </a>
159
+ </div>
160
+
161
+ ## Project Statistics
162
+ [![Star History Chart](https://api.star-history.com/svg?repos=huangjunsen0406/py-xiaozhi&type=Date)](https://www.star-history.com/#huangjunsen0406/py-xiaozhi&Date)
163
+
164
+ ## License
165
+ [MIT License](LICENSE)
README.md CHANGED
@@ -1,12 +1,167 @@
1
- ---
2
- title: Xiaozhi
3
- emoji: 🌖
4
- colorFrom: blue
5
- colorTo: blue
6
- sdk: gradio
7
- sdk_version: 5.29.0
8
- app_file: app.py
9
- pinned: false
10
- ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # py-xiaozhi
2
+ <p align="center">
3
+ <a href="https://github.com/huangjunsen0406/py-xiaozhi/releases/latest">
4
+ <img src="https://img.shields.io/github/v/release/huangjunsen0406/py-xiaozhi?style=flat-square&logo=github&color=blue" alt="Release"/>
5
+ </a>
6
+ <a href="https://opensource.org/licenses/MIT">
7
+ <img src="https://img.shields.io/badge/License-MIT-green.svg?style=flat-square" alt="License: MIT"/>
8
+ </a>
9
+ <a href="https://github.com/huangjunsen0406/py-xiaozhi/stargazers">
10
+ <img src="https://img.shields.io/github/stars/huangjunsen0406/py-xiaozhi?style=flat-square&logo=github" alt="Stars"/>
11
+ </a>
12
+ <a href="https://github.com/huangjunsen0406/py-xiaozhi/releases/latest">
13
+ <img src="https://img.shields.io/github/downloads/huangjunsen0406/py-xiaozhi/total?style=flat-square&logo=github&color=52c41a1&maxAge=86400" alt="Download"/>
14
+ </a>
15
+ <a href="https://gitee.com/huang-jun-sen/py-xiaozhi">
16
+ <img src="https://img.shields.io/badge/Gitee-FF5722?style=flat-square&logo=gitee" alt="Gitee"/>
17
+ </a>
18
+ </p>
19
+
20
+
21
+
22
+ 简体中文 | [English](README.en.md)
23
+
24
+ ## 项目简介
25
+ py-xiaozhi 是一个使用 Python 实现的小智语音客户端,旨在通过代码学习和在没有硬件条件下体验 AI 小智的语音功能。
26
+ 本仓库是基于[xiaozhi-esp32](https://github.com/78/xiaozhi-esp32)移植
27
+
28
+ ## 演示
29
+ - [Bilibili 演示视频](https://www.bilibili.com/video/BV1HmPjeSED2/#reply255921347937)
30
+
31
+ ![Image](https://github.com/user-attachments/assets/df8bd5d2-a8e6-4203-8084-46789fc8e9ad)
32
+
33
+ ## 功能特点
34
+ - **AI语音交互**:支持语音输入与识别,实现智能人机交互,提供自然流畅的对话体验。
35
+ - **视觉多模态**:支持图像识别和处理,提供多模态交互能力,理解图像内容。
36
+ - **IoT 设备集成**:支持智能家居设备控制,实现更多物联网功能,打造智能家居生态。
37
+ - **联网音乐播放**:基于pygame实现的高性能音乐播放器,支持歌词显示和本地缓存,支持播放/暂停/停止、进度控制、歌词显示和本地缓存,提供更稳定的音乐播放体验。
38
+ - **语音唤醒**:支持唤醒词激活交互,免去手动操作的烦恼(默认关闭需要手动开启)。
39
+ - **自动对话模式**:实现连续对话体验,提升用户交互流畅度。
40
+ - **图形化界面**:提供直观易用的 GUI,支持小智表情与文本显示,增强视觉体验。
41
+ - **命令行模式**:支持 CLI 运行,适用于嵌入式设备或无 GUI 环境。
42
+ - **跨平台支持**:兼容 Windows 10+、macOS 10.15+ 和 Linux 系统,随时随地使用。
43
+ - **音量控制**:支持音量调节,适应不同环境需求,统一声音控制接口。
44
+ - **会话管理**:有效管理多轮对话,保持交互的连续性。
45
+ - **加密音频传输**:支持 WSS 协议,保障音频数据的安全性,防止信息泄露。
46
+ - **自动验证码处理**:首次使用时,程序自动复制验证码并打开浏览器,简化用户操作。
47
+ - **自动获取 MAC 地址**:避免 MAC 地址冲突,提高连接稳定性。
48
+ - **代码模块化**:拆分代码并封装为类,职责分明,便于二次开发。
49
+ - **稳定性优化**:修复多项问题,包括断线重连、跨平台兼容等。
50
+
51
+ ## 系统要求
52
+ - 3.9 >= Python版本 <= 3.12
53
+ - 支持的操作系统:Windows 10+、macOS 10.15+、Linux
54
+ - 麦克风和扬声器设备
55
+
56
+ ## 请先看这里!
57
+ - 仔细阅读 [项目文档](https://huangjunsen0406.github.io/py-xiaozhi/) 启动教程和文件说明都在里面了
58
+ - main是最新代码,每次更新都需要手动重新安装一次pip依赖防止我新增依赖后你们本地没有
59
+
60
+ [从零开始使用小智客户端(视频教程)](https://www.bilibili.com/video/BV1dWQhYEEmq/?vd_source=2065ec11f7577e7107a55bbdc3d12fce)
61
+
62
+ ## 状态流转图
63
+
64
+ ```
65
+ +----------------+
66
+ | |
67
+ v |
68
+ +------+ 唤醒词/按钮 +------------+ | +------------+
69
+ | IDLE | -----------> | CONNECTING | --+-> | LISTENING |
70
+ +------+ +------------+ +------------+
71
+ ^ |
72
+ | | 语音识别完成
73
+ | +------------+ v
74
+ +--------- | SPEAKING | <-----------------+
75
+ 完成播放 +------------+
76
+ ```
77
+
78
+ ## 待实现功能
79
+ - [ ] **新 GUI(Electron)**:提供更现代、美观的用户界面,优化交互体验。
80
+
81
+ ## 常见问题
82
+ - **找不到音频设备**:请检查麦克风和扬声器是否正常连接和启用。
83
+ - **唤醒词不响应**:请检查`config.json`中的`USE_WAKE_WORD`设置是否为`true`,以及模型路径是否正确。
84
+ - **网络连接失败**:请检查网络���置和防火墙配置,确保WebSocket或MQTT通信未被阻止。
85
+ - **打包失败**:确保已安装PyInstaller (`pip install pyinstaller`),并且所有依赖项都已安装。然后重新执行`python scripts/build.py`
86
+
87
+ ## 相关第三方开源项目
88
+ [小智手机端](https://github.com/TOM88812/xiaozhi-android-client)
89
+
90
+ [xiaozhi-esp32-server(开源服务端)](https://github.com/xinnan-tech/xiaozhi-esp32-server)
91
+
92
+ [XiaoZhiAI_server32_Unity(Unity开发)](https://gitee.com/vw112266/XiaoZhiAI_server32_Unity)
93
+
94
+ [IntelliConnect(Aiot中间件)](https://github.com/ruanrongman/IntelliConnect)
95
+
96
+ [open-xiaoai(小爱音响接入小智)](https://github.com/idootop/open-xiaoai.git)
97
+
98
+ ## 相关分支
99
+ - main 主分支
100
+ - feature/v1 第一个版本
101
+ - feature/visual 视觉分支
102
+ - feature/raspberry_pi 嵌入式设备分支
103
+ ## 项目结构
104
+
105
+ ```
106
+ ├── .github # GitHub 相关配置
107
+ ├── assets # 资源文件(表情动画等)
108
+ ├── cache # 缓存目录(音乐等临时文件)
109
+ ├── config # 配置文件目录
110
+ ├── documents # 文档目录
111
+ ├── hooks # PyInstaller钩子目录
112
+ ├── libs # 依赖库目录
113
+ ├── scripts # 实用脚本目录
114
+ ├── src # 源代码目录
115
+ │ ├── audio_codecs # 音频编解码模块
116
+ │ ├── audio_processing # 音频处理模块
117
+ │ ├── constants # 常量定义
118
+ │ ├── display # 显示界面模块
119
+ │ ├── iot # IoT设备相关模块
120
+ │ │ └── things # 具体设备实现目录
121
+ │ ├── network # 网络通信模块
122
+ │ ├── protocols # 通信协议模块
123
+ │ └── utils # 工具类模块
124
+ ```
125
+
126
+ ## 贡献指南
127
+ 欢迎提交问题报告和代码贡献。请确保遵循以下规范:
128
+
129
+ 1. 代码风格符合PEP8规范
130
+ 2. 提交的PR包含适当的测试
131
+ 3. 更新相关文档
132
+
133
+ ## 社区与支持
134
+
135
+ ### 感谢以下开源人员
136
+ > 排名不分前后
137
+
138
+ [Xiaoxia](https://github.com/78)
139
+ [zhh827](https://github.com/zhh827)
140
+ [四博智联-李洪刚](https://github.com/SmartArduino)
141
+ [HonestQiao](https://github.com/HonestQiao)
142
+ [vonweller](https://github.com/vonweller)
143
+ [孙卫公](https://space.bilibili.com/416954647)
144
+ [isamu2025](https://github.com/isamu2025)
145
+ [Rain120](https://github.com/Rain120)
146
+ [kejily](https://github.com/kejily)
147
+ [电波bilibili君](https://space.bilibili.com/119751)
148
+
149
+ ### 赞助支持
150
+
151
+ <div align="center">
152
+ <h3>感谢所有赞助者的支持 ❤️</h3>
153
+ <p>无论是接口资源、设备兼容测试还是资金支持,每一份帮助都让项目更加完善</p>
154
+
155
+ <a href="https://huangjunsen0406.github.io/py-xiaozhi/sponsors/" target="_blank">
156
+ <img src="https://img.shields.io/badge/查看-赞助者名单-brightgreen?style=for-the-badge&logo=github" alt="赞助者名单">
157
+ </a>
158
+ <a href="https://huangjunsen0406.github.io/py-xiaozhi/sponsors/" target="_blank">
159
+ <img src="https://img.shields.io/badge/成为-项目赞助者-orange?style=for-the-badge&logo=heart" alt="成为赞助者">
160
+ </a>
161
+ </div>
162
+
163
+ ## 项目统计
164
+ [![Star History Chart](https://api.star-history.com/svg?repos=huangjunsen0406/py-xiaozhi&type=Date)](https://www.star-history.com/#huangjunsen0406/py-xiaozhi&Date)
165
+
166
+ ## 许可证
167
+ [MIT License](LICENSE)
assets/emojis/angry.gif ADDED

Git LFS Details

  • SHA256: 0673bb640a15a1fb5448239cd1047604d8eed5418811b019befceb4082f8f5c2
  • Pointer size: 131 Bytes
  • Size of remote file: 499 kB
assets/emojis/confident.gif ADDED

Git LFS Details

  • SHA256: feb116bf68b916d9ec1f670fa9245a83b1ff7daf3e3e7753874b036a7addf738
  • Pointer size: 131 Bytes
  • Size of remote file: 577 kB
assets/emojis/confused.gif ADDED

Git LFS Details

  • SHA256: b5476b3bdeafd0f8ddf6127ddcf441515fdbe2489556d8b02185671e7ca0656c
  • Pointer size: 132 Bytes
  • Size of remote file: 1.19 MB
assets/emojis/cool.gif ADDED

Git LFS Details

  • SHA256: 1c9fef50fe50983698b64527baecf69c335507454388c70ee6c36be254ecf553
  • Pointer size: 131 Bytes
  • Size of remote file: 658 kB
assets/emojis/crying.gif ADDED

Git LFS Details

  • SHA256: c249821d6147d05e6b9c8af18ecee746e2028afa675f9dc7be978ea343c9c4fc
  • Pointer size: 131 Bytes
  • Size of remote file: 708 kB
assets/emojis/delicious.gif ADDED

Git LFS Details

  • SHA256: ca598acddccb07884886f2454cf1eedef63d0b7aa38ef1d47ceff8e43f2c3871
  • Pointer size: 131 Bytes
  • Size of remote file: 867 kB
assets/emojis/embarrassed.gif ADDED

Git LFS Details

  • SHA256: 0c74ed655cbd57f03c6408207a8ca5bcf3d02b0e1bb57154abb6399613b6b5e6
  • Pointer size: 131 Bytes
  • Size of remote file: 667 kB
assets/emojis/funny.gif ADDED

Git LFS Details

  • SHA256: c068683ecc25b26faf2ef872cb3173e332f37b2e85c5741dce83516ed3ac1569
  • Pointer size: 131 Bytes
  • Size of remote file: 728 kB
assets/emojis/happy.gif ADDED

Git LFS Details

  • SHA256: c9e7ac3295397cd4d346cc73c75074eef8c6f9f7eb0928ed87962a9310124635
  • Pointer size: 131 Bytes
  • Size of remote file: 585 kB
assets/emojis/kissy.gif ADDED

Git LFS Details

  • SHA256: 0789f325a125615f1939f1fea14b99ed75891e2c80c2705a9829312d29105d55
  • Pointer size: 131 Bytes
  • Size of remote file: 676 kB
assets/emojis/laughing.gif ADDED

Git LFS Details

  • SHA256: 64df463cf84ffe760d411a1e93362562eafc0a15a24782e638ca157b9012d22a
  • Pointer size: 132 Bytes
  • Size of remote file: 1.21 MB
assets/emojis/loving.gif ADDED

Git LFS Details

  • SHA256: 82d76ff36a0b703af760e29e6c20cd9b1c943d7f8811536d3a12b1add5bc0b99
  • Pointer size: 131 Bytes
  • Size of remote file: 587 kB
assets/emojis/neutral.gif ADDED

Git LFS Details

  • SHA256: bfa6e2b4f53a1e02325c151689701a119dfaf450640b5b49d869c7058fff7220
  • Pointer size: 131 Bytes
  • Size of remote file: 201 kB
assets/emojis/relaxed.gif ADDED

Git LFS Details

  • SHA256: 8bd404ff2356f27cb46ccc664de64dae7d2e2892db50f8f96eb4722d2d7a46b8
  • Pointer size: 131 Bytes
  • Size of remote file: 923 kB
assets/emojis/sad.gif ADDED

Git LFS Details

  • SHA256: 15561422b976be6036bb3d2f6901cfe71cc553d74aa4bc201f23faf637751349
  • Pointer size: 132 Bytes
  • Size of remote file: 1.08 MB
assets/emojis/shocked.gif ADDED

Git LFS Details

  • SHA256: 80d6df157b1ca033603cde678fa7d821951dd897a7455e36c4c62ce9e2204ad3
  • Pointer size: 131 Bytes
  • Size of remote file: 703 kB
assets/emojis/silly.gif ADDED

Git LFS Details

  • SHA256: 28dec678b5d68fa34aacc899070c75e9c182d5ca67fc9d3370ce14f61a69e29b
  • Pointer size: 131 Bytes
  • Size of remote file: 505 kB
assets/emojis/sleepy.gif ADDED

Git LFS Details

  • SHA256: 2bb3a222de60e0bfe652dbb050e83bd77b13fad09940b5cedfda617f3474512d
  • Pointer size: 131 Bytes
  • Size of remote file: 779 kB
assets/emojis/surprised.gif ADDED

Git LFS Details

  • SHA256: cd633a3d48a6f8926342fdc8497865794e483323cb99c7ab03a955d01abbdcbc
  • Pointer size: 131 Bytes
  • Size of remote file: 305 kB
assets/emojis/thinking.gif ADDED

Git LFS Details

  • SHA256: 7d484a353294e9347fc3753ddab60ce5cc13b5787b00b80f759308ae57a693e9
  • Pointer size: 131 Bytes
  • Size of remote file: 821 kB
assets/emojis/winking.gif ADDED

Git LFS Details

  • SHA256: 4d2ca8090e29d90f87d817a83b26f1461c9c9aff6133be949021613c577ea774
  • Pointer size: 131 Bytes
  • Size of remote file: 671 kB
build.json ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "xiaozhi",
3
+ "version": "1.0.0",
4
+ "publisher": "Junsen",
5
+ "entry": "main.py",
6
+ "icon": "assets/xiaozhi_icon.ico",
7
+ "hooks": "hooks",
8
+ "onefile": false,
9
+ "additional_pyinstaller_args": "--add-data assets;assets --add-data libs;libs --add-data src;src --add-data models;models --hidden-import=PyQt5",
10
+ "inno_setup_path": "E:\\application\\Inno Setup 6\\ISCC.exe",
11
+ "platform_specific": {
12
+ "windows": {
13
+ "format": "exe",
14
+ "additional_pyinstaller_args": "--add-data assets;assets --add-data libs;libs --add-data src;src --add-data models;models --hidden-import=PyQt5 --noconsole",
15
+ "desktop_entry": true,
16
+ "installer_options": {
17
+ "languages": ["ChineseSimplified", "English"],
18
+ "license_file": "LICENSE",
19
+ "readme_file": "README.md",
20
+ "create_desktop_icon": true,
21
+ "allow_run_after_install": true
22
+ }
23
+ },
24
+ "linux": {
25
+ "format": "deb",
26
+ "desktop_entry": true,
27
+ "categories": "Utility;Development;",
28
+ "description": "小智Ai客户端",
29
+ "requires": "libc6,libgtk-3-0,libx11-6,libopenblas-dev",
30
+ "additional_pyinstaller_args": "--add-data assets:assets --add-data libs:libs --add-data src:src --add-data models:models --hidden-import=PyQt5"
31
+ },
32
+ "macos": {
33
+ "format": "app",
34
+ "additional_pyinstaller_args": "--add-data assets:assets --add-data libs:libs --add-data src:src --add-data models:models --hidden-import=PyQt5 --windowed",
35
+ "app_bundle_name": "XiaoZhi.app",
36
+ "bundle_identifier": "com.junsen.xiaozhi",
37
+ "sign_bundle": false,
38
+ "create_dmg": true,
39
+ "installer_options": {
40
+ "license_file": "LICENSE",
41
+ "readme_file": "README.md"
42
+ }
43
+ }
44
+ },
45
+ "build_installer": true
46
+ }
documents/.gitignore ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ dist
2
+ node_modules
documents/README.md ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # py-xiaozhi 文档
2
+
3
+ 这是 py-xiaozhi 项目的文档网站,基于 VitePress 构建。
4
+
5
+ ## 功能
6
+
7
+ - 项目指南:提供项目的详细使用说明和开发文档
8
+ - 赞助商页面:展示并感谢项目的所有赞助者
9
+ - 贡献指南:说明如何为项目贡献代码
10
+ - 贡献者名单:展示所有为项目做出贡献的开发者
11
+ - 响应式设计:适配桌面和移动设备
12
+
13
+ ## 本地开发
14
+
15
+ ```bash
16
+ # 安装依赖
17
+ pnpm install
18
+
19
+ # 启动开发服务器
20
+ pnpm docs:dev
21
+
22
+ # 构建静态文件
23
+ pnpm docs:build
24
+
25
+ # 预览构建结果
26
+ pnpm docs:preview
27
+ ```
28
+
29
+ ## 目录结构
30
+
31
+ ```
32
+ documents/
33
+ ├── docs/ # 文档源文件
34
+ │ ├── .vitepress/ # VitePress 配置
35
+ │ ├── guide/ # 指南文档
36
+ │ ├── sponsors/ # 赞助商页面
37
+ │ ├── contributing.md # 贡献指南
38
+ │ ├── contributors.md # 贡献者名单
39
+ │ └── index.md # 首页
40
+ ├── package.json # 项目配置
41
+ └── README.md # 项目说明
42
+ ```
43
+
44
+ ## 赞助商页面
45
+
46
+ 赞助商页面通过以下方式实现:
47
+
48
+ 1. `/sponsors/` 目录包含了赞助商相关的内容
49
+ 2. `data.json` 文件存储赞助商数据
50
+ 3. 使用 Vue 组件在客户端动态渲染赞助商列表
51
+ 4. 提供成为赞助者的详细说明和支付方式
52
+
53
+ ## 贡献指南
54
+
55
+ 贡献指南页面提供了以下内容:
56
+
57
+ 1. 开发环境准备指南
58
+ 2. 代码贡献流程说明
59
+ 3. 编码规范和提交规范
60
+ 4. Pull Request 创建和审核流程
61
+ 5. 文档贡献指南
62
+
63
+ ## 贡献者名单
64
+
65
+ 贡献者名单页面展示了所有为项目做出贡献的开发者,包括:
66
+
67
+ 1. 核心开发团队成员
68
+ 2. 代码贡献者
69
+ 3. 文档贡献者
70
+ 4. 测试和反馈提供者
71
+
72
+ ## 部署
73
+
74
+ 文档网站通过 GitHub Actions 自动部署到 GitHub Pages。
documents/docs/.vitepress/config.mts ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { defineConfig } from 'vitepress'
2
+ import { getGuideSideBarItems } from './guide'
3
+ import tailwindcss from '@tailwindcss/vite'
4
+ // https://vitepress.dev/reference/site-config
5
+ export default defineConfig({
6
+ title: "PY-XIAOZHI",
7
+ description: "py-xiaozhi 是一个使用 Python 实现的小智语音客户端,旨在通过代码学习和在没有硬件条件下体验 AI 小智的语音功能。",
8
+ base: '/py-xiaozhi/',
9
+ themeConfig: {
10
+ // https://vitepress.dev/reference/default-theme-config
11
+ nav: [
12
+ { text: '主页', link: '/' },
13
+ { text: '指南', link: '/guide/00_文档目录' },
14
+ { text: '系统架构', link: '/architecture/' },
15
+ { text: '相关生态', link: '/ecosystem/' },
16
+ { text: '团队', link: '/about/team' },
17
+ { text: '贡献指南', link: '/contributing' },
18
+ { text: '赞助', link: '/sponsors/' }
19
+ ],
20
+
21
+ sidebar: {
22
+ '/guide/': [
23
+ {
24
+ text: '指南',
25
+ // 默认展开
26
+ collapsed: false,
27
+ items: getGuideSideBarItems(),
28
+ },
29
+ {
30
+ text: '旧版文档',
31
+ collapsed: true,
32
+ items: [
33
+ { text: '使用文档', link: '/guide/old_docs/使用文档' }
34
+ ]
35
+ }
36
+ ],
37
+ '/ecosystem/': [
38
+ {
39
+ text: '生态系统概览',
40
+ link: '/ecosystem/'
41
+ },
42
+ {
43
+ text: '相关项目',
44
+ collapsed: false,
45
+ items: [
46
+ { text: '小智手机端', link: '/ecosystem/projects/xiaozhi-android-client/' },
47
+ { text: 'xiaozhi-esp32-server', link: '/ecosystem/projects/xiaozhi-esp32-server/' },
48
+ { text: 'XiaoZhiAI_server32_Unity', link: '/ecosystem/projects/xiaozhi-unity/' },
49
+ { text: 'IntelliConnect', link: '/ecosystem/projects/intelliconnect/' },
50
+ { text: 'open-xiaoai', link: '/ecosystem/projects/open-xiaoai/' }
51
+ ]
52
+ },
53
+ ],
54
+ '/about/': [],
55
+ // 赞助页面不显示侧边栏
56
+ '/sponsors/': [],
57
+ // 贡献指南页面不显示侧边栏
58
+ '/contributing': [],
59
+ // 系统架构页面不显示侧边栏
60
+ '/architecture/': [],
61
+ // 团队页面不显示侧边栏
62
+ '/about/team': []
63
+ },
64
+
65
+ socialLinks: [
66
+ { icon: 'github', link: 'https://github.com/huangjunsen0406/py-xiaozhi' }
67
+ ]
68
+ },
69
+ vite: {
70
+ plugins: [
71
+ tailwindcss()
72
+ ]
73
+ }
74
+ })
documents/docs/.vitepress/guide/index.ts ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import { getMdFilesAsync } from "../utils";
2
+ import path from 'path';
3
+ import { DefaultTheme } from 'vitepress';
4
+
5
+ export function getGuideSideBarItems(): (DefaultTheme.SidebarItem)[] {
6
+ return getMdFilesAsync(path.resolve(__dirname, '../../guide'))
7
+ .map(item => {
8
+ return {
9
+ text: item,
10
+ link: `/guide/${item}`
11
+ }
12
+ }).filter(item => {
13
+ return !item.text.includes('使用文档')
14
+ })
15
+ }
documents/docs/.vitepress/theme/index.ts ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ import DefaultTheme from 'vitepress/theme'
2
+ import './styles/index.css'
3
+ import './styles/custom.scss'
4
+
5
+ export default {
6
+ ...DefaultTheme,
7
+ }
documents/docs/.vitepress/theme/styles/badges.css ADDED
@@ -0,0 +1,28 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .vt-badge.wip:before {
2
+ content: 'WIP';
3
+ }
4
+
5
+ .vt-badge.ts {
6
+ background-color: #3178c6;
7
+ }
8
+ .vt-badge.ts:before {
9
+ content: 'TS';
10
+ }
11
+
12
+ .vt-badge.dev-only,
13
+ .vt-badge.experimental {
14
+ color: var(--vt-c-text-light-1);
15
+ background-color: var(--vt-c-yellow);
16
+ }
17
+
18
+ .vt-badge.dev-only:before {
19
+ content: 'Dev only';
20
+ }
21
+
22
+ .vt-badge.experimental:before {
23
+ content: 'Experimental';
24
+ }
25
+
26
+ .vt-badge[data-text]:before {
27
+ content: attr(data-text);
28
+ }
documents/docs/.vitepress/theme/styles/custom.scss ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .architecture-page-class {
2
+ @media (min-width: 1440px) {
3
+
4
+ .VPDoc:not(.has-sidebar) .content {
5
+
6
+ max-width: 1284px !important; /* <-- update your values */
7
+
8
+ }
9
+
10
+ .VPDoc:not(.has-sidebar) .container {
11
+
12
+ max-width: 1604px !important;
13
+
14
+ }
15
+ .VPDoc.has-aside .content-container {
16
+ max-width: 1188px !important;
17
+ }
18
+
19
+ .vp-doc h3 {
20
+ margin: 0;
21
+ }
22
+ .vp-doc ul {
23
+ padding-left: 0;
24
+ }
25
+ }
26
+ }
documents/docs/.vitepress/theme/styles/index.css ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ @import "./pages.css";
2
+ @import "./badges.css";
3
+ @import "./options-boxes.css";
4
+ @import "./inline-demo.css";
5
+ @import "./utilities.css";
6
+ @import "./style-guide.css";
7
+ @import "tailwindcss";
documents/docs/.vitepress/theme/styles/inline-demo.css ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .vt-doc a[href^="https://play.vuejs.org"]:before
2
+ {
3
+ content: '▶';
4
+ width: 20px;
5
+ height: 20px;
6
+ display: inline-flex;
7
+ border-radius: 10px;
8
+ vertical-align: middle;
9
+ position: relative;
10
+ top: -2px;
11
+ color: var(--vt-c-green);
12
+ border: 2px solid var(--vt-c-green);
13
+ margin-right: 8px;
14
+ margin-left: 4px;
15
+ line-height: 16px;
16
+ padding-left: 4.2px;
17
+ font-size: 11px;
18
+ }
19
+
20
+ .demo {
21
+ padding: 22px 24px;
22
+ border-radius: 8px;
23
+ box-shadow: var(--vt-shadow-2);
24
+ margin-bottom: 1.2em;
25
+ transition: background-color 0.5s ease;
26
+ }
27
+
28
+ .dark .demo {
29
+ background-color: var(--vt-c-bg-soft);
30
+ }
31
+
32
+ .demo p {
33
+ margin: 0;
34
+ }
35
+
36
+ .demo button {
37
+ background-color: var(--vt-c-bg-mute);
38
+ transition: background-color 0.5s;
39
+ padding: 5px 12px;
40
+ border: 1px solid var(--vt-c-divider);
41
+ border-radius: 8px;
42
+ font-size: 0.9em;
43
+ font-weight: 600;
44
+ }
45
+
46
+ .demo button + button {
47
+ margin-left: 1em;
48
+ }
49
+
50
+ .demo input,
51
+ .demo textarea,
52
+ .demo select {
53
+ border: 1px solid var(--vt-c-divider);
54
+ border-radius: 4px;
55
+ padding: 0.2em 0.6em;
56
+ margin-top: 10px;
57
+ background: transparent;
58
+ transition: background-color 0.5s;
59
+ }
60
+
61
+ .dark .demo select {
62
+ background: var(--vt-c-bg-soft);
63
+ }
64
+
65
+ .dark .demo select option {
66
+ background: transparent;
67
+ }
68
+
69
+ .demo input:not([type]):focus,
70
+ .demo textarea:focus,
71
+ .demo select:focus {
72
+ outline: 1px solid blue;
73
+ }
74
+
75
+ .demo select {
76
+ /* this was set by normalize.css */
77
+ -webkit-appearance: listbox;
78
+ }
79
+
80
+ .demo label {
81
+ margin: 0 1em 0 0.4em;
82
+ }
83
+
84
+ .demo select[multiple] {
85
+ width: 100px;
86
+ }
87
+
88
+ .demo h1 {
89
+ margin: 10px 0 0;
90
+ }
documents/docs/.vitepress/theme/styles/options-boxes.css ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .next-steps {
2
+ margin-top: 3rem;
3
+ }
4
+
5
+ .next-steps .vt-box {
6
+ border: 1px solid var(--vt-c-bg-soft);
7
+ }
8
+
9
+ .next-steps .vt-box:hover {
10
+ border-color: var(--vt-c-green-light);
11
+ transition: border-color 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
12
+ }
13
+
14
+ .vt-doc .next-steps-link {
15
+ font-size: 20px;
16
+ line-height: 1.4;
17
+ letter-spacing: -0.02em;
18
+ margin-bottom: 0.75em;
19
+ display: block;
20
+ color: var(--vt-c-green);
21
+ }
22
+
23
+ .vt-doc .next-steps-caption {
24
+ margin-bottom: 0;
25
+ color: var(--vt-c-text-2);
26
+ transition: color 0.5s;
27
+ }
documents/docs/.vitepress/theme/styles/pages.css ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /* always show anchors on /api/ and /style-guide/ pages */
2
+ .vt-doc.api h2 .header-anchor,
3
+ .vt-doc.style-guide h2 .header-anchor {
4
+ opacity: 1;
5
+ }
6
+
7
+ .vt-doc.sponsor h3 {
8
+ text-align: center;
9
+ padding-bottom: 1em;
10
+ border-bottom: 1px solid var(--vt-c-divider-light);
11
+ }
12
+
13
+ .vt-doc.sponsor h3 .header-anchor {
14
+ display: none;
15
+ }
documents/docs/.vitepress/theme/styles/style-guide.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .style-example {
2
+ border-radius: 8px 8px 12px 12px;
3
+ margin: 1.6em 0;
4
+ padding: 1.6em 1.6em 0.1px;
5
+ position: relative;
6
+ border: 1px solid transparent;
7
+ transition: background-color 0.25s ease, border-color 0.25s ease;
8
+ }
9
+
10
+ .vt-doc .style-example h3 {
11
+ margin: 0;
12
+ font-size: 1.1em;
13
+ }
14
+
15
+ .style-example-bad {
16
+ background: #f7e8e8;
17
+ }
18
+ .dark .style-example-bad {
19
+ background: transparent;
20
+ border-color: var(--vt-c-red);
21
+ }
22
+
23
+ .style-example-bad h3 {
24
+ color: var(--vt-c-red);
25
+ }
26
+
27
+ .style-example-good {
28
+ background: #ecfaf7;
29
+ }
30
+ .dark .style-example-good {
31
+ background: transparent;
32
+ border-color: var(--vt-c-green);
33
+ }
34
+
35
+ .style-example-good h3 {
36
+ color: var(--vt-c-green);
37
+ }
38
+
39
+ .details summary {
40
+ font-weight: bold !important;
41
+ }
42
+
43
+ .style-verb {
44
+ font-size: 0.6em;
45
+ display: inline-block;
46
+ border-radius: 6px;
47
+ font-size: 0.65em;
48
+ line-height: 1;
49
+ font-weight: 600;
50
+ padding: 0.35em 0.4em 0.3em;
51
+ position: relative;
52
+ top: -0.15em;
53
+ margin-right: 0.5em;
54
+ color: var(--vt-c-bg);
55
+ transition: color 0.5s;
56
+ background-color: var(--vt-c-brand);
57
+ }
58
+
59
+ .style-verb.avoid {
60
+ background-color: var(--vt-c-red);
61
+ }
62
+ .vt-doc summary {
63
+ width: fit-content;
64
+ cursor: pointer;
65
+ }
documents/docs/.vitepress/theme/styles/utilities.css ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .nowrap {
2
+ white-space: nowrap;
3
+ }
4
+
5
+ .sr-only {
6
+ position: absolute;
7
+ width: 1px;
8
+ height: 1px;
9
+ padding: 0;
10
+ margin: -1px;
11
+ overflow: hidden;
12
+ clip: rect(0, 0, 0, 0);
13
+ border: 0;
14
+ }
documents/docs/.vitepress/theme/styles/vue-mastery.css ADDED
@@ -0,0 +1,65 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .vue-mastery-link {
2
+ background-color: var(--vt-c-bg-soft);
3
+ border-radius: 8px;
4
+ padding: 8px 16px 8px 8px;
5
+ transition: color 0.5s, background-color 0.5s;
6
+ }
7
+
8
+ .vue-mastery-link a {
9
+ display: flex;
10
+ align-items: center;
11
+ }
12
+
13
+ .vue-mastery-link .banner {
14
+ background-color: var(--vt-c-white-soft);
15
+ border-radius: 4px;
16
+ width: 96px;
17
+ height: 56px;
18
+ object-fit: cover;
19
+ }
20
+
21
+ .vue-mastery-link .description {
22
+ flex: 1;
23
+ font-weight: 500;
24
+ font-size: 14px;
25
+ line-height: 20px;
26
+ color: var(--vt-c-text-1);
27
+ margin: 0 0 0 16px;
28
+ transition: color 0.5s;
29
+ }
30
+
31
+ .vue-mastery-link .description span {
32
+ color: var(--vt-c-brand);
33
+ }
34
+
35
+ .vue-mastery-link .logo-wrapper {
36
+ position: relative;
37
+ width: 48px;
38
+ height: 48px;
39
+ border-radius: 50%;
40
+ background-color: var(--vt-c-white);
41
+ display: flex;
42
+ justify-content: center;
43
+ align-items: center;
44
+ }
45
+
46
+ .vue-mastery-link .logo-wrapper img {
47
+ width: 25px;
48
+ object-fit: contain;
49
+ }
50
+
51
+ @media (max-width: 576px) {
52
+ .vue-mastery-link .banner {
53
+ width: 56px;
54
+ }
55
+
56
+ .vue-mastery-link .description {
57
+ font-size: 12px;
58
+ line-height: 18px;
59
+ }
60
+ .vue-mastery-link .logo-wrapper {
61
+ position: relative;
62
+ width: 32px;
63
+ height: 32px;
64
+ }
65
+ }
documents/docs/.vitepress/utils/index.ts ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import fs from 'fs-extra';
2
+ import path from 'path';
3
+
4
+ export function getMdFilesAsync(rootDir: string) {
5
+ const results: string[] = [];
6
+
7
+ function traverse(currentDir) {
8
+ const entries = fs.readdirSync(currentDir, { withFileTypes: true });
9
+
10
+ entries.map(async (entry) => {
11
+ const entryPath = path.join(currentDir, entry.name);
12
+
13
+ if (entry.isDirectory()) {
14
+ traverse(entryPath); // 递归子目录[3](@ref)
15
+ } else if (path.extname(entry.name).toLowerCase() === '.md') {
16
+ const relativePath = path.relative(rootDir, entryPath);
17
+ results.push(relativePath);
18
+ }
19
+ })
20
+ }
21
+
22
+ traverse(rootDir);
23
+ return results.map(item => {
24
+ return item.replace('.md', '');
25
+ });
26
+ }
documents/docs/about/images/ben-hong.jpeg ADDED
documents/docs/about/images/evan-you.jpeg ADDED
documents/docs/about/team.md ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ page: true
3
+ title: Py-xiaozhi团队
4
+ layout: home
5
+ ---
6
+
7
+ <script setup>
8
+ import TeamPage from './team/TeamPage.vue'
9
+ </script>
10
+
11
+ <TeamPage />