自备梯子,配置系统代理(针对国内环境,外国不需要)

windows(注意端口,例7890)

powershell命令行设置代理:

1
$Env:http_proxy="http://127.0.0.1:7890";$Env:https_proxy="http://127.0.0.1:7890"

cmd命令行设置代理:

1
set http_proxy=http://127.0.0.1:7890 & set https_proxy=http://127.0.0.1:7890

macos/linux(注意端口,例7890)

1
export https_proxy=http://127.0.0.1:7890 https_proxy=http://127.0.0.1:7890 all_proxy=socks5://127.0.0.1:7890

yihong0618/xiaogpt https://github.com/yihong0618/xiaogpt

新建项目文件夹,下载代码

1
git clone https://github.com/yihong0618/xiaogpt.git

进去项目文件夹里的xiaogpt文件夹,安装依赖文件

1
pip install -U --force-reinstall xiaogpt

yihong0618/MiService https://github.com/yihong0618/MiService

在项目文件夹,下载代码

1
git clone https://github.com/yihong0618/MiService.git

进去项目文件夹里的MiService文件夹,安装依赖

1
pip3 install .

录入小米账号密码

1
2
export MI_USER=<Username>
export MI_PASS=<Password>

查询自己的设备

1
micli.py list

可以显示自己账号下的设备列表,包含名称、类型、DID、Token 等信息。

设置 Device ID(来自上面这条命令的结果)

1
export MI_DID=<Device ID|Name>

acheong08/ChatGPT https://github.com/acheong08/ChatGPT#v3-official-chat-api

进去项目文件夹里的xiaogpt文件夹

1
python -m pip install --upgrade revChatGPT

配置 chatgpt api key

1
python3 -m revChatGPT.V3 --api_key <api_key>

https://platform.openai.com/account/api-keys

屏蔽小爱同学回答(注意型号,例LX06)

1
2
3
4
#下面的${your_api_key}填写api_key
export OPENAI_API_KEY=${your_api_key}
#运行xiaogpt.py这个python文件
python3 xiaogpt.py --hardware LX06 --mute_xiaoai --use_gpt3 --mute_xiaoai