# MeetMe Bot Hybrid Setup - Quick Start Script # This script sets up the complete hybrid solution for Windows Write-Host "๐Ÿš€ MeetMe Bot Hybrid Setup - Quick Start" -ForegroundColor Green Write-Host "================================================" -ForegroundColor Green # Check prerequisites Write-Host "`n๐Ÿ“‹ Checking prerequisites..." -ForegroundColor Yellow # Check Node.js try { $nodeVersion = node --version 2>$null if ($LASTEXITCODE -eq 0) { Write-Host "โœ… Node.js found: $nodeVersion" -ForegroundColor Green } else { throw "Node.js not found" } } catch { Write-Host "โŒ Node.js not found. Please install Node.js 16+" -ForegroundColor Red Write-Host "Download from: https://nodejs.org/" -ForegroundColor Yellow exit 1 } # Check Python try { $pythonVersion = python --version 2>$null if ($LASTEXITCODE -eq 0) { Write-Host "โœ… Python found: $pythonVersion" -ForegroundColor Green } else { throw "Python not found" } } catch { Write-Host "โŒ Python not found. Please install Python 3.8+" -ForegroundColor Red Write-Host "Download from: https://python.org/" -ForegroundColor Yellow exit 1 } # Check MongoDB try { $mongoVersion = mongod --version 2>$null | Select-String "db version" if ($LASTEXITCODE -eq 0) { Write-Host "โœ… MongoDB found: $mongoVersion" -ForegroundColor Green } else { throw "MongoDB not found" } } catch { Write-Host "โŒ MongoDB not found. Please install MongoDB" -ForegroundColor Red Write-Host "Download from: https://mongodb.com/try/download/community" -ForegroundColor Yellow exit 1 } # Check Ollama try { $ollamaVersion = ollama --version 2>$null if ($LASTEXITCODE -eq 0) { Write-Host "โœ… Ollama found: $ollamaVersion" -ForegroundColor Green } else { throw "Ollama not found" } } catch { Write-Host "โŒ Ollama not found. Please install Ollama" -ForegroundColor Red Write-Host "Download from: https://ollama.ai/" -ForegroundColor Yellow exit 1 } Write-Host "`nโœ… All prerequisites met!" -ForegroundColor Green # Phase 1: Setup Node.js Backend Write-Host "`n๐Ÿ”ง Phase 1: Setting up Node.js Backend..." -ForegroundColor Yellow # Clone backend if not exists if (-not (Test-Path "meetme-backend-api")) { Write-Host "๐Ÿ“ฅ Cloning MeetMe backend repository..." -ForegroundColor Cyan try { git clone https://github.com/Andyss4545/meetme-backend-api.git if ($LASTEXITCODE -ne 0) { throw "Failed to clone repository" } } catch { Write-Host "โŒ Failed to clone repository. Please check your internet connection." -ForegroundColor Red exit 1 } cd meetme-backend-api } else { Write-Host "๐Ÿ“ Backend directory already exists" -ForegroundColor Cyan cd meetme-backend-api } # Install dependencies Write-Host "๐Ÿ“ฆ Installing Node.js dependencies..." -ForegroundColor Cyan try { npm install if ($LASTEXITCODE -ne 0) { throw "Failed to install dependencies" } } catch { Write-Host "โŒ Failed to install Node.js dependencies" -ForegroundColor Red exit 1 } # Create .env file for backend Write-Host "โš™๏ธ Creating backend environment file..." -ForegroundColor Cyan $backendEnv = @" # Server Configuration PORT=3000 NODE_ENV=development # MongoDB Configuration MONGODB_URI=mongodb://localhost:27017/meetme_dev # JWT Configuration JWT_SECRET=your_super_secret_jwt_key_here_$(Get-Random -Minimum 1000 -Maximum 9999) JWT_EXPIRES_IN=7d # API Configuration API_BASE_URL=http://localhost:3000/api/v1 CORS_ORIGIN=http://localhost:3000 # Bot Configuration BOT_RATE_LIMIT=100 BOT_TIMEOUT=30000 "@ $backendEnv | Out-File -FilePath ".env" -Encoding UTF8 Write-Host "โœ… Backend environment configured" -ForegroundColor Green # Start MongoDB if not running Write-Host "๐Ÿ—„๏ธ Starting MongoDB..." -ForegroundColor Cyan try { # Check if MongoDB is already running $mongoProcess = Get-Process -Name "mongod" -ErrorAction SilentlyContinue if (-not $mongoProcess) { # Create data directory if it doesn't exist $dataDir = "C:\data\db" if (-not (Test-Path $dataDir)) { New-Item -ItemType Directory -Path $dataDir -Force | Out-Null } Start-Process -FilePath "mongod" -ArgumentList "--dbpath", $dataDir -WindowStyle Hidden Start-Sleep -Seconds 3 # Give MongoDB time to start } else { Write-Host "MongoDB is already running" -ForegroundColor Green } } catch { Write-Host "โš ๏ธ Warning: Could not start MongoDB. Please start it manually." -ForegroundColor Yellow } # Start backend server Write-Host "๐Ÿš€ Starting Node.js backend server..." -ForegroundColor Cyan try { Start-Process -FilePath "npm" -ArgumentList "run", "dev" -WindowStyle Hidden Start-Sleep -Seconds 5 # Give server time to start } catch { Write-Host "โš ๏ธ Warning: Could not start backend server. Please start it manually with 'npm run dev'" -ForegroundColor Yellow } # Wait for backend to start Write-Host "โณ Waiting for backend to start..." -ForegroundColor Yellow $maxAttempts = 30 $attempt = 0 $backendReady = $false while ($attempt -lt $maxAttempts -and -not $backendReady) { try { $response = Invoke-WebRequest -Uri "http://localhost:3000/api/v1/health" -TimeoutSec 5 -ErrorAction SilentlyContinue if ($response.StatusCode -eq 200) { $backendReady = $true Write-Host "โœ… Backend server is ready!" -ForegroundColor Green } } catch { $attempt++ Write-Host "Waiting for backend... ($attempt/$maxAttempts)" -ForegroundColor Yellow Start-Sleep -Seconds 2 } } if (-not $backendReady) { Write-Host "โš ๏ธ Backend server may not be ready. Continuing anyway..." -ForegroundColor Yellow } # Phase 2: Setup Python Environment Write-Host "`n๐Ÿ Phase 2: Setting up Python Environment..." -ForegroundColor Yellow # Go back to project root cd .. # Create virtual environment Write-Host "๐Ÿ“ฆ Creating Python virtual environment..." -ForegroundColor Cyan try { python -m venv venv if ($LASTEXITCODE -ne 0) { throw "Failed to create virtual environment" } } catch { Write-Host "โŒ Failed to create virtual environment" -ForegroundColor Red exit 1 } # Activate virtual environment Write-Host "๐Ÿ”ง Activating virtual environment..." -ForegroundColor Cyan try { & ".\venv\Scripts\Activate.ps1" if ($LASTEXITCODE -ne 0) { throw "Failed to activate virtual environment" } } catch { Write-Host "โŒ Failed to activate virtual environment" -ForegroundColor Red exit 1 } # Install Python dependencies Write-Host "๐Ÿ“ฆ Installing Python dependencies..." -ForegroundColor Cyan try { pip install -r requirements.txt if ($LASTEXITCODE -ne 0) { throw "Failed to install Python dependencies" } } catch { Write-Host "โŒ Failed to install Python dependencies" -ForegroundColor Red exit 1 } # Phase 3: Setup Ollama Write-Host "`n๐Ÿค– Phase 3: Setting up Ollama..." -ForegroundColor Yellow # Check if Ollama is running try { $ollamaResponse = Invoke-WebRequest -Uri "http://localhost:11434/api/tags" -TimeoutSec 5 -ErrorAction SilentlyContinue if ($ollamaResponse.StatusCode -eq 200) { Write-Host "โœ… Ollama is running" -ForegroundColor Green } else { throw "Ollama not responding" } } catch { Write-Host "โš ๏ธ Ollama is not running. Please start it manually with 'ollama serve'" -ForegroundColor Yellow } # Pull the required model Write-Host "๐Ÿ“ฅ Pulling Ollama model..." -ForegroundColor Cyan try { ollama pull quen3 if ($LASTEXITCODE -ne 0) { Write-Host "โš ๏ธ Failed to pull model. You may need to pull it manually." -ForegroundColor Yellow } else { Write-Host "โœ… Model pulled successfully" -ForegroundColor Green } } catch { Write-Host "โš ๏ธ Could not pull model. Please pull it manually with 'ollama pull quen3'" -ForegroundColor Yellow } # Phase 4: Create test user Write-Host "`n๐Ÿ‘ค Phase 4: Creating test user..." -ForegroundColor Yellow # Create .env file for Python bots Write-Host "โš™๏ธ Creating Python bot environment file..." -ForegroundColor Cyan $pythonEnv = @" # Enhanced Environment Configuration USE_LOCAL_API=true API_BASE_URL=http://localhost:3000/api/v1 # LOCAL API CREDENTIALS API_USERNAME=testuser@example.com API_PASSWORD=testpassword123 # BOT PERSONALITY CONFIGURATION MY_NAME=DrJones MY_PROFILE="water-tech geek, coffee addict" # AI INTEGRATION (Ollama) OLLAMA_ENDPOINT=http://localhost:11434/v1/chat/completions OLLAMA_MODEL=quen3 # BOT BEHAVIOR SETTINGS POLL_INTERVAL=30 MESSAGE_DELAY=60 MAX_MESSAGES_PER_SESSION=20 # LOGGING CONFIGURATION LOG_LEVEL=INFO LOG_FILE=bot_activity.log # SECURITY SETTINGS RATE_LIMIT_ENABLED=true MAX_REQUESTS_PER_MINUTE=100 RETRY_ATTEMPTS=3 TIMEOUT_SECONDS=30 "@ $pythonEnv | Out-File -FilePath ".env" -Encoding UTF8 Write-Host "โœ… Python bot environment configured" -ForegroundColor Green # Phase 5: Testing Setup Write-Host "`n๐Ÿงช Phase 5: Testing Setup..." -ForegroundColor Yellow # Test backend connection Write-Host "๐Ÿ” Testing backend connection..." -ForegroundColor Cyan try { $healthResponse = Invoke-WebRequest -Uri "http://localhost:3000/api/v1/health" -TimeoutSec 10 if ($healthResponse.StatusCode -eq 200) { Write-Host "โœ… Backend connection successful" -ForegroundColor Green } else { Write-Host "โš ๏ธ Backend connection failed" -ForegroundColor Yellow } } catch { Write-Host "โš ๏ธ Backend connection failed: $($_.Exception.Message)" -ForegroundColor Yellow } # Test Ollama connection Write-Host "๐Ÿ” Testing Ollama connection..." -ForegroundColor Cyan try { $ollamaTest = Invoke-WebRequest -Uri "http://localhost:11434/api/tags" -TimeoutSec 10 if ($ollamaTest.StatusCode -eq 200) { Write-Host "โœ… Ollama connection successful" -ForegroundColor Green } else { Write-Host "โš ๏ธ Ollama connection failed" -ForegroundColor Yellow } } catch { Write-Host "โš ๏ธ Ollama connection failed: $($_.Exception.Message)" -ForegroundColor Yellow } # Test Python environment Write-Host "๐Ÿ” Testing Python environment..." -ForegroundColor Cyan try { python -c "import requests, schedule, dotenv; print('โœ… Python dependencies installed')" if ($LASTEXITCODE -eq 0) { Write-Host "โœ… Python environment ready" -ForegroundColor Green } else { Write-Host "โš ๏ธ Python environment issues" -ForegroundColor Yellow } } catch { Write-Host "โš ๏ธ Python environment test failed" -ForegroundColor Yellow } # Final instructions Write-Host "`n๐ŸŽ‰ Setup Complete!" -ForegroundColor Green Write-Host "================================================" -ForegroundColor Green Write-Host "`n๐Ÿ“‹ Next Steps:" -ForegroundColor Yellow Write-Host "1. Start the ice breaker bot: python enhanced_icebreaker_bot.py" -ForegroundColor White Write-Host "2. Start the responder bot: python enhanced_responder_bot.py" -ForegroundColor White Write-Host "3. Monitor logs for any issues" -ForegroundColor White Write-Host "4. Check the HYBRID_SETUP_GUIDE.md for detailed instructions" -ForegroundColor White Write-Host "`nโš ๏ธ Important Notes:" -ForegroundColor Yellow Write-Host "- Make sure MongoDB is running: mongod --dbpath C:\data\db" -ForegroundColor White Write-Host "- Make sure Ollama is running: ollama serve" -ForegroundColor White Write-Host "- Make sure the backend is running: cd meetme-backend-api && npm run dev" -ForegroundColor White Write-Host "`n๐Ÿš€ Ready to run your MeetMe bots!" -ForegroundColor Green