From 3f85e07ba700053b319bbf0f8897bb00000b1481 Mon Sep 17 00:00:00 2001 From: Del Wang Date: Thu, 8 May 2025 23:07:07 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E7=A1=AE=E4=BF=9D=20kws=20=E6=AD=A3?= =?UTF-8?q?=E7=A1=AE=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- examples/kws/init.sh | 31 ++++++++++++++++--- .../src/bin/{client-kws.rs => kws-monitor.rs} | 0 2 files changed, 27 insertions(+), 4 deletions(-) rename packages/client-rust/src/bin/{client-kws.rs => kws-monitor.rs} (100%) diff --git a/examples/kws/init.sh b/examples/kws/init.sh index cf4fd8f..2c85172 100644 --- a/examples/kws/init.sh +++ b/examples/kws/init.sh @@ -3,7 +3,7 @@ set -e MIN_SPACE_MB=32 -DOWNLOAD_URL="https://gitee.com/idootop/artifacts/releases/download/open-xiaoai-kws/kws.tar.gz" +DOWNLOAD_BASE_URL="https://gitee.com/idootop/artifacts/releases/download/open-xiaoai-kws" check_disk_space() { @@ -27,6 +27,7 @@ fi WORK_DIR="$BASE_DIR/open-xiaoai/kws" +KWS_BIN="$WORK_DIR/kws" if [ ! -d "$WORK_DIR" ]; then mkdir -p "$WORK_DIR" @@ -34,17 +35,39 @@ fi if [ ! -f "$WORK_DIR/kws" ]; then echo "🔥 正在下载模型文件..." - curl -L -# -o "$WORK_DIR/kws.tar.gz" https://gitee.com/idootop/artifacts/releases/download/open-xiaoai-kws/kws.tar.gz + curl -L -# -o "$WORK_DIR/kws.tar.gz" "$DOWNLOAD_BASE_URL/kws.tar.gz" tar -xzvf "$WORK_DIR/kws.tar.gz" -C "$WORK_DIR" + chmod +x "$KWS_BIN" rm "$WORK_DIR/kws.tar.gz" echo "✅ 模型文件下载完毕" fi + +CONFIG_DIR="/data/open-xiaoai/kws" +KWS_MONITOR_BIN="$CONFIG_DIR/kws-monitor" + +if [ ! -d "$CONFIG_DIR" ]; then + mkdir -p "$CONFIG_DIR" +fi + +if [ ! -f "$KWS_MONITOR_BIN" ]; then + curl -L -# -o "$KWS_MONITOR_BIN" "$DOWNLOAD_BASE_URL/kws-monitor" + chmod +x "$KWS_MONITOR_BIN" +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 "✅ 默认关键词已创建" +fi + echo "🔥 正在启动唤醒词识别服务..." -chmod +x "$WORK_DIR/kws" +kill -9 `ps|grep "open-xiaoai/kws/kws-monitor"|grep -v grep|awk '{print $1}'` +"$KWS_MONITOR_BIN" & -"$WORK_DIR/kws" \ +kill -9 `ps|grep "open-xiaoai/kws/kws"|grep -v grep|awk '{print $1}'` +"$KWS_BIN" \ --model-type=zipformer2 \ --tokens="$WORK_DIR/models/tokens.txt" \ --encoder="$WORK_DIR/models/encoder.onnx" \ diff --git a/packages/client-rust/src/bin/client-kws.rs b/packages/client-rust/src/bin/kws-monitor.rs similarity index 100% rename from packages/client-rust/src/bin/client-kws.rs rename to packages/client-rust/src/bin/kws-monitor.rs