SIN-Deploy-Bot commited on
Commit
b24f511
·
1 Parent(s): b2195d6

feat: mount Gradio UI at /ui instead of root

Browse files

- Prevents routing conflicts with API endpoints
- Root '/' now returns service info JSON with endpoint links
- More robust separation of concerns (API vs UI)

Files changed (1) hide show
  1. main.py +19 -2
main.py CHANGED
@@ -289,9 +289,26 @@ async def oauth_client() -> JSONResponse:
289
  )
290
 
291
 
292
- # Build Gradio UI and mount as catch-all (after all API routes)
293
  gradio_app = build_gradio_ui()
294
- app.mount("/", gradio_app.app)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
295
 
296
 
297
  if __name__ == "__main__":
 
289
  )
290
 
291
 
292
+ # Build Gradio UI and mount under /ui
293
  gradio_app = build_gradio_ui()
294
+ app.mount("/ui", gradio_app.app)
295
+
296
+
297
+ # Root endpoint - simple redirect/info
298
+ @app.get("/")
299
+ async def root_info() -> JSONResponse:
300
+ return JSONResponse(
301
+ {
302
+ "service": "A2A Cloud Coder",
303
+ "status": "running",
304
+ "endpoints": {
305
+ "health": "/health",
306
+ "a2a_api": "/a2a/v1",
307
+ "agent_card": "/.well-known/agent-card.json",
308
+ "ui": "/ui",
309
+ },
310
+ }
311
+ )
312
 
313
 
314
  if __name__ == "__main__":