xiaogpt 2.62__tar.gz → 2.64__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. {xiaogpt-2.62 → xiaogpt-2.64}/PKG-INFO +49 -45
  2. {xiaogpt-2.62 → xiaogpt-2.64}/README.md +43 -39
  3. {xiaogpt-2.62 → xiaogpt-2.64}/pyproject.toml +6 -6
  4. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/cli.py +14 -2
  5. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/config.py +5 -1
  6. xiaogpt-2.64/xiaogpt/tts/tetos.py +31 -0
  7. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/xiaogpt.py +7 -1
  8. xiaogpt-2.62/xiaogpt/tts/tetos.py +0 -56
  9. {xiaogpt-2.62 → xiaogpt-2.64}/LICENSE +0 -0
  10. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/__init__.py +0 -0
  11. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/__main__.py +0 -0
  12. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/__init__.py +0 -0
  13. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/base_bot.py +0 -0
  14. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/chatgptapi_bot.py +0 -0
  15. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/doubao_bot.py +0 -0
  16. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/gemini_bot.py +0 -0
  17. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/glm_bot.py +0 -0
  18. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/langchain_bot.py +0 -0
  19. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/newbing_bot.py +0 -0
  20. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/bot/qwen_bot.py +0 -0
  21. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/langchain/callbacks.py +0 -0
  22. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/langchain/chain.py +0 -0
  23. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/langchain/examples/email/mail_box.py +0 -0
  24. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/langchain/examples/email/mail_summary_tools.py +0 -0
  25. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/tts/__init__.py +0 -0
  26. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/tts/base.py +0 -0
  27. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/tts/mi.py +0 -0
  28. {xiaogpt-2.62 → xiaogpt-2.64}/xiaogpt/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xiaogpt
3
- Version: 2.62
3
+ Version: 2.64
4
4
  Summary: Play ChatGPT or other LLM with xiaomi AI speaker
5
5
  Author-Email: yihong0618 <zouzou0208@gmail.com>
6
6
  License: MIT
@@ -22,7 +22,7 @@ Requires-Dist: google-search-results>=2.4.2
22
22
  Requires-Dist: google-generativeai
23
23
  Requires-Dist: numexpr>=2.8.6
24
24
  Requires-Dist: dashscope>=1.10.0
25
- Requires-Dist: tetos>=0.1.1
25
+ Requires-Dist: tetos>=0.2.1
26
26
  Requires-Dist: aiohttp==3.9.5; extra == "locked"
27
27
  Requires-Dist: aiosignal==1.3.1; extra == "locked"
28
28
  Requires-Dist: annotated-types==0.6.0; extra == "locked"
@@ -37,7 +37,7 @@ Requires-Dist: certifi==2024.2.2; extra == "locked"
37
37
  Requires-Dist: charset-normalizer==3.3.2; extra == "locked"
38
38
  Requires-Dist: click==8.1.7; extra == "locked"
39
39
  Requires-Dist: colorama==0.4.6; platform_system == "Windows" and extra == "locked"
40
- Requires-Dist: dashscope==1.17.0; extra == "locked"
40
+ Requires-Dist: dashscope==1.17.1; extra == "locked"
41
41
  Requires-Dist: dataclasses-json==0.6.3; extra == "locked"
42
42
  Requires-Dist: distro==1.9.0; extra == "locked"
43
43
  Requires-Dist: edge-tts==6.1.10; extra == "locked"
@@ -51,7 +51,7 @@ Requires-Dist: google-api-python-client==2.125.0; extra == "locked"
51
51
  Requires-Dist: google-auth==2.26.1; extra == "locked"
52
52
  Requires-Dist: google-auth-httplib2==0.2.0; extra == "locked"
53
53
  Requires-Dist: google-cloud-texttospeech==2.16.3; extra == "locked"
54
- Requires-Dist: google-generativeai==0.5.1; extra == "locked"
54
+ Requires-Dist: google-generativeai==0.5.2; extra == "locked"
55
55
  Requires-Dist: google-search-results==2.4.2; extra == "locked"
56
56
  Requires-Dist: googleapis-common-protos==1.62.0; extra == "locked"
