Files
operating-room-monitor-server/clients/voice-confirmation/start_http.sh
Kevin 6bc6801df9 统一 Docker Compose 部署,并将客户端拆分为独立子项目。
移除宿主机/conda 启动脚本与 dev 联调工具,后端仅通过 docker compose 部署并默认启用 GPU。模拟客户端与语音确认页迁入 clients/ 下自包含目录,切断对后端源码路径的依赖。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-21 15:56:53 +08:00

36 lines
1.0 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.
#!/usr/bin/env bash
# 纯静态语音确认页:必须用 HTTP(S) 打开(勿用 file://),否则麦克风等行为异常。
# 用法: ./start_http.sh [端口],默认 8080监听地址由环境变量 VOCH_HTTP_BIND 指定,默认 0.0.0.0。
set -euo pipefail
DIR="$(cd "$(dirname "$0")" && pwd)"
cd "$DIR"
PORT="${1:-8080}"
BIND="${VOCH_HTTP_BIND:-0.0.0.0}"
LAN_IP="$(python3 - <<'PY'
import socket
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
try:
s.connect(("8.8.8.8", 80))
print(s.getsockname()[0])
except OSError:
print("")
finally:
s.close()
PY
)"
echo "语音确认静态页监听: ${BIND}:${PORT}"
if [[ "${BIND}" == "0.0.0.0" || "${BIND}" == "::" ]]; then
echo "本机访问: http://127.0.0.1:${PORT}/"
if [[ -n "${LAN_IP}" ]]; then
echo "局域网访问: http://${LAN_IP}:${PORT}/"
echo "服务端 Base URL 常用: http://${LAN_IP}:38080"
fi
else
echo "访问: http://${BIND}:${PORT}/"
fi
echo "Ctrl+C 停止"
exec python3 -m http.server "$PORT" --bind "$BIND" --directory "$DIR"