diff --git a/services/__pycache__/__init__.cpython-39.pyc b/services/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000..ca1d728
Binary files /dev/null and b/services/__pycache__/__init__.cpython-39.pyc differ
diff --git a/services/api/__pycache__/__init__.cpython-39.pyc b/services/api/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000..f5c479c
Binary files /dev/null and b/services/api/__pycache__/__init__.cpython-39.pyc differ
diff --git a/services/api/app/__pycache__/__init__.cpython-39.pyc b/services/api/app/__pycache__/__init__.cpython-39.pyc
new file mode 100644
index 0000000..a6c2563
Binary files /dev/null and b/services/api/app/__pycache__/__init__.cpython-39.pyc differ
diff --git a/services/api/app/__pycache__/main.cpython-39.pyc b/services/api/app/__pycache__/main.cpython-39.pyc
new file mode 100644
index 0000000..2145647
Binary files /dev/null and b/services/api/app/__pycache__/main.cpython-39.pyc differ
diff --git a/services/api/app/__pycache__/models.cpython-39.pyc b/services/api/app/__pycache__/models.cpython-39.pyc
new file mode 100644
index 0000000..bc557e2
Binary files /dev/null and b/services/api/app/__pycache__/models.cpython-39.pyc differ
diff --git a/services/api/app/__pycache__/validation.cpython-39.pyc b/services/api/app/__pycache__/validation.cpython-39.pyc
new file mode 100644
index 0000000..a96d41a
Binary files /dev/null and b/services/api/app/__pycache__/validation.cpython-39.pyc differ
diff --git a/services/api/app/main.py b/services/api/app/main.py
index 27c585d..5a61892 100644
--- a/services/api/app/main.py
+++ b/services/api/app/main.py
@@ -1,4 +1,6 @@
from fastapi import FastAPI
+from fastapi.openapi.docs import get_swagger_ui_html, get_redoc_html
+from fastapi.responses import HTMLResponse
from services.api.app.models import CheckTransactionRequest, CheckTransactionResponse
from services.intelligence.sentinel_risk.engine import (
@@ -11,7 +13,12 @@
POLICY_VERSION = "day13-v3"
-app = FastAPI(title="SentinelAI API", version="0.1.0")
+app = FastAPI(
+ title="SentinelAI API",
+ version="0.1.0",
+ docs_url=None, # Disable default docs to use custom ones with Speed Insights
+ redoc_url=None, # Disable default redoc to use custom ones with Speed Insights
+)
@app.get("/health", tags=["system"])
@@ -50,3 +57,56 @@ def check_transaction(request: CheckTransactionRequest) -> CheckTransactionRespo
decision=decision.value,
policy_version=POLICY_VERSION,
)
+
+
+@app.get("/docs", include_in_schema=False)
+async def custom_swagger_ui_html() -> HTMLResponse:
+ """
+ Custom Swagger UI with Vercel Speed Insights integration.
+ """
+ html = get_swagger_ui_html(
+ openapi_url=app.openapi_url or "/openapi.json",
+ title=f"{app.title} - Swagger UI",
+ swagger_js_url="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui-bundle.js",
+ swagger_css_url="https://cdn.jsdelivr.net/npm/swagger-ui-dist@5.9.0/swagger-ui.css",
+ swagger_favicon_url="https://fastapi.tiangolo.com/img/favicon.png",
+ # Inject Vercel Speed Insights script
+ swagger_ui_parameters={
+ "persistAuthorization": True,
+ },
+ )
+ # Inject Speed Insights script into the HTML
+ html_content = html.body.decode()
+ html_content = html_content.replace(
+ "",
+ """
+
+""",
+ )
+ return HTMLResponse(content=html_content)
+
+
+@app.get("/redoc", include_in_schema=False)
+async def custom_redoc_html() -> HTMLResponse:
+ """
+ Custom ReDoc with Vercel Speed Insights integration.
+ """
+ html = get_redoc_html(
+ openapi_url=app.openapi_url or "/openapi.json",
+ title=f"{app.title} - ReDoc",
+ redoc_js_url="https://cdn.jsdelivr.net/npm/redoc@next/bundles/redoc.standalone.js",
+ redoc_favicon_url="https://fastapi.tiangolo.com/img/favicon.png",
+ )
+ # Inject Speed Insights script into the HTML
+ html_content = html.body.decode()
+ html_content = html_content.replace(
+ "",
+ """
+
+""",
+ )
+ return HTMLResponse(content=html_content)