Files
AIRegulation-DocAnalysis/start_frontend.sh
2026-05-14 15:07:34 +08:00

47 lines
1.1 KiB
Bash

#!/bin/bash
# start_frontend.sh - 启动前端测试页面静态服务
set -e
FRONTEND_DIR="frontend"
PORT=${FRONTEND_PORT:-3000}
echo "========================================"
echo "启动前端测试页面服务"
echo "========================================"
echo ""
# 检查前端目录
if [ ! -d "$FRONTEND_DIR" ]; then
echo "错误: 前端目录不存在: $FRONTEND_DIR"
exit 1
fi
# 检查index.html (React + T-Systems风格前端)
if [ ! -f "$FRONTEND_DIR/index.html" ]; then
echo "错误: 前端页面不存在: $FRONTEND_DIR/index.html"
exit 1
fi
echo "前端页面: index.html (React + T-Systems风格)"
echo "前端地址: http://localhost:$PORT"
echo ""
echo "确保API服务已启动:"
echo " ./start_api.sh"
echo ""
echo "正在启动前端服务..."
# 使用Python内置HTTP服务器
cd $FRONTEND_DIR
# 查找Python命令
if command -v python3 &> /dev/null; then
PYTHON_CMD=python3
elif command -v python &> /dev/null; then
PYTHON_CMD=python
else
echo "错误: 未找到Python"
exit 1
fi
$PYTHON_CMD -m http.server $PORT --bind 0.0.0.0