57
57
  Requires-Dist: greenlet==3.0.3; (platform_machine == "win32" or platform_machine == "WIN32" or platform_machine == "AMD64" or platform_machine == "amd64" or platform_machine == "x86_64" or platform_machine == "ppc64le" or platform_machine == "aarch64") and extra == "locked"
@@ -79,7 +79,7 @@ Requires-Dist: mutagen==1.47.0; extra == "locked"
79
79
  Requires-Dist: mypy-extensions==1.0.0; extra == "locked"
80
80
  Requires-Dist: numexpr==2.10.0; extra == "locked"
81
81
  Requires-Dist: numpy==1.26.3; extra == "locked"
82
- Requires-Dist: openai==1.21.2; extra == "locked"
82
+ Requires-Dist: openai==1.23.2; extra == "locked"
83
83
  Requires-Dist: orjson==3.10.0; extra == "locked"
84
84
  Requires-Dist: packaging==23.2; extra == "locked"
85
85
  Requires-Dist: prompt-toolkit==3.0.43; extra == "locked"
@@ -102,7 +102,7 @@ Requires-Dist: socksio==1.0.0; extra == "locked"
102
102
  Requires-Dist: soupsieve==2.5; extra == "locked"
103
103
  Requires-Dist: sqlalchemy==2.0.25; extra == "locked"
104
104
  Requires-Dist: tenacity==8.2.3; extra == "locked"
105
- Requires-Dist: tetos==0.1.1; extra == "locked"
105
+ Requires-Dist: tetos==0.2.1; extra == "locked"
106
106
  Requires-Dist: tqdm==4.66.1; extra == "locked"
107
107
  Requires-Dist: typing-extensions==4.9.0; extra == "locked"
108
108
  Requires-Dist: typing-inspect==0.9.0; extra == "locked"
@@ -133,6 +133,7 @@ Play ChatGPT and other LLM with Xiaomi AI Speaker
133
133
  - New Bing
