Fix xterm package versions and make models endpoint resilient

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
tocmo0nlord
2026-04-12 16:02:32 -04:00
parent 90a6ee6fbf
commit d68a557de8
3 changed files with 3333 additions and 6 deletions

View File

@@ -399,9 +399,10 @@ async def list_models():
async with httpx.AsyncClient(timeout=10) as client:
resp = await client.get(f"{OLLAMA_URL}/api/tags")
resp.raise_for_status()
return {"models": resp.json().get("models", [])}
return {"models": resp.json().get("models", []), "error": None}
except Exception as exc:
raise HTTPException(status_code=500, detail=str(exc))
# Return empty list instead of crashing — Ollama may not be reachable yet
return {"models": [], "error": str(exc)}
@app.websocket("/api/models/pull")
@@ -447,4 +448,4 @@ async def delete_model(model_name: str):
if __name__ == "__main__":
import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8080, reload=True)
uvicorn.run("main:app", host="0.0.0.0", port=8080, reload=True)