File size: 3,382 Bytes
e22dcc4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e86a49a
e22dcc4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e86a49a
 
e22dcc4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# PowerShell setup script for PDF Q&A Chatbot System

Write-Host "πŸš€ Setting up PDF Q&A Chatbot System..." -ForegroundColor Green

# Check if Python is installed
try {
    $pythonVersion = python --version 2>&1
    Write-Host "βœ… Python found: $pythonVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ Python is required but not installed. Please install Python 3.8+ and try again." -ForegroundColor Red
    exit 1
}

# Check if Node.js is installed
try {
    $nodeVersion = node --version 2>&1
    Write-Host "βœ… Node.js found: $nodeVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ Node.js is required but not installed. Please install Node.js 18+ and try again." -ForegroundColor Red
    exit 1
}

# Check if npm is installed
try {
    $npmVersion = npm --version 2>&1
    Write-Host "βœ… npm found: $npmVersion" -ForegroundColor Green
} catch {
    Write-Host "❌ npm is required but not installed. Please install npm and try again." -ForegroundColor Red
    exit 1
}

Write-Host "βœ… Prerequisites check passed" -ForegroundColor Green

# Backend setup
Write-Host "πŸ“¦ Setting up backend..." -ForegroundColor Yellow
Set-Location backend

# Create virtual environment
Write-Host "Creating Python virtual environment..." -ForegroundColor Yellow
python -m venv venv

# Activate virtual environment
Write-Host "Activating virtual environment..." -ForegroundColor Yellow
.\venv\Scripts\Activate.ps1

# Install dependencies
Write-Host "Installing Python dependencies..." -ForegroundColor Yellow
pip install -r requirements.txt

# Create .env file if it doesn't exist
if (-not (Test-Path .env)) {
    Write-Host "Creating .env file..." -ForegroundColor Yellow
    Copy-Item .env.example .env
    Write-Host "⚠️  Please edit backend/.env and add your API keys (OpenAI or Anthropic)" -ForegroundColor Yellow
}

Set-Location ..

# Frontend setup
Write-Host "πŸ“¦ Setting up frontend..." -ForegroundColor Yellow
Set-Location frontend

# Install dependencies
Write-Host "Installing Node.js dependencies..." -ForegroundColor Yellow
npm install

# Create .env file if it doesn't exist
if (-not (Test-Path .env)) {
    Write-Host "Creating .env file..." -ForegroundColor Yellow
    Copy-Item .env.example .env
}

Set-Location ..

Write-Host ""
Write-Host "πŸŽ‰ Setup completed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "πŸ“‹ Next steps:" -ForegroundColor Cyan
Write-Host "1. Edit backend/.env and add your API keys:" -ForegroundColor White
Write-Host "   - OPENAI_API_KEY or ANTHROPIC_API_KEY" -ForegroundColor White
Write-Host ""
Write-Host "2. Start the backend server:" -ForegroundColor White
Write-Host "   cd backend" -ForegroundColor White
Write-Host "   .\venv\Scripts\Activate.ps1" -ForegroundColor White
Write-Host "   uvicorn main:app --reload" -ForegroundColor White
Write-Host ""
Write-Host "3. Start the frontend server (in a new terminal):" -ForegroundColor White
Write-Host "   cd frontend" -ForegroundColor White
Write-Host "   npm run dev" -ForegroundColor White
Write-Host ""
Write-Host "4. Open your browser and go to: http://localhost:3000" -ForegroundColor White
Write-Host ""
Write-Host "🐳 Alternatively, you can use Docker:" -ForegroundColor White
Write-Host "   docker-compose up --build" -ForegroundColor White
Write-Host ""
Write-Host "πŸ“š For more information, see the README.md file" -ForegroundColor White