start_service.sh 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. #!/bin/bash
  2. # Agent 服务启动脚本
  3. echo "🚀 启动 Agent 服务..."
  4. # 检查Python环境
  5. if ! command -v python3 &> /dev/null; then
  6. echo "❌ 错误: 未找到 python3 命令"
  7. exit 1
  8. fi
  9. # 检查依赖
  10. echo "📦 检查依赖..."
  11. python3 -c "import fastapi, uvicorn" 2>/dev/null
  12. if [ $? -ne 0 ]; then
  13. echo "❌ 错误: 缺少必要的依赖包"
  14. echo "请运行: pip install -r requirements.txt"
  15. exit 1
  16. fi
  17. # 检查 LangGraph
  18. echo "🔍 检查 LangGraph..."
  19. python3 -c "import langgraph" 2>/dev/null
  20. if [ $? -ne 0 ]; then
  21. echo "⚠️ 警告: LangGraph 未安装,将使用传统模式"
  22. echo "如需启用 LangGraph,请运行: pip install langgraph"
  23. echo ""
  24. fi
  25. # 启动服务
  26. echo "🌟 启动服务..."
  27. echo "📍 服务地址: http://localhost:8080"
  28. echo "📚 API文档: http://localhost:8080/docs"
  29. echo "🔍 健康检查: http://localhost:8080/health"
  30. echo "🔄 LangGraph 状态: 将在健康检查中显示"
  31. echo ""
  32. echo "按 Ctrl+C 停止服务"
  33. echo ""
  34. # 启动服务
  35. python3 agent.py