134
134
  - [ChatGLM](http://open.bigmodel.cn/)
135
135
  - [Gemini](https://makersuite.google.com/app/apikey)
136
+ - [Doubao](https://console.volcengine.com/iam/keymanage/)
136
137
  - [通义千问](https://help.aliyun.com/zh/dashscope/developer-reference/api-details)
137
138
 
138
139
  ## 获取小米音响DID
@@ -194,7 +195,9 @@ xiaogpt --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key}
194
195
  # 如果你想使用自己的 google gemini 服务
195
196
  python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
196
197
  # 如果你想使用阿里的通义千问
197
- xiaogpt --hardware LX06 --mute_xiaoai --use_qwen --qen_key ${qwen_key}
198
+ xiaogpt --hardware LX06 --mute_xiaoai --use_qwen --qwen_key ${qwen_key}
199
+ # 如果你想使用豆包
200
+ xiaogpt --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
198
201
  # 如果你想用 edge-tts
199
202
  xiaogpt --hardware LX06 --cookie ${cookie} --use_chatgpt_api --tts edge
200
203
  # 如果你想使用 LangChain + SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
@@ -223,7 +226,9 @@ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${ge
223
226
  # 如果你想使用自己的 google gemini 服务
224
227
  python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
225
228
  # 如果你想使用阿里的通义千问
226
- python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_qwen --qen_key ${qwen_key}
229
+ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_qwen --qwen_key ${qwen_key}
230
+ # 如果你想使用豆包
231
+ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
227
232
  # 如果你想使用 LangChain+SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
228
233
  export OPENAI_API_KEY=${your_api_key}
229
234
  export SERPAPI_API_KEY=${your_serpapi_key}
@@ -267,39 +272,39 @@ ChatGLM [文档](http://open.bigmodel.cn/doc/api#chatglm_130b)
267
272
 
268
273
  ## 配置项说明
269
274
 
270
- | 参数 | 说明 | 默认值 | 可选值 |
271
- | --------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
272
- | hardware | 设备型号 | | |
273
- | account | 小爱账户 | | |
274
- | password | 小爱账户密码 | | |
275
- | openai_key | openai的apikey | | |
276
- | serpapi_api_key | serpapi的key 参考 [SerpAPI](https://serpapi.com/) | | |
277
- | glm_key | chatglm 的 apikey | | |
278
- | gemini_key | gemini 的 apikey [参考](https://makersuite.google.com/app/apikey) | | |
279
- | gemini_api_domain | gemini 的自定义域名 [参考](https://github.com/antergone/palm-netlify-proxy) | |
280
- | qwen_key | qwen 的 apikey [参考](https://help.aliyun.com/zh/dashscope/developer-reference/api-details) | | |
281
- | cookie | 小爱账户cookie (如果用上面密码登录可以不填) | | |
282
- | mi_did | 设备did | | |
283
- | use_command | 使用 MI command 与小爱交互 | `false` | |
284
- | mute_xiaoai | 快速停掉小爱自己的回答 | `true` | |
285
- | verbose | 是否打印详细日志 | `false` | |
286
- | bot | 使用的 bot 类型,目前支持 chatgptapi,newbing, qwen, gemini | `chatgptapi` | |
287
- | tts | 使用的 TTS 类型 | `mi` | `edge`、 `openai`、`azure`、`volc`、`baidu`、`google` |
288
- | tts_options | TTS 参数字典,参考 [tetos](https://github.com/frostming/tetos) 获取可用参数 | | |
289
- | prompt | 自定义prompt | `请用100字以内回答` | |
290
- | keyword | 自定义请求词列表 | `["请"]` | |
291
- | change_prompt_keyword | 更改提示词触发列表 | `["更改提示词"]` | |
292
- | start_conversation | 开始持续对话关键词 | `开始持续对话` | |
293
- | end_conversation | 结束持续对话关键词 | `结束持续对话` | |
294
- | stream | 使用流式响应,获得更快的响应 | `false` | |
295
- | proxy | 支持 HTTP 代理,传入 http proxy URL | "" | |
296
- | gpt_options | OpenAI API 的参数字典 | `{}` | |
297
- | bing_cookie_path | NewBing使用的cookie路径,参考[这里]获取 | 也可通过环境变量 `COOKIE_FILE` 设置 | |
298
- | bing_cookies | NewBing使用的cookie字典,参考[这里]获取 | | |
299
- | deployment_id | Azure OpenAI 服务的 deployment ID | 参考这个[如何找到deployment_id](https://github.com/yihong0618/xiaogpt/issues/347#issuecomment-1784410784) | |
300
- | api_base | 如果需要替换默认的api,或者使用Azure OpenAI 服务 | 例如:`https://abc-def.openai.azure.com/` |
301
- | volc_access_key | 火山引擎的 access key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
302
- | volc_secret_key | 火山引擎的 secret key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
275
+ | 参数 | 说明 | 默认值 | 可选值 |
276
+ | --------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------- |
277
+ | hardware | 设备型号 | | |
278
+ | account | 小爱账户 | | |
279
+ | password | 小爱账户密码 | | |
280
+ | openai_key | openai的apikey | | |
281
+ | serpapi_api_key | serpapi的key 参考 [SerpAPI](https://serpapi.com/) | | |
282
+ | glm_key | chatglm 的 apikey | | |
283
+ | gemini_key | gemini 的 apikey [参考](https://makersuite.google.com/app/apikey) | | |
284
+ | gemini_api_domain | gemini 的自定义域名 [参考](https://github.com/antergone/palm-netlify-proxy) | |
285
+ | qwen_key | qwen 的 apikey [参考](https://help.aliyun.com/zh/dashscope/developer-reference/api-details) | | |
286
+ | cookie | 小爱账户cookie (如果用上面密码登录可以不填) | | |
287
+ | mi_did | 设备did | | |
288
+ | use_command | 使用 MI command 与小爱交互 | `false` | |
289
+ | mute_xiaoai | 快速停掉小爱自己的回答 | `true` | |
290
+ | verbose | 是否打印详细日志 | `false` | |
291
+ | bot | 使用的 bot 类型,目前支持 chatgptapi,newbing, qwen, gemini | `chatgptapi` | |
292
+ | tts | 使用的 TTS 类型 | `mi` | `edge`、 `openai`、`azure`、`volc`、`baidu`、`google`、`minimax` |
293
+ | tts_options | TTS 参数字典,参考 [tetos](https://github.com/frostming/tetos) 获取可用参数 | | |
294
+ | prompt | 自定义prompt | `请用100字以内回答` | |
295
+ | keyword | 自定义请求词列表 | `["请"]` | |
296
+ | change_prompt_keyword | 更改提示词触发列表 | `["更改提示词"]` | |
297
+ | start_conversation | 开始持续对话关键词 | `开始持续对话` | |
298
+ | end_conversation | 结束持续对话关键词 | `结束持续对话` | |
299
+ | stream | 使用流式响应,获得更快的响应 | `false` | |
300
+ | proxy | 支持 HTTP 代理,传入 http proxy URL | "" | |
301
+ | gpt_options | OpenAI API 的参数字典 | `{}` | |
302
+ | bing_cookie_path | NewBing使用的cookie路径,参考[这里]获取 | 也可通过环境变量 `COOKIE_FILE` 设置 | |
303
+ | bing_cookies | NewBing使用的cookie字典,参考[这里]获取 | | |
304
+ | deployment_id | Azure OpenAI 服务的 deployment ID | 参考这个[如何找到deployment_id](https://github.com/yihong0618/xiaogpt/issues/347#issuecomment-1784410784) | |
305
+ | api_base | 如果需要替换默认的api,或者使用Azure OpenAI 服务 | 例如:`https://abc-def.openai.azure.com/` |
306
+ | volc_access_key | 火山引擎的 access key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
307
+ | volc_secret_key | 火山引擎的 secret key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
303
308
  [这里]: https://github.com/acheong08/EdgeGPT#getting-authentication-required
304
309
 
305
310
  ## 注意
@@ -375,7 +380,7 @@ docker build --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
375
380
 
376
381
  ### 第三方 TTS
377
382
 
378
- 我们目前支持是三种第三方 TTS:edge/openai/azure
383
+ 我们目前支持是三种第三方 TTS:edge/openai/azure/volc/baidu/google
379
384
 
380
385
  [edge-tts](https://github.com/rany2/edge-tts) 提供了类似微软tts的能力
381
386
  [azure-tts](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/9-more-realistic-ai-voices-for-conversations-now-generally/ba-p/4099471) 提供了微软 azure tts 的能力
@@ -388,17 +393,16 @@ docker build --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
388
393
  ```json
389
394
  {
390
395
  "tts": "edge",
391
- "tts_voice": "zh-CN-XiaoxiaoNeural"
392
396
  }
393
397
  ```
394
398
 
395
- 查看更多语言支持, 从中选择一个
399
+ For edge 查看更多语言支持, 从中选择一个
396
400
 
397
401
  ```shell
398
402
  edge-tts --list-voices
399
403
  ```
400
404
 
401
- #### 在容器中使用 edge-tts/azure-tts/openai-tts
405
+ #### 在容器中使用 edge-tts/azure-tts/openai-tts/volc/google/baidu
402
406
 
403
407
  由于 Edge TTS 启动了一个本地的 HTTP 服务,所以需要将容器的端口映射到宿主机上,并且指定本地机器的 hostname:
404
408
 
@@ -16,6 +16,7 @@ Play ChatGPT and other LLM with Xiaomi AI Speaker
16
16
  - New Bing
17
17
  - [ChatGLM](http://open.bigmodel.cn/)
18
18
  - [Gemini](https://makersuite.google.com/app/apikey)
19
+ - [Doubao](https://console.volcengine.com/iam/keymanage/)
19
20
  - [通义千问](https://help.aliyun.com/zh/dashscope/developer-reference/api-details)
20
21
 
21
22
  ## 获取小米音响DID
@@ -77,7 +78,9 @@ xiaogpt --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key}
77
78
  # 如果你想使用自己的 google gemini 服务
78
79
  python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
79
80
  # 如果你想使用阿里的通义千问
80
- xiaogpt --hardware LX06 --mute_xiaoai --use_qwen --qen_key ${qwen_key}
81
+ xiaogpt --hardware LX06 --mute_xiaoai --use_qwen --qwen_key ${qwen_key}
82
+ # 如果你想使用豆包
83
+ xiaogpt --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
81
84
  # 如果你想用 edge-tts
82
85
  xiaogpt --hardware LX06 --cookie ${cookie} --use_chatgpt_api --tts edge
83
86
  # 如果你想使用 LangChain + SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
@@ -106,7 +109,9 @@ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${ge
106
109
  # 如果你想使用自己的 google gemini 服务
107
110
  python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
108
111
  # 如果你想使用阿里的通义千问
109
- python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_qwen --qen_key ${qwen_key}
112
+ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_qwen --qwen_key ${qwen_key}
113
+ # 如果你想使用豆包
114
+ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
110
115
  # 如果你想使用 LangChain+SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
111
116
  export OPENAI_API_KEY=${your_api_key}
112
117
  export SERPAPI_API_KEY=${your_serpapi_key}
@@ -150,39 +155,39 @@ ChatGLM [文档](http://open.bigmodel.cn/doc/api#chatglm_130b)
150
155
 
151
156
  ## 配置项说明
152
157
 
153
- | 参数 | 说明 | 默认值 | 可选值 |
154
- | --------------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------- | ----------------------------------------------------- |
155
- | hardware | 设备型号 | | |
156
- | account | 小爱账户 | | |
157
- | password | 小爱账户密码 | | |
158
- | openai_key | openai的apikey | | |
159
- | serpapi_api_key | serpapi的key 参考 [SerpAPI](https://serpapi.com/) | | |
160
- | glm_key | chatglm 的 apikey | | |
161
- | gemini_key | gemini 的 apikey [参考](https://makersuite.google.com/app/apikey) | | |
162
- | gemini_api_domain | gemini 的自定义域名 [参考](https://github.com/antergone/palm-netlify-proxy) | |
163
- | qwen_key | qwen 的 apikey [参考](https://help.aliyun.com/zh/dashscope/developer-reference/api-details) | | |
164
- | cookie | 小爱账户cookie (如果用上面密码登录可以不填) | | |
165
- | mi_did | 设备did | | |
166
- | use_command | 使用 MI command 与小爱交互 | `false` | |
167
- | mute_xiaoai | 快速停掉小爱自己的回答 | `true` | |
168
- | verbose | 是否打印详细日志 | `false` | |
169
- | bot | 使用的 bot 类型,目前支持 chatgptapi,newbing, qwen, gemini | `chatgptapi` | |
170
- | tts | 使用的 TTS 类型 | `mi` | `edge`、 `openai`、`azure`、`volc`、`baidu`、`google` |
171
- | tts_options | TTS 参数字典,参考 [tetos](https://github.com/frostming/tetos) 获取可用参数 | | |
172
- | prompt | 自定义prompt | `请用100字以内回答` | |
173
- | keyword | 自定义请求词列表 | `["请"]` | |
174
- | change_prompt_keyword | 更改提示词触发列表 | `["更改提示词"]` | |
175
- | start_conversation | 开始持续对话关键词 | `开始持续对话` | |
176
- | end_conversation | 结束持续对话关键词 | `结束持续对话` | |
177
- | stream | 使用流式响应,获得更快的响应 | `false` | |
178
- | proxy | 支持 HTTP 代理,传入 http proxy URL | "" | |
179
- | gpt_options | OpenAI API 的参数字典 | `{}` | |
180
- | bing_cookie_path | NewBing使用的cookie路径,参考[这里]获取 | 也可通过环境变量 `COOKIE_FILE` 设置 | |
181
- | bing_cookies | NewBing使用的cookie字典,参考[这里]获取 | | |
182
- | deployment_id | Azure OpenAI 服务的 deployment ID | 参考这个[如何找到deployment_id](https://github.com/yihong0618/xiaogpt/issues/347#issuecomment-1784410784) | |
183
- | api_base | 如果需要替换默认的api,或者使用Azure OpenAI 服务 | 例如:`https://abc-def.openai.azure.com/` |
184
- | volc_access_key | 火山引擎的 access key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
185
- | volc_secret_key | 火山引擎的 secret key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
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) | | |
167
+ | gemini_api_domain | gemini 的自定义域名 [参考](https://github.com/antergone/palm-netlify-proxy) | |
168
+ | qwen_key | qwen 的 apikey [参考](https://help.aliyun.com/zh/dashscope/developer-reference/api-details) | | |
169
+ | cookie | 小爱账户cookie (如果用上面密码登录可以不填) | | |
170
+ | mi_did | 设备did | | |
171
+ | use_command | 使用 MI command 与小爱交互 | `false` | |
172
+ | mute_xiaoai | 快速停掉小爱自己的回答 | `true` | |
173
+ | verbose | 是否打印详细日志 | `false` | |
174
+ | bot | 使用的 bot 类型,目前支持 chatgptapi,newbing, qwen, gemini | `chatgptapi` | |
175
+ | tts | 使用的 TTS 类型 | `mi` | `edge`、 `openai`、`azure`、`volc`、`baidu`、`google`、`minimax` |
176
+ | tts_options | TTS 参数字典,参考 [tetos](https://github.com/frostming/tetos) 获取可用参数 | | |
177
+ | prompt | 自定义prompt | `请用100字以内回答` | |
178
+ | keyword | 自定义请求词列表 | `["请"]` | |
179
+ | change_prompt_keyword | 更改提示词触发列表 | `["更改提示词"]` | |
180
+ | start_conversation | 开始持续对话关键词 | `开始持续对话` | |
181
+ | end_conversation | 结束持续对话关键词 | `结束持续对话` | |
182
+ | stream | 使用流式响应,获得更快的响应 | `false` | |
183
+ | proxy | 支持 HTTP 代理,传入 http proxy URL | "" | |
184
+ | gpt_options | OpenAI API 的参数字典 | `{}` | |
185
+ | bing_cookie_path | NewBing使用的cookie路径,参考[这里]获取 | 也可通过环境变量 `COOKIE_FILE` 设置 | |
186
+ | bing_cookies | NewBing使用的cookie字典,参考[这里]获取 | | |
187
+ | deployment_id | Azure OpenAI 服务的 deployment ID | 参考这个[如何找到deployment_id](https://github.com/yihong0618/xiaogpt/issues/347#issuecomment-1784410784) | |
188
+ | api_base | 如果需要替换默认的api,或者使用Azure OpenAI 服务 | 例如:`https://abc-def.openai.azure.com/` |
189
+ | volc_access_key | 火山引擎的 access key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
190
+ | volc_secret_key | 火山引擎的 secret key 请在[这里](https://console.volcengine.com/iam/keymanage/)获取 | | |
186
191
  [这里]: https://github.com/acheong08/EdgeGPT#getting-authentication-required
187
192
 
188
193
  ## 注意
@@ -258,7 +263,7 @@ docker build --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
258
263
 
259
264
  ### 第三方 TTS
260
265
 
261
- 我们目前支持是三种第三方 TTS:edge/openai/azure
266
+ 我们目前支持是三种第三方 TTS:edge/openai/azure/volc/baidu/google
262
267
 
263
268
  [edge-tts](https://github.com/rany2/edge-tts) 提供了类似微软tts的能力
264
269
  [azure-tts](https://techcommunity.microsoft.com/t5/ai-azure-ai-services-blog/9-more-realistic-ai-voices-for-conversations-now-generally/ba-p/4099471) 提供了微软 azure tts 的能力
@@ -271,17 +276,16 @@ docker build --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
271
276
  ```json
272
277
  {
273
278
  "tts": "edge",
274
- "tts_voice": "zh-CN-XiaoxiaoNeural"
275
279
  }
276
280
  ```
277
281
 
278
- 查看更多语言支持, 从中选择一个
282
+ For edge 查看更多语言支持, 从中选择一个
279
283
 
280
284
  ```shell
281
285
  edge-tts --list-voices
282
286
  ```
283
287
 
284
- #### 在容器中使用 edge-tts/azure-tts/openai-tts
288
+ #### 在容器中使用 edge-tts/azure-tts/openai-tts/volc/google/baidu
285
289
 
286
290
  由于 Edge TTS 启动了一个本地的 HTTP 服务,所以需要将容器的端口映射到宿主机上,并且指定本地机器的 hostname:
287
291
 
@@ -25,10 +25,10 @@ dependencies = [
25
25
  "google-generativeai",
26
26
  "numexpr>=2.8.6",
27
27
  "dashscope>=1.10.0",
28
- "tetos>=0.1.1",
28
+ "tetos>=0.2.1",
29
29
  ]
30
30
  dynamic = []
31
- version = "2.62"
31
+ version = "2.64"
32
32
 
33
33
  [project.license]
34
34
  text = "MIT"
@@ -55,7 +55,7 @@ locked = [
55
55
  "charset-normalizer==3.3.2",
56
56
  "click==8.1.7",
57
57
  "colorama==0.4.6 ; platform_system == \"Windows\"",
58
- "dashscope==1.17.0",
58
+ "dashscope==1.17.1",
59
59
  "dataclasses-json==0.6.3",
60
60
  "distro==1.9.0",
61
61
  "edge-tts==6.1.10",
@@ -69,7 +69,7 @@ locked = [
69
69
  "google-auth==2.26.1",
70
70
  "google-auth-httplib2==0.2.0",
71
71
  "google-cloud-texttospeech==2.16.3",
72
- "google-generativeai==0.5.1",
72
+ "google-generativeai==0.5.2",
73
73
  "google-search-results==2.4.2",
74
74
  "googleapis-common-protos==1.62.0",
75
75
  "greenlet==3.0.3 ; platform_machine == \"win32\" or platform_machine == \"WIN32\" or platform_machine == \"AMD64\" or platform_machine == \"amd64\" or platform_machine == \"x86_64\" or platform_machine == \"ppc64le\" or platform_machine == \"aarch64\"",
@@ -97,7 +97,7 @@ locked = [
97
97
  "mypy-extensions==1.0.0",
98
98
  "numexpr==2.10.0",
99
99
  "numpy==1.26.3",
100
- "openai==1.21.2",
100
+ "openai==1.23.2",
101
101
  "orjson==3.10.0",
102
102
  "packaging==23.2",
103
103
  "prompt-toolkit==3.0.43",
@@ -120,7 +120,7 @@ locked = [
120
120
  "soupsieve==2.5",
121
121
  "sqlalchemy==2.0.25",
122
122
  "tenacity==8.2.3",
123
- "tetos==0.1.1",
123
+ "tetos==0.2.1",
124
124
  "tqdm==4.66.1",
125
125
  "typing-extensions==4.9.0",
126
126
  "typing-inspect==0.9.0",
@@ -83,8 +83,12 @@ def main():
83
83
  default=None,
84
84
  help="try to mute xiaoai answer",
85
85
  )
86
- parser.add_argument("--volc-access-key", help="Volcengine access key")
87
- parser.add_argument("--volc-secret-key", help="Volcengine secret key")
86
+ parser.add_argument(
87
+ "--volc_access_key", dest="volc_access_key", help="Volcengine access key"
88
+ )
89
+ parser.add_argument(
90
+ "--volc_secret_key", dest="volc_secret_key", help="Volcengine secret key"
91
+ )
88
92
  parser.add_argument(
89
93
  "--verbose",
90
94
  dest="verbose",
@@ -140,6 +144,13 @@ def main():
140
144
  const="gemini",
141
145
  help="if use gemini",
142
146
  )
147
+ bot_group.add_argument(
148
+ "--use_doubao",
149
+ dest="bot",
150
+ action="store_const",
151
+ const="doubao",
152
+ help="if use doubao",
153
+ )
143
154
  parser.add_argument(
144
155
  "--bing_cookie_path",
145
156
  dest="bing_cookie_path",
@@ -156,6 +167,7 @@ def main():
156
167
  "gemini",
157
168
  "langchain",
158
169
  "qwen",
170
+ "doubao",
159
171
  ],
160
172
  )
161
173
  parser.add_argument(
@@ -76,7 +76,9 @@ class Config:
76
76
  start_conversation: str = "开始持续对话"
77
77
  end_conversation: str = "结束持续对话"
78
78
  stream: bool = False
79
- tts: Literal["mi", "edge", "azure", "openai", "baidu", "google", "volc"] = "mi"
79
+ tts: Literal[
80
+ "mi", "edge", "azure", "openai", "baidu", "google", "volc", "minimax"
81
+ ] = "mi"
80
82
  tts_options: dict[str, Any] = field(default_factory=dict)
81
83
  gpt_options: dict[str, Any] = field(default_factory=dict)
82
84
  bing_cookie_path: str = ""
@@ -153,6 +155,8 @@ class Config:
153
155
  key, value = "bot", "gemini"
154
156
  elif key == "use_qwen":
155
157
  key, value = "bot", "qwen"
158
+ elif key == "use_doubao":
159
+ key, value = "bot", "doubao"
156
160
  elif key == "use_langchain":
157
161
  key, value = "bot", "langchain"
158
162
  elif key == "enable_edge_tts":
@@ -0,0 +1,31 @@
1
+ from __future__ import annotations
2
+
3
+ import tempfile
4
+ from pathlib import Path
5
+
6
+ from miservice import MiNAService
7
+
8
+ from xiaogpt.config import Config
9
+ from xiaogpt.tts.base import AudioFileTTS
10
+
11
+
12
+ class TetosTTS(AudioFileTTS):
13
+ def __init__(
14
+ self, mina_service: MiNAService, device_id: str, config: Config
15
+ ) -> None:
16
+ from tetos import get_speaker
17
+
18
+ super().__init__(mina_service, device_id, config)
19
+ assert config.tts and config.tts != "mi"
20
+ speaker_cls = get_speaker(config.tts)
21
+ try:
22
+ self.speaker = speaker_cls(**config.tts_options)
23
+ except TypeError as e:
24
+ raise ValueError(f"{e}. Please add them via `tts_options` config") from e
25
+
26
+ async def make_audio_file(self, lang: str, text: str) -> tuple[Path, float]:
27
+ output_file = tempfile.NamedTemporaryFile(
28
+ suffix=".mp3", mode="wb", delete=False, dir=self.dirname.name
29
+ )
30
+ duration = await self.speaker.synthesize(text, output_file.name, lang=lang)
31
+ return Path(output_file.name), duration
@@ -418,9 +418,15 @@ class MiGPT:
418
418
  # It is not a legal language code, discard it
419
419
  lang, first_chunk = "", text
420
420
 
421
+ lang = (
422
+ matches[0]
423
+ if (matches := re.findall(r"([a-z]{2}-[A-Z]{2})", lang))
424
+ else "zh-CN"
425
+ )
426
+
421
427
  async def gen(): # reconstruct the generator
422
428
  yield first_chunk
423
429
  async for text in text_stream:
424
430
  yield text
425
431
 
426
- await self.tts.synthesize(lang or "zh-CN", gen())
432
+ await self.tts.synthesize(lang, gen())
@@ -1,56 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import tempfile
4
- from pathlib import Path
5
-
6
- from miservice import MiNAService
7
- from tetos.base import Speaker
8
-
9
- from xiaogpt.config import Config
10
- from xiaogpt.tts.base import AudioFileTTS
11
-
12
-
13
- class TetosTTS(AudioFileTTS):
14
- def __init__(
15
- self, mina_service: MiNAService, device_id: str, config: Config
16
- ) -> None:
17
- super().__init__(mina_service, device_id, config)
18
- self.speaker = self._get_speaker()
19
-
20
- def _get_speaker(self) -> Speaker:
21
- from tetos.azure import AzureSpeaker
22
- from tetos.baidu import BaiduSpeaker
23
- from tetos.edge import EdgeSpeaker
24
- from tetos.google import GoogleSpeaker
25
- from tetos.openai import OpenAISpeaker
26
- from tetos.volc import VolcSpeaker
27
-
28
- options = self.config.tts_options
29
- allowed_speakers: list[str] = []
30
- for speaker in (
31
- OpenAISpeaker,
32
- EdgeSpeaker,
33
- AzureSpeaker,
34
- VolcSpeaker,
35
- GoogleSpeaker,
36
- BaiduSpeaker,
37
- ):
38
- if (name := speaker.__name__[:-7].lower()) == self.config.tts:
39
- try:
40
- return speaker(**options)
41
- except TypeError as e:
42
- raise ValueError(
43
- f"{e}. Please add them via `tts_options` config"
44
- ) from e
45
- else:
46
- allowed_speakers.append(name)
47
- raise ValueError(
48
- f"Unsupported TTS: {self.config.tts}, allowed: {','.join(allowed_speakers)}"
49
- )
50
-
51
- async def make_audio_file(self, lang: str, text: str) -> tuple[Path, float]:
52
- output_file = tempfile.NamedTemporaryFile(
53
- suffix=".mp3", mode="wb", delete=False, dir=self.dirname.name
54
- )
55
- duration = await self.speaker.synthesize(text, output_file.name, lang=lang)
56
- return Path(output_file.name), duration
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes