tower-learns-you / scripts /Test-LlamaServer.ps1
vknt's picture
Deploy The Tower Learns You (custom gr.Server frontend, hf_inference + mock fallback)
22a027e verified
Raw
History Blame Contribute Delete
650 Bytes
[CmdletBinding()]
param(
[int]$Port = 8080,
[string]$KeyPath = ""
)
$ErrorActionPreference = "Stop"
if (-not $KeyPath) {
$KeyPath = Join-Path $PSScriptRoot "..\.local\llama.cpp\api-key.txt"
}
if (-not (Test-Path $KeyPath)) {
throw "Local API key is missing at $KeyPath"
}
$key = (Get-Content $KeyPath -Raw).Trim()
$headers = @{ Authorization = "Bearer $key" }
$health = Invoke-RestMethod -Uri "http://127.0.0.1:$Port/health" -Headers $headers -TimeoutSec 5
if ($health.status -notin @("ok", "no slot available")) {
throw "Unexpected llama.cpp health response: $($health | ConvertTo-Json -Compress)"
}
$health