Add admin panel, WebSocket support, and API versioning
CI / Lint & Format (push) Failing after 28s
CI / Tests (push) Has been skipped
CI / Security Scan (push) Failing after 8s
CI / Docker Build (push) Has been skipped

Introduce an admin portal (React + Nginx), WebSocket routing, and
API versioning middleware with `/api/v1/` prefix deprecation.
Add master API key authentication, new Prometheus metrics for AI
token consumption and active WebSockets, and extend S3 config
with a public endpoint URL. Update test paths and fixtures to
align with the new routing structure.
This commit is contained in:
2026-06-22 11:25:22 -04:00
parent d68deb9c74
commit 2f2a5e9b4a
158 changed files with 64811 additions and 503 deletions
+14 -1
View File
@@ -14,6 +14,7 @@ from app.services.scraper import fetch_page_content
from app.services.ai_vision import summarize_url, draft_task
from app.config import settings
from app.middleware import limiter
from app.metrics import hub_ai_tokens_consumed
router = APIRouter(prefix="/ai", tags=["Intelligence Artificielle"])
@@ -62,7 +63,7 @@ async def summarize_link(
language=body.language,
)
return SummarizeResponse(
resp = SummarizeResponse(
url=body.url,
title=page.get("title"),
summary=result["summary"],
@@ -70,6 +71,13 @@ async def summarize_link(
model=result["model"],
)
# Metrics
if result.get("prompt_tokens") or result.get("output_tokens"):
total = (result.get("prompt_tokens") or 0) + (result.get("output_tokens") or 0)
hub_ai_tokens_consumed.labels(client_id=client.id, model=result["model"]).inc(total)
return resp
@router.post(
"/draft-task",
@@ -99,4 +107,9 @@ async def generate_task(
if not result.get("title"):
raise HTTPException(status_code=500, detail="Échec de la génération de la tâche")
# Metrics
if result.get("prompt_tokens") or result.get("output_tokens"):
total = (result.get("prompt_tokens") or 0) + (result.get("output_tokens") or 0)
hub_ai_tokens_consumed.labels(client_id=client.id, model=result.get("model", "unknown")).inc(total)
return DraftTaskResponse(**result)