pdf-qa-chatbot / setup.ps1
Amin23's picture
Initial commit
e86a49a
# 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