SupportRAG / scripts /setup.ps1
Sakshamyadav15's picture
Revision
e7dfc31
# SupportRAG Setup Script for Windows
# Run this script to set up the project automatically
Write-Host "╔════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "β•‘ SupportRAG - Automated Setup Script β•‘" -ForegroundColor Cyan
Write-Host "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•" -ForegroundColor Cyan
Write-Host ""
# Check Python version
Write-Host "[1/7] Checking Python version..." -ForegroundColor Yellow
$pythonVersion = python --version 2>&1
if ($pythonVersion -match "Python 3\.(9|1[0-9])") {
Write-Host "βœ“ Python version OK: $pythonVersion" -ForegroundColor Green
} else {
Write-Host "βœ— Python 3.9+ required. Found: $pythonVersion" -ForegroundColor Red
exit 1
}
# Create virtual environment
Write-Host "`n[2/7] Creating virtual environment..." -ForegroundColor Yellow
if (Test-Path "venv") {
Write-Host "Virtual environment already exists" -ForegroundColor Gray
} else {
python -m venv venv
Write-Host "βœ“ Virtual environment created" -ForegroundColor Green
}
# Activate virtual environment
Write-Host "`n[3/7] Activating virtual environment..." -ForegroundColor Yellow
& .\venv\Scripts\Activate.ps1
Write-Host "βœ“ Virtual environment activated" -ForegroundColor Green
# Install dependencies
Write-Host "`n[4/7] Installing dependencies..." -ForegroundColor Yellow
Write-Host "This may take a few minutes..." -ForegroundColor Gray
pip install -r requirements.txt --quiet
if ($LASTEXITCODE -eq 0) {
Write-Host "βœ“ Dependencies installed successfully" -ForegroundColor Green
} else {
Write-Host "βœ— Failed to install dependencies" -ForegroundColor Red
exit 1
}
# Setup environment file
Write-Host "`n[5/7] Setting up environment configuration..." -ForegroundColor Yellow
if (Test-Path ".env") {
Write-Host ".env file already exists" -ForegroundColor Gray
} else {
Copy-Item .env.example .env
Write-Host "βœ“ Created .env file from template" -ForegroundColor Green
Write-Host "⚠ IMPORTANT: Edit .env and add your API key!" -ForegroundColor Yellow
}
# Create necessary directories
Write-Host "`n[6/7] Creating directories..." -ForegroundColor Yellow
New-Item -ItemType Directory -Force -Path "logs" | Out-Null
New-Item -ItemType Directory -Force -Path "data/vector_store" | Out-Null
Write-Host "βœ“ Directories created" -ForegroundColor Green
# Initialize vector database
Write-Host "`n[7/7] Initializing vector database..." -ForegroundColor Yellow
Write-Host "This will download the embedding model (~100MB)..." -ForegroundColor Gray
$env_check = python -c "from src.config import settings; exit(0 if settings.gemini_api_key or settings.openai_api_key else 1)"
if ($LASTEXITCODE -eq 0) {
python scripts/init_vectordb.py
if ($LASTEXITCODE -eq 0) {
Write-Host "βœ“ Vector database initialized" -ForegroundColor Green
} else {
Write-Host "βœ— Failed to initialize vector database" -ForegroundColor Red
Write-Host "You can run 'python scripts/init_vectordb.py' manually later" -ForegroundColor Yellow
}
} else {
Write-Host "⚠ Skipping database initialization (API key not configured)" -ForegroundColor Yellow
Write-Host "Please add your API key to .env and run:" -ForegroundColor Yellow
Write-Host " python scripts/init_vectordb.py" -ForegroundColor Cyan
}
# Summary
Write-Host "`n╔════════════════════════════════════════════════════════════╗" -ForegroundColor Cyan
Write-Host "β•‘ Setup Complete! β•‘" -ForegroundColor Cyan
Write-Host "β•šβ•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•β•" -ForegroundColor Cyan
Write-Host "`nNext Steps:" -ForegroundColor Green
Write-Host "1. Edit .env file and add your API key:" -ForegroundColor White
Write-Host " notepad .env" -ForegroundColor Cyan
Write-Host ""
Write-Host "2. Initialize the vector database (if not done):" -ForegroundColor White
Write-Host " python scripts\init_vectordb.py" -ForegroundColor Cyan
Write-Host ""
Write-Host "3. Start the API server (Terminal 1):" -ForegroundColor White
Write-Host " uvicorn src.api.main:app --reload" -ForegroundColor Cyan
Write-Host ""
Write-Host "4. Start the frontend (Terminal 2):" -ForegroundColor White
Write-Host " streamlit run frontend\app.py" -ForegroundColor Cyan
Write-Host ""
Write-Host "5. Open your browser:" -ForegroundColor White
Write-Host " http://localhost:8501" -ForegroundColor Cyan
Write-Host ""
Write-Host "For more help, see: docs\QUICKSTART.md" -ForegroundColor Gray
Write-Host ""