r1cksync commited on
Commit
caad989
·
1 Parent(s): 43e6a55

server: serve showcase HTML at / so HF Space embed mirrors *.hf.space/showcase (move root JSON to /info)

Browse files
Files changed (1) hide show
  1. rl-agent/server.py +14 -3
rl-agent/server.py CHANGED
@@ -210,8 +210,19 @@ def observability_status() -> dict:
210
  return {"error": str(e), "services": {}}
211
 
212
 
213
- @app.get("/")
214
- def root() -> dict:
 
 
 
 
 
 
 
 
 
 
 
215
  return {
216
  "name": "incident-commander",
217
  "version": "2.0.0",
@@ -232,7 +243,7 @@ def root() -> dict:
232
  "endpoints": [
233
  "/reset", "/step", "/state", "/health", "/tasks", "/grader", "/baseline",
234
  "/dashboard", "/curriculum", "/curriculum/reset", "/adversarial/design",
235
- "/judge/config", "/docs",
236
  ],
237
  }
238
 
 
210
  return {"error": str(e), "services": {}}
211
 
212
 
213
+ @app.get("/", response_class=HTMLResponse)
214
+ def root():
215
+ """Root serves the showcase page so the HF Space embed and the
216
+ direct `*.hf.space/showcase` URL render the same UI. Machine-readable
217
+ metadata previously served here lives at /info."""
218
+ html_path = Path(__file__).resolve().parent / "showcase.html"
219
+ if html_path.exists():
220
+ return HTMLResponse(content=html_path.read_text(encoding="utf-8"), status_code=200)
221
+ return HTMLResponse(content="<h1>Showcase not found — rebuild Docker image.</h1>", status_code=404)
222
+
223
+
224
+ @app.get("/info")
225
+ def root_info() -> dict:
226
  return {
227
  "name": "incident-commander",
228
  "version": "2.0.0",
 
243
  "endpoints": [
244
  "/reset", "/step", "/state", "/health", "/tasks", "/grader", "/baseline",
245
  "/dashboard", "/curriculum", "/curriculum/reset", "/adversarial/design",
246
+ "/judge/config", "/showcase", "/docs",
247
  ],
248
  }
249