File size: 2,623 Bytes
9bcadf3
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/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