File size: 1,160 Bytes
ee9a09c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
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
}