Skip to content

Commit

Permalink
fix: doubao doc and doubao cli
Browse files Browse the repository at this point in the history
Signed-off-by: yihong0618 <zouzou0208@gmail.com>
  • Loading branch information
yihong0618 committed Apr 20, 2024
1 parent e0bdf4c commit 7a915f1
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 14 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -135,4 +135,5 @@ config/
*.mp3
.pdm-python
.pdm-build/
chatgpt.sh
chatgpt.sh
nohup.out
12 changes: 8 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ Play ChatGPT and other LLM with Xiaomi AI Speaker
- New Bing
- [ChatGLM](http://open.bigmodel.cn/)
- [Gemini](https://makersuite.google.com/app/apikey)
- [Doubao](https://console.volcengine.com/iam/keymanage/)
- [通义千问](https://help.aliyun.com/zh/dashscope/developer-reference/api-details)

## 获取小米音响DID
Expand Down Expand Up @@ -78,6 +79,8 @@ xiaogpt --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key}
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
# 如果你想使用阿里的通义千问
xiaogpt --hardware LX06 --mute_xiaoai --use_qwen --qen_key ${qwen_key}
# 如果你想使用豆包
xiaogpt --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
# 如果你想用 edge-tts
xiaogpt --hardware LX06 --cookie ${cookie} --use_chatgpt_api --tts edge
# 如果你想使用 LangChain + SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
Expand Down Expand Up @@ -107,6 +110,8 @@ python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${ge
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gemini --gemini_key ${gemini_key} --gemini_api_domain ${gemini_api_domain}
# 如果你想使用阿里的通义千问
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_qwen --qen_key ${qwen_key}
# 如果你想使用豆包
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_doubao --stream --volc_access_key xxxx --volc_secret_key xxx
# 如果你想使用 LangChain+SerpApi 实现上网检索或其他本地服务(目前仅支持 stream 模式)
export OPENAI_API_KEY=${your_api_key}
export SERPAPI_API_KEY=${your_serpapi_key}
Expand Down Expand Up @@ -258,7 +263,7 @@ docker build --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple

### 第三方 TTS

我们目前支持是三种第三方 TTS:edge/openai/azure
我们目前支持是三种第三方 TTS:edge/openai/azure/volc/baidu/google

[edge-tts](https://github.com/rany2/edge-tts) 提供了类似微软tts的能力
[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 的能力
Expand All @@ -271,17 +276,16 @@ docker build --build-arg PIP_INDEX_URL=https://pypi.tuna.tsinghua.edu.cn/simple
```json
{
"tts": "edge",
"tts_voice": "zh-CN-XiaoxiaoNeural"
}
```

查看更多语言支持, 从中选择一个
For edge 查看更多语言支持, 从中选择一个

```shell
edge-tts --list-voices
```

#### 在容器中使用 edge-tts/azure-tts/openai-tts
#### 在容器中使用 edge-tts/azure-tts/openai-tts/volc/google/baidu

由于 Edge TTS 启动了一个本地的 HTTP 服务,所以需要将容器的端口映射到宿主机上,并且指定本地机器的 hostname:

Expand Down
14 changes: 7 additions & 7 deletions pdm.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 14 additions & 2 deletions xiaogpt/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,12 @@ def main():
default=None,
help="try to mute xiaoai answer",
)
parser.add_argument("--volc-access-key", help="Volcengine access key")
parser.add_argument("--volc-secret-key", help="Volcengine secret key")
parser.add_argument(
"--volc_access_key", dest="volc_access_key", help="Volcengine access key"
)
parser.add_argument(
"--volc_secret_key", dest="volc_secret_key", help="Volcengine secret key"
)
parser.add_argument(
"--verbose",
dest="verbose",
Expand Down Expand Up @@ -140,6 +144,13 @@ def main():
const="gemini",
help="if use gemini",
)
bot_group.add_argument(
"--use_doubao",
dest="bot",
action="store_const",
const="doubao",
help="if use doubao",
)
parser.add_argument(
"--bing_cookie_path",
dest="bing_cookie_path",
Expand All @@ -156,6 +167,7 @@ def main():
"gemini",
"langchain",
"qwen",
"doubao",
],
)
parser.add_argument(
Expand Down
2 changes: 2 additions & 0 deletions xiaogpt/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ def read_from_file(cls, config_path: str) -> dict:
key, value = "bot", "gemini"
elif key == "use_qwen":
key, value = "bot", "qwen"
elif key == "use_doubao":
key, value = "bot", "doubao"
elif key == "use_langchain":
key, value = "bot", "langchain"
elif key == "enable_edge_tts":
Expand Down

0 comments on commit 7a915f1

Please sign in to comment.