Download app/products/web/webui/pages.py from LifeVta/Grok3API: direct link, hf CLI and curl.
- Browser
- Download file 1.29 kB
-
https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/products/web/webui/pages.py
- Command line
-
hf download hf://spaces/LifeVta/Grok3API/app/products/web/webui/pages.py
-
curl -L -o pages.py https://huggingface.co/spaces/LifeVta/Grok3API/resolve/main/app/products/web/webui/pages.py
1.29 kB
| """Static page routes for the statics-based WebUI.""" | |
| from pathlib import Path | |
| from fastapi import APIRouter, HTTPException | |
| from fastapi.responses import FileResponse | |
| from app.platform.auth.middleware import is_webui_enabled | |
| from ..static_html import serve_static_html | |
| router = APIRouter(include_in_schema=False) | |
| STATIC_DIR = Path(__file__).resolve().parents[3] / "statics" / "webui" | |
| def _serve(filename: str) -> FileResponse: | |
| path = STATIC_DIR / filename | |
| if not path.exists(): | |
| raise HTTPException(status_code=404, detail="Page not found") | |
| return FileResponse(path) | |
| def _serve_html(filename: str): | |
| return serve_static_html(STATIC_DIR / filename) | |
| async def webui_chat_page(): | |
| if not is_webui_enabled(): | |
| raise HTTPException(status_code=404, detail="Not Found") | |
| return _serve_html("chat.html") | |
| async def webui_chatkit_page(): | |
| if not is_webui_enabled(): | |
| raise HTTPException(status_code=404, detail="Not Found") | |
| return _serve_html("chatkit.html") | |
| async def webui_masonry_page(): | |
| if not is_webui_enabled(): | |
| raise HTTPException(status_code=404, detail="Not Found") | |
| return _serve_html("masonry.html") | |
| __all__ = ["router"] | |