dev-0.9.x-ref -> main #113

Merged
alpha-nerd merged 19 commits from dev-0.9.x-ref into main 2026-06-10 15:48:31 +02:00
Showing only changes of commit 13d796817f - Show all commits

View file

@ -192,12 +192,19 @@ class fetch:
For llama-server endpoints: queries /v1/models and filters for status.value == "loaded"
"""
client: aiohttp.ClientSession = get_session(endpoint)
cfg = get_config()
# Check if this is a llama-server endpoint
if endpoint in get_config().llama_server_endpoints:
# Query /v1/models for llama-server
if endpoint in cfg.llama_server_endpoints:
# Query /v1/models for llama-server. Send the configured key as a
# Bearer token — current llama.cpp leaves /models public, but a
# build/config that protects it would otherwise 401 this probe.
headers = {"Referer": default_headers.get("HTTP-Referer", "https://nomyo.ai")}
api_key = cfg.api_keys.get(endpoint)
if api_key is not None:
headers["Authorization"] = "Bearer " + api_key
try:
async with client.get(f"{endpoint}/models") as resp:
async with client.get(f"{endpoint}/models", headers=headers) as resp:
await _ensure_success(resp)
data = await resp.json()