40 lines
1.3 KiB
PowerShell
40 lines
1.3 KiB
PowerShell
param(
|
|
[string]$HostAddress = "127.0.0.1",
|
|
[int]$Port = 8010,
|
|
[string]$VehicleApiUrl = "http://127.0.0.1:8000",
|
|
[ValidateSet("auto", "local", "openai")]
|
|
[string]$VehicleProvider = "auto",
|
|
[ValidateSet("dry_run", "hardware")]
|
|
[string]$ExecutionMode = "dry_run",
|
|
[string]$NativeCanUrl = "http://127.0.0.1:8765",
|
|
[ValidateSet("tcp", "mqtt", "simulation")]
|
|
[string]$InfraredTransport = "tcp"
|
|
)
|
|
|
|
$localEnvPath = Join-Path (Resolve-Path (Join-Path $PSScriptRoot "..\..")) ".env"
|
|
if (Test-Path -LiteralPath $localEnvPath) {
|
|
foreach ($line in Get-Content -LiteralPath $localEnvPath) {
|
|
$trimmed = $line.Trim()
|
|
if (-not $trimmed -or $trimmed.StartsWith("#") -or -not $trimmed.Contains("=")) {
|
|
continue
|
|
}
|
|
$name, $value = $trimmed.Split("=", 2)
|
|
if ($name -in @("OPENAI_API_KEY", "OPENAI_BASE_URL", "IR_OPENAI_MODEL")) {
|
|
Set-Item -Path "Env:$name" -Value $value.Trim().Trim('"').Trim("'")
|
|
}
|
|
}
|
|
}
|
|
|
|
$env:COGNITIVE_AGENT_API_URL = $VehicleApiUrl
|
|
$env:COGNITIVE_AGENT_PROVIDER = $VehicleProvider
|
|
$env:COGNITIVE_AGENT_EXECUTION_MODE = $ExecutionMode
|
|
$env:COGNITIVE_AGENT_NATIVE_CAN_URL = $NativeCanUrl
|
|
$env:GSCU_TRANSPORT = $InfraredTransport
|
|
|
|
Push-Location $PSScriptRoot
|
|
try {
|
|
python server.py --host $HostAddress --port $Port
|
|
} finally {
|
|
Pop-Location
|
|
}
|