docs: 更新启动脚本开机自启动相关说明

This commit is contained in:
Del Wang
2025-05-10 02:26:36 +08:00
parent b4f52ee5b9
commit a2c9cd5b70
3 changed files with 52 additions and 27 deletions
+29 -8
View File
@@ -5,13 +5,34 @@
小爱音箱自定义唤醒词,基于 [sherpa-onnx](https://github.com/k2-fsa/sherpa-onnx)。
## 刷机
首先按照 [open-xiaoai](https://github.com/idootop/open-xiaoai) 里的教程将小爱音箱刷机,然后 SSH 连接到小爱音箱。
## 快速开始
## 安装脚本
> [!NOTE]
> 以下操作需要先将小爱音箱刷机, 然后 SSH 连接到小爱音箱。👉 [教程](https://github.com/idootop/open-xiaoai/blob/main/docs/flash.md)
在小爱音箱上安装启动脚本,然后重启小爱音箱。
```shell
# 创建 open-xiaoai/kws 文件夹
mkdir -p /data/open-xiaoai/kws
# 设置自定义唤醒词
cat <<EOF > /data/open-xiaoai/kws/keywords.txt
t iān m āo j īng l íng @天猫精灵
x iǎo d ù x iǎo d ù @小度小度
d òu b āo d òu b āo @豆包豆包
n ǐ h ǎo x iǎo zh ì @你好小智
EOF
# 设置唤醒提示语(可选)
cat <<EOF > /data/open-xiaoai/kws/reply.txt
主人你好,请问有什么吩咐?
EOF
# 运行启动脚本
curl -sSfL https://gitee.com/idootop/artifacts/releases/download/open-xiaoai-kws/init.sh | sh
```
如果你想要开机自启动,可以运行以下命令,然后重启小爱音箱即可。
```shell
# 下载到 /data/init.sh 开机时自启动
@@ -34,7 +55,7 @@ uv run keywords.py --tokens tokens.txt --output keywords.txt --text my-keywords.
然后将你电脑上的 `keywords.txt` 复制到小爱音箱 `/data/open-xiaoai/kws/keywords.txt`
如果你不方便复制文件,也可以直接在小爱音箱上运行以下命令(记得修改自己的唤醒词)。
如果你不方便复制文件,也可以直接在小爱音箱上运行以下命令(记得修改自己的唤醒词)。
```shell
cat <<EOF > /data/open-xiaoai/kws/keywords.txt
@@ -46,7 +67,7 @@ EOF
```
> [!TIP]
> 修改完毕后,记得重启小爱音箱使新配置生效。
> 修改完毕后,记得重启脚本或小爱音箱使新配置生效。
## 设置欢迎语
@@ -67,7 +88,7 @@ file:///usr/share/sound-vendor/AiNiRobot/wakeup_ei_01.wav
然后将你电脑上的 `reply.txt`复制到小爱音箱 `/data/open-xiaoai/kws/reply.txt`
如果你不方便复制文件,也可以直接在小爱音箱上运行以下命令(记得修改自己的欢迎语)。
如果你不方便复制文件,也可以直接在小爱音箱上运行以下命令(记得修改自己的欢迎语)。
```shell
cat <<EOF > /data/open-xiaoai/kws/reply.txt
@@ -78,7 +99,7 @@ EOF
```
> [!TIP]
> 修改完毕后,记得重启小爱音箱使新配置生效。
> 修改完毕后,记得重启脚本或小爱音箱使新配置生效。
## 常见问题
+5 -2
View File
@@ -58,10 +58,13 @@ fi
if [ ! -f "$CONFIG_DIR/keywords.txt" ]; then
echo "n ǐ h ǎo x iǎo zh ì @你好小智" >> "$CONFIG_DIR/keywords.txt"
echo "d òu b āo d òu b āo @豆包豆包" >> "$CONFIG_DIR/keywords.txt"
echo "✅ 默认关键词已创建"
echo "t iān m āo j īng l íng @天猫精灵" >> "$CONFIG_DIR/keywords.txt"
echo "x iǎo d ù x iǎo d ù @小度小度" >> "$CONFIG_DIR/keywords.txt"
echo "✅ 默认唤醒词已创建"
fi
echo "🔥 正在启动唤醒词识别服务..."
echo "🔥 正在启动唤醒词识别服务,请耐心等待..."
echo "🐢 模型加载较慢,请在语音提示初始化成功后,再使用自定义唤醒词"
kill -9 `ps|grep "open-xiaoai/kws/monitor"|grep -v grep|awk '{print $1}'` > /dev/null 2>&1 || true
"$MONITOR_BIN" &
+18 -17
View File
@@ -12,33 +12,34 @@
> [!NOTE]
> 以下操作需要先将小爱音箱刷机, 然后 SSH 连接到小爱音箱。👉 [教程](../../docs/flash.md)
首先在小爱音箱上安装启动脚本
```shell
# 创建 open-xiaoai 文件夹
mkdir /data/open-xiaoai
# 设置 server 地址(注意替换成自己的 server 地址)
cat 'ws://192.168.31.227:4399' > /data/open-xiaoai/server.txt
# 运行启动脚本
curl -sSfL https://gitee.com/idootop/artifacts/releases/download/open-xiaoai-client/init.sh | sh
```
> [!IMPORTANT]
> 你可能需要先在电脑上运行其他演示程序,以获取 server 地址
>
> 注意安全!不要连接来路不明的 server 🚨
如果你想要开机自启动,可以运行以下命令,然后重启小爱音箱即可。
```shell
# 下载到 /data/init.sh 开机时自启动
curl -L -o /data/init.sh https://gitee.com/idootop/artifacts/releases/download/open-xiaoai-client/init.sh
```
> [!NOTE]
> 请先在你的电脑上运行其他 server 演示程序,获取 server 地址
然后配置你要连接的 server 地址。注意安全!不要连接来路不明的 server 🚨
```shell
# 创建 open-xiaoai 文件夹
mkdir /data/open-xiaoai
# 更新 server 地址(注意替换成自己的 server 地址)
cat 'ws://192.168.31.227:4399' > /data/open-xiaoai/server.txt
```
最后重启小爱音箱,使更新后的 server 地址生效。
## 编译运行
> [!TIP]
> 如果你是一名开发者,想要修改源代码实现自己想要的功能,可以按照下面的步骤,自行编译运行该项目。
## 编译运行
首先,你需要在电脑上安装 `Rust` 开发环境 👉 [传送门](https://www.rust-lang.org/)
为了构建能够在小爱音箱上运行的 ARMv7 应用,你还需要安装 `cross` 👉 [传送门](https://github.com/cross-rs/cross)