Fix settings layout and frontend startup checks

This commit is contained in:
linkong
2026-03-25 10:42:10 +08:00
parent ef0fefdfc7
commit cc5f16f8a7
3 changed files with 273 additions and 118 deletions

View File

@@ -11,6 +11,27 @@ YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m'
ensure_frontend_deps() {
echo -e "${BLUE}📦 检查前端依赖...${NC}"
if ! command -v bun >/dev/null 2>&1; then
echo -e "${RED}❌ 未找到 bun请先安装或加载 bun 到 PATH${NC}"
exit 1
fi
cd "$SCRIPT_DIR/frontend"
if [ ! -x "$SCRIPT_DIR/frontend/node_modules/.bin/vite" ]; then
echo -e "${YELLOW}⚠️ 前端依赖缺失,正在执行 bun install...${NC}"
bun install
fi
if [ ! -x "$SCRIPT_DIR/frontend/node_modules/.bin/vite" ]; then
echo -e "${RED}❌ 前端依赖安装失败,未找到 vite${NC}"
exit 1
fi
}
start() {
echo -e "${BLUE}🚀 启动智能星球计划...${NC}"
@@ -25,21 +46,16 @@ start() {
PYTHONPATH="$SCRIPT_DIR/backend" nohup python3 -m uvicorn app.main:app --host 0.0.0.0 --port 8000 --reload > /tmp/planet_backend.log 2>&1 &
BACKEND_PID=$!
echo " 等待后端启动..."
for i in {1..10}; do
sleep 2
if curl -s http://localhost:8000/health > /dev/null 2>&1; then
echo -e " ${GREEN}✅ 后端已就绪${NC}"
break
fi
if [ $i -eq 10 ]; then
echo -e "${RED}❌ 后端启动失败${NC}"
tail -10 /tmp/planet_backend.log
exit 1
fi
done
sleep 3
if ! curl -s http://localhost:8000/health > /dev/null 2>&1; then
echo -e "${RED}❌ 后端启动失败${NC}"
tail -10 /tmp/planet_backend.log
exit 1
fi
echo -e "${BLUE}🌐 启动前端...${NC}"
ensure_frontend_deps
pkill -f "vite" 2>/dev/null || true
pkill -f "bun run dev" 2>/dev/null || true
cd "$SCRIPT_DIR/frontend"