| param( |
| [switch]$Infra, |
| [switch]$Backend, |
| [switch]$Frontend, |
| [switch]$All |
| ) |
|
|
| $ErrorActionPreference = "Stop" |
| $Root = Resolve-Path (Join-Path $PSScriptRoot "..") |
| Set-Location $Root |
|
|
| if (-not $Infra -and -not $Backend -and -not $Frontend -and -not $All) { |
| $All = $true |
| } |
|
|
| function Start-Infra { |
| Write-Host "Starting Qdrant and Neo4j with Docker Compose..." |
| docker compose up -d qdrant neo4j |
| } |
|
|
| function Start-Backend { |
| Write-Host "Starting FastAPI backend at http://localhost:8000 ..." |
| if (Test-Path ".\env\Scripts\Activate.ps1") { |
| . ".\env\Scripts\Activate.ps1" |
| } |
| uvicorn backend.main:app --reload |
| } |
|
|
| function Start-Frontend { |
| Write-Host "Starting Streamlit frontend at http://localhost:8501 ..." |
| if (Test-Path ".\env\Scripts\Activate.ps1") { |
| . ".\env\Scripts\Activate.ps1" |
| } |
| streamlit run frontend/app.py |
| } |
|
|
| if ($All -or $Infra) { |
| Start-Infra |
| } |
|
|
| if ($Backend -and $Frontend) { |
| Write-Host "Open two terminals for backend and frontend, or run this script with one flag at a time." |
| exit 1 |
| } |
|
|
| if ($All -or $Backend) { |
| Start-Backend |
| } |
|
|
| if ($Frontend) { |
| Start-Frontend |
| } |
|
|