#!/usr/bin/env bash # 本地启动「语音确认」静态页(勿用 file:// 打开) # 用法: ./start_voice_confirmation_web.sh [端口] (默认 livereload 热重载,需 uv sync --group dev) # 或: ./start_voice_confirmation_web.sh --plain [端口] (无热重载,仅 stdlib http.server) set -euo pipefail ROOT="$(cd "$(dirname "$0")" && pwd)" cd "$ROOT" PLAIN=0 if [ "${1:-}" = "--plain" ]; then PLAIN=1 shift fi PORT="${1:-8080}" if [ "$PLAIN" = 1 ]; then cd web/voice-confirmation echo "语音确认页面(无热重载): http://127.0.0.1:${PORT}/" echo "按 Ctrl+C 停止" exec python3 -m http.server "$PORT" --bind 127.0.0.1 fi echo "语音确认(livereload 热重载,需: uv sync --group dev): http://127.0.0.1:${PORT}/" echo "按 Ctrl+C 停止" exec uv run --group dev python scripts/dev_static_livereload.py --root web/voice-confirmation --host 127.0.0.1 --port "$PORT"