ChilleD commited on
Commit
0a9af47
·
verified ·
1 Parent(s): cba593c

Upload folder using huggingface_hub

Browse files
Files changed (1) hide show
  1. server/app.py +20 -3
server/app.py CHANGED
@@ -100,7 +100,13 @@ def _swap_in_custom_gradio_ui() -> None:
100
  # Playground keep functioning silently against a broken kwargs path,
101
  # which is the exact symptom Daisy hit. 404'ing them forces clients
102
  # to reload and pick up the new UI.
 
 
 
 
 
103
  _OPENENV_DEFAULT_UI_PATHS = {
 
104
  "/web/reset",
105
  "/web/step",
106
  "/web/state",
@@ -175,17 +181,28 @@ async def stats():
175
  from fastapi.responses import RedirectResponse # noqa: E402
176
 
177
 
178
- def _has_root_route() -> bool:
179
- return any(getattr(r, "path", None) == "/" for r in app.routes)
180
 
181
 
182
- if not _has_root_route():
183
 
184
  @app.get("/", include_in_schema=False)
185
  async def _root_redirect():
186
  return RedirectResponse(url="/web/")
187
 
188
 
 
 
 
 
 
 
 
 
 
 
 
189
  def main():
190
  import uvicorn
191
 
 
100
  # Playground keep functioning silently against a broken kwargs path,
101
  # which is the exact symptom Daisy hit. 404'ing them forces clients
102
  # to reload and pick up the new UI.
103
+ # Note: ``/web`` (no trailing slash) is the LEGACY vanilla HTML
104
+ # "HumanAgent Interface" page in openenv-core 0.2.1, not just a
105
+ # redirect. We must drop it too — otherwise HF Spaces' iframe (which
106
+ # hits ``/web`` without the slash) renders the broken legacy UI
107
+ # instead of our Gradio mount at ``/web/``.
108
  _OPENENV_DEFAULT_UI_PATHS = {
109
+ "/web",
110
  "/web/reset",
111
  "/web/step",
112
  "/web/state",
 
181
  from fastapi.responses import RedirectResponse # noqa: E402
182
 
183
 
184
+ def _has_route(path: str) -> bool:
185
+ return any(getattr(r, "path", None) == path for r in app.routes)
186
 
187
 
188
+ if not _has_route("/"):
189
 
190
  @app.get("/", include_in_schema=False)
191
  async def _root_redirect():
192
  return RedirectResponse(url="/web/")
193
 
194
 
195
+ # ``/web`` (no trailing slash) MUST redirect to ``/web/``. The Mount handles
196
+ # ``/web/...`` but a request to ``/web`` itself would otherwise 404 (the
197
+ # legacy ``/web`` HTMLResponse route from openenv-core 0.2.1 has been removed
198
+ # in the swap-in above). HF Spaces' iframe defaults to the no-slash URL.
199
+ if not _has_route("/web"):
200
+
201
+ @app.get("/web", include_in_schema=False)
202
+ async def _web_redirect():
203
+ return RedirectResponse(url="/web/")
204
+
205
+
206
  def main():
207
  import uvicorn
208