py-xiaozhi 小智语音AI助手
一个基于Python实现的轻量级AI语音助手,支持语音交互、多模态视觉识别、IoT设备控制和音乐播放等功能,无需专用硬件即可体验。
• Copy the embed code to showcase this product on your website
• Share on X to spread the word about this amazing tool
一个基于Python实现的轻量级AI语音助手,支持语音交互、多模态视觉识别、IoT设备控制和音乐播放等功能,无需专用硬件即可体验。
• Copy the embed code to showcase this product on your website
• Share on X to spread the word about this amazing tool
├── .github # GitHub 相关配置├── config # 配置文件目录├── docs # 详细文档目录├── hooks # PyInstaller钩子目录├── libs # 依赖库目录├── resources # 资源文件目录├── scripts # 实用脚本目录├── src # 源代码目录│ ├── audio_codecs # 音频编解码模块│ ├── audio_processing # 音频处理模块│ ├── constants # 常量定义│ ├── display # 显示界面模块│ ├── iot # IoT设备相关模块│ │ ├── things # 具体设备实现│ │ ├── thing.py # 设备基类│ │ └── thing_manager.py # 设备管理器│ ├── protocols # 通信协议模块│ ├── utils # 工具类模块│ └── application.py # 应用程序主类├── LICENSE # 项目许可证├── README.md # 项目说明文档├── main.py # 程序入口点└── requirements.txt # Python 依赖包列表## 安装运行1. 克隆项目仓库 git clone https://github.com/huangjunsen0406/py-xiaozhi.git cd py-xiaozhi 2. 安装依赖 - 请根据项目根目录的docs下的文档进行安装其他第三方依赖 pip install -r requirements.txt # Windows/Linux pip install -r requirements_mac.txt # macOS 3. 运行程序 python main.py # 默认GUI模式 python main.py --mode cli # 命令行模式 python main.py --protocol mqtt # 使用MQTT协议 ## 使用说明### 基本操作- 启动程序:运行main.py- 语音交互:点击麦克风按钮或使用唤醒词激活- 结束对话:等待AI回复完成或点击停止按钮- 打断功能:在AI回答过程中使用F3键或界面按钮打断- 音量调节:使用界面上的音量滑块调节### 语音命令示例- 基础交互:"你好"、"你是谁"、"谢谢"、"再见"- 灯光控制:"打开/关闭客厅的灯"- 音乐播放:"播放周杰伦的稻香。"- 摄像头控制:"打开摄像头"、"识别画面"、"关闭摄像头"- 音量控制:"把音量调到50%"、"音量调小一点"### 配置说明- 唤醒词设置:在config.json中设置USE_WAKE_WORD为true- 摄像头配置:配置CAMERA部分的参数,包括摄像头索引和视觉API密钥- 音频设置:调整AUDIO部分的参数,包括采样率和缓冲区大小- 协议选择:设置默认通信协议(WebSocket或MQTT)### 高级功能- 自定义IoT设备:通过继承Thing基类创建自定义设备- 视觉识别配置:接入智普视觉大模型API,实现更强大的视觉分析能力- 自动化任务:设置定时任务或条件触发的自动化场景## 状态流转图 +----------------+ | | v |+------+ 唤醒词/按钮 +------------+ | +------------+| IDLE | -----------> | CONNECTING | --+-> | LISTENING |+------+ +------------+ +------------+ ^ | | | 语音识别完成 | +------------+ v +--------- | SPEAKING | <-----------------+ 完成播放 +------------+## 常见问题解决- 找不到音频设备:检查麦克风和扬声器是否正常连接和启用- 唤醒词不响应:确认config.json中USE_WAKE_WORD设置为true,模型路径正确- 网络连接失败:检查网络设置和防火墙配置,确保WebSocket通信未被阻止- 视觉识别失败:确认摄像头权限已授予,智普API密钥正确配置## 贡献与支持- 欢迎提交Issues和Pull Requests- 遵循PEP8代码规范和模块化设计原则- 加入社区讨论群交流使用心得- 支持项目发展,成为项目赞助者## 许可证MIT LicenseA code-free online store builder to turn views into revenue. Sell digital products, subscriptions, and merch, without fees or hassle.
Convert videos into awesome blog posts.
Fast Image AI instantly transforms your photos into stunning styles like Ghibli, Sketch, and Pixar. Effortlessly control image elements and create amazing effects with just one click.
AI-powered tool that transforms casual photos into professional LinkedIn headshots instantly. No photographer needed—just upload and download.
Crevas unifies Veo 3, Sora 2, Nano Banana and more into one intuitive canvas — so filmmakers can script, prompt, and generate cinematic stories without switching tools or losing consistency.
AI Foto Edit - Text to Image & Image Edit