Files
calx/bootstrap.sh
YANG JIANKUAN 5f7f68150e refactor: 移除自签名证书方案,服务只跑 HTTP
麦克风安全上下文改由部署方案解决:本机用 localhost,
对外部署挂 HTTPS 反向代理。删除 certs/、gen-cert.sh、
/cert 路由与 HTTPS server 分支,文档同步更新。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-18 19:28:59 +08:00

47 lines
1.4 KiB
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
# ============================================================
# 乘法口诀 —— 新电脑一键部署脚本macOS
# 作用:检查/安装依赖(ffmpeg + whisper-cpp) → 补齐模型 → 启动服务
# 幂等:已装的会跳过,可反复运行
# ============================================================
set -e
cd "$(dirname "$0")"
echo "==== 乘法口诀 部署脚本 ===="
# 1) Node
if ! command -v node >/dev/null 2>&1; then
echo "❌ 未检测到 Node.js请先安装https://nodejs.org 或 brew install node"
exit 1
fi
echo "✅ Node $(node -v)"
# 2) Homebrew
if ! command -v brew >/dev/null 2>&1; then
echo "❌ 未检测到 Homebrew请先安装https://brew.sh"
exit 1
fi
# 3) ffmpeg + whisper-cli
NEED=""
command -v ffmpeg >/dev/null 2>&1 || NEED="$NEED ffmpeg"
command -v whisper-cli >/dev/null 2>&1 || NEED="$NEED whisper-cpp"
if [ -n "$NEED" ]; then
echo "📦 安装依赖:$NEED"
brew install $NEED
else
echo "✅ ffmpeg / whisper-cli 已就绪"
fi
# 4) 模型(缺则下载 smallbase 可选)
mkdir -p models
if [ ! -f models/ggml-small.bin ]; then
echo "⬇️ 下载 small 模型 (465MB)…"
curl -L -o models/ggml-small.bin https://huggingface.co/ggerganov/whisper.cpp/resolve/main/ggml-small.bin
else
echo "✅ 模型 ggml-small.bin 已存在"
fi
echo ""
echo "==== 部署完成,启动服务 ===="
exec node server.js