如何在WSL中,更换小爱音响为ChatGTP模型
安装WSL
默认安装Ubuntu,设置账号密码
wsl --install
正在安装: Ubuntu
已安装 Ubuntu。
正在启动 Ubuntu...
Installing, this may take a few minutes...
Please create a default UNIX user account. The username does not need to match your Windows username.
For more information visit: https://aka.ms/wslusers
Enter new UNIX username: kk
New password:
Retype new password:
passwd: password updated successfully
Installation successful!
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
Welcome to Ubuntu 22.04.3 LTS (GNU/Linux 5.15.146.1-microsoft-standard-WSL2 x86_64)
* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage
This message is shown once a day. To disable it please create the
/home/kk/.hushlogin file.
kk@DESKTOP-2DG8U0Z:~$
进入WSL
输入ubuntu即可
ubuntu
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
kk@DESKTOP-2DG8U0Z:~$
构建WSL基本环境
sudo apt-get update
sudo apt-get install python3-pip
sudo mkdir -p /data/
sudo chown -R kk. /data/
安装xiaogpt
git clone https://github.com/yihong0618/xiaogpt.git
Cloning into 'xiaogpt'...
remote: Enumerating objects: 1208, done.
remote: Counting objects: 100% (583/583), done.
remote: Compressing objects: 100% (156/156), done.
Rremote: Total 1208 (delta 459), reused 481 (delta 426), pack-reused 625
Receiving objects: 100% (1208/1208), 582.74 KiB | 1.80 MiB/s, done.
Resolving deltas: 100% (814/814), done.
cd xiaogpt
pip3 install -r requirements.txt
安装MiService
注意,登录国内账号时,使用正常网络,否则会登录失败
git clone https://github.com/yihong0618/MiService.git
Cloning into 'MiService'...
remote: Enumerating objects: 299, done.
remote: Counting objects: 100% (134/134), done.
remote: Compressing objects: 100% (58/58), done.
remote: Total 299 (delta 95), reused 93 (delta 76), pack-reused 165
Receiving objects: 100% (299/299), 74.22 KiB | 962.00 KiB/s, done.
Resolving deltas: 100% (187/187), done.
PS E:\code> cd .\xiaogpt\
cd ..\MiService\
pip3 install -r requirements.txt
pip3 install -U miservice_fork
配置小米账号获取设备ID
export MI_USER="xxxx"
export MI_PASS="xxxx"
python3 micli.py list
{
"name": "小爱音箱Pro电视柜",
"model": "xiaomi.wifispeaker.lx06",
"did": "379xxxx",
"token": "xxxx"
},
{
"name": "小爱音箱Pro2",
"model": "xiaomi.wifispeaker.lx06",
"did": "403xxxx",
"token": "xxxx"
},
配置openai Key更换查询模型
export MI_DID=403xxxx
pip3 install --upgrade revChatGPT
pip3 install miservice
python3 -m revChatGPT.V3 --api_key sk-xxxx
export OPENAI_API_KEY=sk-xxxx
./xiaogpt.py --hardware LX06 --use_chatgpt_api --mute_xiaoai