Show app version in admin UI and /version endpoint
Embed APP_VERSION build arg in Docker image (default: dev). build_push.sh passes the git tag as build arg. Proxy exposes GET /version, admin UI shows it as read-only field in settings.
This commit is contained in:
+4
-1
@@ -131,7 +131,10 @@ async def get_proxy_info(_ = Depends(require_admin_auth)):
|
||||
host = os.getenv("PROXY_HOST", "0.0.0.0")
|
||||
port = os.getenv("PROXY_PORT", "8000")
|
||||
display_host = "localhost" if host in ("0.0.0.0", "::") else host
|
||||
return {"endpoint": f"http://{display_host}:{port}"}
|
||||
return {
|
||||
"endpoint": f"http://{display_host}:{port}",
|
||||
"version": os.getenv("APP_VERSION", "dev"),
|
||||
}
|
||||
|
||||
@app.get("/api/settings", response_model=schemas.Settings)
|
||||
async def read_settings(db: Session = Depends(get_db), _ = Depends(require_admin_auth)):
|
||||
|
||||
@@ -149,6 +149,10 @@ async def list_models(db: Session = Depends(get_db)):
|
||||
response = await proxy_request(f"{ollama_url}/api/tags", method="GET")
|
||||
return JSONResponse(content=response.json(), status_code=response.status_code)
|
||||
|
||||
@app.get("/version")
|
||||
async def version():
|
||||
return {"version": os.getenv("APP_VERSION", "dev")}
|
||||
|
||||
@app.get("/api/ps")
|
||||
async def running_models(db: Session = Depends(get_db)):
|
||||
ollama_url = crud.get_setting(db, "ollama_url", os.getenv("OLLAMA_URL", "http://localhost:11434"))
|
||||
|
||||
Reference in New Issue
Block a user