#!/bin/bash # AI Review Backend Start Script echo "🚀 Starting AI Review Backend..." # Check if venv exists if [ ! -d "venv" ]; then echo "📦 Creating virtual environment..." python3 -m venv venv fi # Activate venv echo "🔧 Activating virtual environment..." source venv/bin/activate # Install dependencies echo "📥 Installing dependencies..." pip install -q -r requirements.txt # Check .env if [ ! -f ".env" ]; then echo "⚠️ .env file not found!" echo "Creating .env from .env.example..." cp .env.example .env echo "" echo "⚠️ IMPORTANT: Edit .env and set SECRET_KEY and ENCRYPTION_KEY!" echo "" read -p "Press Enter to continue..." fi # Check Ollama echo "🤖 Checking Ollama..." if ! command -v ollama &> /dev/null; then echo "❌ Ollama not found! Please install from https://ollama.ai/" exit 1 fi if ! ollama list | grep -q "codellama"; then echo "📥 Pulling codellama model..." ollama pull codellama fi # Start server echo "✅ Starting server on http://localhost:8000" echo "📚 API docs: http://localhost:8000/docs" echo "" uvicorn app.main:app --reload --host 0.0.0.0 --port 8000