3
3
[ ![ PyPI] ( https://img.shields.io/pypi/v/xiaogpt?style=flat-square )] ( https://pypi.org/project/xiaogpt )
4
4
[ ![ Docker Image Version (latest by date)] ( https://img.shields.io/docker/v/yihong0618/xiaogpt?color=%23086DCD&label=docker%20image )] ( https://hub.docker.com/r/yihong0618/xiaogpt )
5
5
6
- https://user-images.githubusercontent.com/15976103/226803357-72f87a41-a15b-409e-94f5-e2d262eecd53.mp4
6
+ < https://user-images.githubusercontent.com/15976103/226803357-72f87a41-a15b-409e-94f5-e2d262eecd53.mp4 >
7
7
8
8
Play ChatGPT and other LLM with Xiaomi AI Speaker
9
9
@@ -17,11 +17,15 @@ Play ChatGPT and other LLM with Xiaomi AI Speaker
17
17
- [ ChatGLM] ( http://open.bigmodel.cn/ )
18
18
- [ Gemini] ( https://makersuite.google.com/app/apikey )
19
19
- [ Doubao] ( https://console.volcengine.com/iam/keymanage/ )
20
+ - [ Moonshot] ( https://platform.moonshot.cn/docs/api/chat#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B )
21
+ - [ 01] ( https://platform.lingyiwanwu.com/apikeys )
22
+ - [ Llama3] ( https://console.groq.com/docs/quickstart )
20
23
- [ 通义千问] ( https://help.aliyun.com/zh/dashscope/developer-reference/api-details )
21
24
22
25
## 获取小米音响DID
23
- | 系统和Shell | Linux * sh | Windows CMD用户 | Windows PowerShell用户 |
24
- | ------------- | ---------------------------------------------- | -------------------------------------- | ---------------------------------------------- |
26
+
27
+ | 系统和Shell | Linux * sh | Windows CMD用户 | Windows PowerShell用户 |
28
+ | ------------| ------------------------------------------------| ----------------------------------------| ------------------------------------------------|
25
29
| 1、安装包 | ` pip install miservice_fork ` | ` pip install miservice_fork ` | ` pip install miservice_fork ` |
26
30
| 2、设置变量 | ` export MI_USER=xxx ` <br > ` export MI_PASS=xxx ` | ` set MI_USER=xxx ` <br >` set MI_PASS=xxx ` | ` $env:MI_USER="xxx" ` <br > ` $env:MI_PASS="xxx" ` |
27
31
| 3、取得MI_DID | ` micli list ` | ` micli list ` | ` micli list ` |
@@ -47,13 +51,14 @@ Play ChatGPT and other LLM with Xiaomi AI Speaker
47
51
- 参考我 fork 的 [ MiService] ( https://github.com/yihong0618/MiService ) 项目 README 并在本地 terminal 跑 ` micli list ` 拿到你音响的 DID 成功 ** 别忘了设置 export MI_DID=xxx** 这个 MI_DID 用
48
52
- run ` xiaogpt --hardware ${your_hardware} --use_chatgpt_api ` hardware 你看小爱屁股上有型号,输入进来,如果在屁股上找不到或者型号不对,可以用 ` micli mina ` 找到型号
49
53
- 跑起来之后就可以问小爱同学问题了,“帮我"开头的问题,会发送一份给 ChatGPT 然后小爱同学用 tts 回答
50
- - 如果上面不可用,可以尝试用手机抓包,https://userprofile.mina.mi.com/device_profile/v2/conversation 找到 cookie 利用 ` --cookie '${cookie}' ` cookie 别忘了用单引号包裹
54
+ - 如果上面不可用,可以尝试用手机抓包,< https://userprofile.mina.mi.com/device_profile/v2/conversation > 找到 cookie 利用 ` --cookie '${cookie}' ` cookie 别忘了用单引号包裹
51
55
- 默认用目前 ubus, 如果你的设备不支持 ubus 可以使用 ` --use_command ` 来使用 command 来 tts
52
56
- 使用 ` --mute_xiaoai ` 选项,可以快速停掉小爱的回答
53
57
- 使用 ` --account ${account} --password ${password} `
54
58
- 如果有能力可以自行替换唤醒词,也可以去掉唤醒词
55
59
- 使用 ` --use_chatgpt_api ` 的 api 那样可以更流畅的对话,速度特别快,达到了对话的体验, [ openai api] ( https://platform.openai.com/account/api-keys ) , 命令 ` --use_chatgpt_api `
56
60
- 如果你遇到了墙需要用 Cloudflare Workers 替换 api_base 请使用 ` --api_base ${url} ` 来替换。 ** 请注意,此处你输入的api应该是'` https://xxxx/v1 ` '的字样,域名需要用引号包裹**
61
+ - ` --use_moonshot_api ` and other models please refer below
57
62
- 可以跟小爱说 ` 开始持续对话 ` 自动进入持续对话状态,` 结束持续对话 ` 结束持续对话状态。
58
63
- 可以使用 ` --tts edge ` 来获取更好的 tts 能力
59
64
- 可以使用 ` --tts openai ` 来获取 openai tts 能力
@@ -79,11 +84,17 @@ xiaogpt --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key}
79
84
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
80
85
# 如果你想使用阿里的通义千问
81
86
xiaogpt --hardware LX06 --mute_xiaoai --use_qwen --qwen_key ${qwen_key}
87
+ # 如果你想使用 kimi
88
+ xiaogpt --hardware LX06 --mute_xiaoai --use_moonshot_api --moonshot_api_key ${moonshot_api_key}
89
+ # 如果你想使用 llama3
90
+ xiaogpt --hardware LX06 --mute_xiaoai --use_llama --llama_api_key ${llama_api_key}
91
+ # 如果你想使用 01
92
+ xiaogpt --hardware LX06 --mute_xiaoai --use_yi_api --ti_api_key ${yi_api_key}
82
93
# 如果你想使用豆包
83
- xiaogpt --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
84
- # 如果你想用 edge-tts
85
- xiaogpt --hardware LX06 --cookie ${cookie} --use_chatgpt_api --tts edge
86
- # 如果你想使用 LangChain + SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
94
+
95
+
96
+
97
+
87
98
export OPENAI_API_KEY=${your_api_key}
88
99
export SERPAPI_API_KEY=${your_serpapi_key}
89
100
xiaogpt --hardware Lx06 --use_langchain --mute_xiaoai --stream --openai_key ${your_api_key} --serpapi_api_key ${your_serpapi_key}
@@ -110,8 +121,14 @@ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${ge
110
121
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
111
122
# 如果你想使用阿里的通义千问
112
123
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_qwen --qwen_key ${qwen_key}
124
+ # 如果你想使用 kimi
125
+ xiaogpt --hardware LX06 --mute_xiaoai --use_moonshot_api --moonshot_api_key ${moonshot_api_key}
126
+ # 如果你想使用 01
127
+ xiaogpt --hardware LX06 --mute_xiaoai --use_yi_api --ti_api_key ${yi_api_key}
113
128
# 如果你想使用豆包
114
129
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
130
+ # 如果你想使用 llama3
131
+ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_llama --llama_api_key ${llama_api_key}
115
132
# 如果你想使用 LangChain+SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
116
133
export OPENAI_API_KEY=${your_api_key}
117
134
export SERPAPI_API_KEY=${your_serpapi_key}
@@ -155,15 +172,18 @@ ChatGLM [文档](http://open.bigmodel.cn/doc/api#chatglm_130b)
155
172
156
173
## 配置项说明
157
174
158
- | 参数 | 说明 | 默认值 | 可选值 |
159
- | --------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
160
- | hardware | 设备型号 | | |
161
- | account | 小爱账户 | | |
162
- | password | 小爱账户密码 | | |
163
- | openai_key | openai的apikey | | |
164
- | serpapi_api_key | serpapi的key 参考 [ SerpAPI] ( https://serpapi.com/ ) | | |
165
- | glm_key | chatglm 的 apikey | | |
166
- | gemini_key | gemini 的 apikey [ 参考] ( https://makersuite.google.com/app/apikey ) | | |
175
+ | 参数 | 说明 | 默认值 | 可选值 |
176
+ | ------------------| -----------------------------------------------------------------------------------------------------------| --------| --------|
177
+ | hardware | 设备型号 | | |
178
+ | account | 小爱账户 | | |
179
+ | password | 小爱账户密码 | | |
180
+ | openai_key | openai的apikey | | |
181
+ | moonshot_api_key | moonshot kimi 的 [ apikey] ( https://platform.moonshot.cn/docs/api/chat#%E5%BF%AB%E9%80%9F%E5%BC%80%E5%A7%8B ) | | |
182
+ | yi_api_key | 01 wanwu 的 [ apikey] ( https://platform.lingyiwanwu.com/apikeys ) | | |
183
+ | llama_api_key | groq 的 llama3 [ apikey] ( https://console.groq.com/docs/quickstart ) | | |
184
+ | serpapi_api_key | serpapi的key 参考 [ SerpAPI] ( https://serpapi.com/ ) | | |
185
+ | glm_key | chatglm 的 apikey | | |
186
+ | gemini_key | gemini 的 apikey [ 参考] ( https://makersuite.google.com/app/apikey ) | | |
167
187
| gemini_api_domain | gemini 的自定义域名 [ 参考] ( https://github.com/antergone/palm-netlify-proxy ) | |
168
188
| qwen_key | qwen 的 apikey [ 参考] ( https://help.aliyun.com/zh/dashscope/developer-reference/api-details ) | | |
169
189
| cookie | 小爱账户cookie (如果用上面密码登录可以不填) | | |
@@ -188,30 +208,30 @@ ChatGLM [文档](http://open.bigmodel.cn/doc/api#chatglm_130b)
188
208
| api_base | 如果需要替换默认的api,或者使用Azure OpenAI 服务 | 例如:` https://abc-def.openai.azure.com/ ` |
189
209
| volc_access_key | 火山引擎的 access key 请在[ 这里] ( https://console.volcengine.com/iam/keymanage/ ) 获取 | | |
190
210
| volc_secret_key | 火山引擎的 secret key 请在[ 这里] ( https://console.volcengine.com/iam/keymanage/ ) 获取 | | |
191
- [ 这里 ] : https://github.com/acheong08/EdgeGPT#getting-authentication-required
211
+ [ 这里 ] : < https://github.com/acheong08/EdgeGPT#getting-authentication-required >
192
212
193
213
## 注意
194
214
195
215
1 . 请开启小爱同学的蓝牙
196
216
2 . 如果要更改提示词和 PROMPT 在代码最上面自行更改
197
217
3 . 目前已知 LX04、X10A 和 L05B L05C 可能需要使用 ` --use_command ` ,否则可能会出现终端能输出GPT的回复但小爱同学不回答GPT的情况。这几个型号也只支持小爱原本的 tts.
198
- 4 . 在wsl使用时, 需要设置代理为 http://wls的ip:port(vpn的代理端口) , 否则会出现连接超时的情况, 详情 [ 报错: Error communicating with OpenAI] ( https://github.com/yihong0618/xiaogpt/issues/235 )
218
+ 4 . 在wsl使用时, 需要设置代理为 < http://wls的ip:port(vpn的代理端口) > , 否则会出现连接超时的情况, 详情 [ 报错: Error communicating with OpenAI] ( https://github.com/yihong0618/xiaogpt/issues/235 )
199
219
200
220
## QA
201
221
202
222
1 . 用破解么?不用
203
223
2 . 你做这玩意也没用啊?确实。。。但是挺好玩的,有用对你来说没用,对我们来说不一定呀
204
224
3 . 想把它变得更好?PR Issue always welcome.
205
225
4 . 还有问题?提 Issue 哈哈
206
- 5 . Exception: Error https://api2.mina.mi.com/admin/v2/device_list?master=0&requestId=app_ios_xxx : Login failed [ @KJZH001 ] ( https://github.com/KJZH001 ) <br >
226
+ 5 . Exception: Error < https://api2.mina.mi.com/admin/v2/device_list?master=0&requestId=app_ios_xxx > : Login failed [ @KJZH001 ] ( https://github.com/KJZH001 ) <br >
207
227
这是由于小米风控导致,海外地区无法登录大陆的账户,请尝试cookie登录
208
228
无法抓包的可以在本地部署完毕项目后再用户文件夹` C:\Users\用户名 ` 下面找到.mi.token,然后扔到你无法登录的服务器去<br >
209
229
若是linux则请放到当前用户的home文件夹,此时你可以重新执行先前的命令,不出意外即可正常登录(但cookie可能会过一段时间失效,需要重新获取)<br >
210
230
详情请见 [ https://github.com/yihong0618/xiaogpt/issues/332 ] ( https://github.com/yihong0618/xiaogpt/issues/332 )
211
231
212
232
## 视频教程
213
233
214
- https://www.youtube.com/watch?v=K4YA8YwzOOA
234
+ < https://www.youtube.com/watch?v=K4YA8YwzOOA >
215
235
216
236
## Docker
217
237
0 commit comments