Add files via upload

fixing tpyes, outputs and flatten responses in helper func
This commit is contained in:
Alpha Nerd 2025-08-31 15:33:33 +02:00 committed by GitHub
parent 65ad74a452
commit 966d119fec
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -118,11 +118,12 @@ async def fetch_endpoint_details(endpoint: str, route: str, detail: str) -> List
resp = await client.get(f"{endpoint}{route}") resp = await client.get(f"{endpoint}{route}")
resp.raise_for_status() resp.raise_for_status()
data = resp.json() data = resp.json()
detail = data.get(detail) detail = data.get(detail, [])
return detail return detail
except Exception: except Exception as e:
# If anything goes wrong we cannot reply versions # If anything goes wrong we cannot reply details
return {detail: "N/A"} print(e)
return {detail: []}
def ep2base(ep): def ep2base(ep):
if "/v1" in ep: if "/v1" in ep:
@ -794,7 +795,7 @@ async def ps_proxy(request: Request):
for modellist in loaded_models: for modellist in loaded_models:
models['models'] += modellist models['models'] += modellist
# 25. Return a JSONResponse with deduplicated currently deployed models # 2. Return a JSONResponse with deduplicated currently deployed models
return JSONResponse( return JSONResponse(
content={"models": dedupe_on_keys(models['models'], ['digest'])}, content={"models": dedupe_on_keys(models['models'], ['digest'])},
status_code=200, status_code=200,