#!/bin/bash # AI 客服系统启动脚本 echo "🤖 启动 AI 客服系统..." # 检查 Python echo "📋 检查环境..." python3 --version || { echo "❌ 需要 Python 3.9+"; exit 1; } # 安装依赖 echo "📦 安装依赖..." pip install -q -r requirements.txt if [ $? -ne 0 ]; then echo "❌ 依赖安装失败" exit 1 fi echo "✅ 依赖已安装" # 检查 API Key if grep -q "your-deepseek-api-key-here\|your-openai-key" app/config.py; then echo "" echo "⚠️ 警告: 请在 app/config.py 中配置 API Key" echo " 或者设置环境变量:" echo " export DEEPSEEK_API_KEY=your-key" echo " export OPENAI_API_KEY=your-key" echo "" read -p "是否继续启动? (y/n) " -n 1 -r echo if [[ ! $REPLY =~ ^[Yy]$ ]]; then exit 1 fi fi # 初始化知识库 echo "" echo "📚 初始化知识库..." cd app python3 -c "from knowledge import init_knowledge_base; init_knowledge_base()" cd .. # 启动服务 echo "" echo "🚀 启动服务..." echo " 访问: http://localhost:8890" echo "" python3 app/main.py