#!/bin/bash # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ # DE Knowledge Assistant — One-command Local Setup # Usage: chmod +x setup.sh && ./setup.sh # ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ set -e echo "" echo "🗄️ Data Engineering Knowledge Assistant Setup" echo "━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━" echo "" # ── 1. Python check ─────────────────────────────────────── PYTHON=$(python3 --version 2>&1 | awk '{print $2}') echo "✓ Python $PYTHON found" # ── 2. Virtual environment ──────────────────────────────── if [ ! -d ".venv" ]; then echo "→ Creating virtual environment…" python3 -m venv .venv fi source .venv/bin/activate echo "✓ Virtual environment activated" # ── 3. Install dependencies ─────────────────────────────── echo "→ Installing dependencies (this takes ~2 min on first run)…" pip install -q --upgrade pip pip install -q -r requirements.txt echo "✓ Dependencies installed" # ── 4. Environment variables ────────────────────────────── if [ ! -f ".env" ]; then cp .env.example .env echo "" echo "⚠️ ACTION REQUIRED:" echo " Edit .env and add your free Groq API key." echo " Get one at: https://console.groq.com (takes 30 seconds)" echo "" if command -v open &>/dev/null; then open https://console.groq.com; fi read -p " Press Enter after you've added your GROQ_API_KEY to .env…" -r fi echo "✓ Environment configured" # ── 5. Start server ─────────────────────────────────────── echo "" echo "🚀 Starting DE Knowledge Assistant…" echo " First run will download the embedding model (~90 MB) and index the PDF." echo " This takes about 60 seconds. Subsequent starts are instant." echo "" echo " Open http://localhost:8000 in your browser" echo " On iPhone: open Safari → http://your-local-ip:8000 → Share → Add to Home Screen" echo "" export $(grep -v '^#' .env | xargs) export PORT=8000 python app.py