Spaces:
Running
Running
Wimmboo commited on
Commit ·
61a39ca
1
Parent(s): 139fc91
add root endpoint for HF Spaces routing
Browse files- proxy/router.py +4 -0
proxy/router.py
CHANGED
|
@@ -99,6 +99,10 @@ def create_app() -> FastAPI:
|
|
| 99 |
app = FastAPI(title="OpenAI-Compatible API Proxy", version="1.0.0")
|
| 100 |
app.include_router(api)
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
@app.exception_handler(StarletteHTTPException)
|
| 103 |
async def http_exception_handler(_request: Request, exc: StarletteHTTPException) -> JSONResponse:
|
| 104 |
return JSONResponse(status_code=exc.status_code, content={"error": {"message": exc.detail, "type": "proxy_error"}})
|
|
|
|
| 99 |
app = FastAPI(title="OpenAI-Compatible API Proxy", version="1.0.0")
|
| 100 |
app.include_router(api)
|
| 101 |
|
| 102 |
+
@app.get("/")
|
| 103 |
+
async def root():
|
| 104 |
+
return {"message": "OpenAI API Proxy", "docs": "/v1/health"}
|
| 105 |
+
|
| 106 |
@app.exception_handler(StarletteHTTPException)
|
| 107 |
async def http_exception_handler(_request: Request, exc: StarletteHTTPException) -> JSONResponse:
|
| 108 |
return JSONResponse(status_code=exc.status_code, content={"error": {"message": exc.detail, "type": "proxy_error"}})
|