File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change 1919load_dotenv ()
2020
2121# Initialize the FastAPI application with lifespan
22- app = FastAPI (lifespan = lifespan )
22+ app = FastAPI (lifespan = lifespan , docs_url = None , redoc_url = None )
2323app .state .limiter = limiter
2424
2525# Register the custom exception handler for rate limits
@@ -98,6 +98,12 @@ async def llm_txt() -> FileResponse:
9898 return FileResponse ("static/llm.txt" )
9999
100100
101+ @app .get ("/docs" , response_class = HTMLResponse )
102+ async def custom_swagger_ui (request : Request ) -> HTMLResponse :
103+ """Render the Swagger UI documentation page inside the Jinja theme."""
104+ return templates .TemplateResponse ("swagger_ui.jinja" , {"request" : request })
105+
106+
101107# Include routers for modular endpoints
102108app .include_router (index )
103109app .include_router (ingest )
Original file line number Diff line number Diff line change 1+ {% extends "base.jinja" %}
2+ {% block title %} API Docs{% endblock %}
3+ {% block content %}
4+ <div class =" bg-[#fff4da] rounded-xl border-[3px] border-gray-900 p-4 md:p-8 relative z-20" >
5+ <h1 class =" text-3xl font-bold text-gray-900 mb-4" >API Documentation</h1 >
6+ <div id =" swagger-ui" ></div >
7+ </div >
8+ <link rel =" stylesheet"
9+ href =" https://unpkg.com/swagger-ui-dist@5/swagger-ui.css" >
10+ <script src =" https://unpkg.com/swagger-ui-dist@5/swagger-ui-bundle.js" ></script >
11+ <script >
12+ window .onload = function () {
13+ SwaggerUIBundle ({
14+ url: " /openapi.json" ,
15+ dom_id: ' #swagger-ui' ,
16+ presets: [
17+ SwaggerUIBundle .presets .apis ,
18+ SwaggerUIBundle .SwaggerUIStandalonePreset
19+ ],
20+ layout: " BaseLayout" ,
21+ deepLinking: true ,
22+ });
23+ }
24+ </script >
25+ {% endblock %}
You can’t perform that action at this time.
0 commit comments