Merge branch 'dev' of https://github.com/idootop/mi-gpt into dev

This commit is contained in:
WJG 2024-06-15 09:47:02 +08:00
commit 4122db104b
No known key found for this signature in database
GPG Key ID: 258474EF8590014A
7 changed files with 87 additions and 11 deletions

21
LICENSE Normal file
View File

@ -0,0 +1,21 @@
MIT License
Copyright (c) 2024 Del Wang
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -33,6 +33,14 @@
- **🔊 自定义 TTS**。厌倦了小爱同学的语音?帮你解锁[「豆包」](https://doubao.com)同款音色,就像真人在回你的消息。
- **🤖️ 智能家居 Agent**。心情不好小爱立刻懂你自动帮你播放喜欢的音乐调节灯光逗你开心。_TODO_
## 🔊 设备要求
本项目支持大部分的小爱音箱型号,推荐使用小爱音箱 Pro完美运行
👉 [查看更多兼容的小爱音箱型号和配置参数](https://github.com/idootop/mi-gpt/blob/main/docs/compatibility.md)
> 注意本项目暂不支持小度音箱、天猫精灵、HomePod 等智能音箱设备,亦无相关适配计划。
## ⚡️ 快速开始
`MiGPT` 有两种启动方式: [Docker](#docker) 和 [Node.js](#nodejs)。
@ -82,7 +90,7 @@ main();
注意:此模式下并不会主动读取 `.env``.migpt.js` 中的配置信息,你需要手动初始化 Node 环境变量,并将 `.migpt.js` 中的参数作为 `MiGPT.create` 的初始化参数传入。👉 [示例代码](https://github.com/idootop/mi-gpt/blob/example/index.ts)
## 📖 项目文档
## 📖 使用文档
以下为更详细的使用教程,大多数问题都可在 [💬 常见问题](https://github.com/idootop/mi-gpt/blob/main/docs/faq.md) 中找到答案。
@ -106,3 +114,7 @@ main();
- https://github.com/jialeicui/open-lx01
- https://github.com/inu1255/mi-service
- https://github.com/Yonsm/MiService
## License
[MIT](https://github.com/idootop/mi-gpt/blob/main/LICENSE) License © 2024-PRESENT Del Wang

41
docs/compatibility.md Normal file
View File

@ -0,0 +1,41 @@
# 🔊 支持的小爱音箱型号
## ✅ 完美运行
已知可以完美运行 `MiGPT` 的小爱音箱型号有:
| 名称 | 型号 | ttsCommand | wakeUpCommand | playingCommand | streamResponse | 反馈来源 |
| ------------ | --------------------------------------------------------------------------------------------------- | ---------- | ------------- | -------------- | -------------- | -------------------------------------- |
| 小爱音箱 Pro | [LX06](https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:speaker:0000A015:xiaomi-lx06:2) | `[5, 1]` | `[5, 3]` | - | true | [@idootop](https://github.com/idootop) |
## 🚗 正常运行
> 部分机型的 MIoT 接口不支持查询设备播放状态或查询状态异常,比如小米音箱 Play 增强版L05C将会导致 `MiGPT` 部分功能异常,无法使用连续对话等,此时需要关闭 `streamResponse`。相关 [issue](https://github.com/idootop/mi-gpt/issues/14)
可以正常运行 `MiGPT`,但不支持连续对话的小爱音箱型号有:
| 名称 | 型号 | ttsCommand | wakeUpCommand | playingCommand | streamResponse | 反馈来源 |
| ----------------------------- | --------------------------------------------------------------------------------------------------- | ---------- | ------------- | -------------- | -------------- | ---------------------------------------------------------- |
| 小爱音箱 | [L06A](https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:speaker:0000A015:xiaomi-l06a:2) | `[5, 1]` | `[5, 2]` | - | false | [@zhanglc](https://github.com/idootop/mi-gpt/issues/42) |
| 小爱音箱 Play | [L05B](https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:speaker:0000A015:xiaomi-l05b:1) | `[5, 3]` | `[5, 1]` | - | false | [@BiuBiu2323](https://github.com/idootop/mi-gpt/issues/48) |
| 小米小爱音箱 Play 增强版 | [L05C](https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:speaker:0000A015:xiaomi-l05c:1) | `[5, 3]` | `[5, 1]` | - | false | [@lyddias](https://github.com/idootop/mi-gpt/issues/14) |
| Xiaomi 智能家庭屏 6 | [X6A](https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:speaker:0000A015:xiaomi-x6a:1) | `[7, 3]` | `[7, 1]` | - | false | [@Hongwing](https://github.com/idootop/mi-gpt/issues/80) |
| Redmi 小爱触屏音箱 Pro 8 英寸 | [X08E](https://home.miot-spec.com/spec?type=urn:miot-spec-v2:device:speaker:0000A015:xiaomi-x08e:1) | `[7, 3]` | `[7, 1]` | - | false | [@shangjiyu](https://github.com/idootop/mi-gpt/issues/20) |
## ❌ 不支持
完全不支持 `MiGPT` 的小爱音箱型号有:
| 名称 | 型号 | 反馈来源 |
| --------------- | -------------------------------------------------------------- | --------------------------------------------------------- |
| 小米小爱音箱 HD | [SM4](https://home.miot-spec.com/spec/onemore.wifispeaker.sm4) | [@romantech](https://github.com/idootop/mi-gpt/issues/91) |
## 🔥 型号分享
如果你是其他型号的小爱音箱,欢迎把你的型号和配置参数分享给大家,谢谢。分享格式如下:
- 型号:小爱音箱 Pro【LX06】
- ttsCommand[5, 1]
- wakeUpCommand[5, 3]
- playingCommand未设置
- streamResponsetrue支持唤醒模式

View File

@ -2,7 +2,9 @@
### Q支持哪些型号的小爱音箱
大部分型号的小爱音箱都支持,推荐小爱音箱 Pro完美运行。部分机型的 MioT 接口开放能力并不完整,比如小米音箱 Play 增强版L05C将会导致 `MiGPT` 部分功能异常(比如流式响应和唤醒模式等),相关 [issue](https://github.com/idootop/mi-gpt/issues/14)。
大部分型号的小爱音箱都支持,推荐小爱音箱 Pro完美运行
👉 [查看兼容的小爱音箱型号和配置参数](https://github.com/idootop/mi-gpt/blob/main/docs/compatibility.md)
> 注意本项目暂不支持小度音箱、天猫精灵、HomePod 等智能音箱设备,亦无相关适配计划。

View File

@ -2,13 +2,12 @@
> 以下是一些可以优化的地方或新功能,仅作记录之用,暂时没有开发计划。
## 🐛 修复
- 【重要】自动刷新小米账号登录凭证
- 小米账号登录凭证有效期 1 个月到期后需要自动刷新mi-service-lite
## 💪 优化
- 使用通知事件获取最新消息和设备播放状态
- 提高及时响应速度
- 适配更多机型使其支持连续对话
- 减轻轮询对服务端造成的压力
- 自动识别设备型号
- 通过查询设备 miot spec 文件,自动获取指令参数
- 自动识别设备属性值是否有读取权限
@ -20,7 +19,7 @@
- 增强对话系统
- 添加是否启用对话模式的开关
- 支持通过语音命令清除上下文
- MioT AI Agents
- MIoT AI Agents
- 支持小爱音箱控制米家设备
- 通过 Agent 机制自动调用合适的工具(设备)
- RAG

View File

@ -7,12 +7,12 @@
- ✅ 新增自定义系统 Prompt 功能
- 登录凭证过期后自动刷新 token https://github.com/idootop/mi-gpt/issues/76
- 支持火山引擎 TTS 和音色切换能力(微软 TTS、OpenAI TTS 待定)
- 添加 MIT license
## 💪 优化
- ✅ 优化网络请求错误重试策略(消息/播放状态轮询)
- 移除 TTS 不发音字符emoji
- 【待定】使用通知事件获取最新消息和设备播放状态
## 📚 文档
@ -25,5 +25,6 @@
- ✅ 添加进入唤醒模式时小爱莫名开始播放歌曲的说明 https://github.com/idootop/mi-gpt/issues/71
- ✅ 添加部署和接入本地大语言模型的教程 https://github.com/idootop/mi-gpt/issues/82
- ✅ 添加获取小爱音箱 did 的相关说明
- 添加常见小爱音箱型号的支持情况和参数列表
- 添加常见小爱音箱型号的支持情况和参数列表
- 添加更详细的使用和配置视频教程
- 添加 302.AI Sponsor 链接

View File

@ -332,7 +332,7 @@ export class BaseSpeaker {
}
if (!this.streamResponse) {
// 非流式响应,直接返回,不再等待设备播放完毕
// todo 考虑后续通过 MioT 通知事件,接收设备播放状态变更通知。
// todo 考虑后续通过 MIoT 通知事件,接收设备播放状态变更通知。
return;
}
// 等待一段时间,确保本地设备状态已更新