IA : Claude substitut Qwen + auth rate limit prototype

- qualify_ai_service : ai_frame_async() avec Claude Haiku
  · round 1 → questions contextualisées si ANTHROPIC_API_KEY définie
  · round 2 → explication enrichie par Claude
  · fallback transparent sur ai_frame() si pas de clé (tests inchangés)
- config : ANTHROPIC_API_KEY + ANTHROPIC_MODEL (claude-haiku-4-5-20251001)
- requirements : anthropic>=0.97.0
- main : auth rate limit = RATE_LIMIT_DEFAULT partout (prototype mode)
  → supporte accès démo/test sans lockout en prod comme en dev

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Yvv
2026-04-23 23:55:10 +02:00
parent 9a8f10efdf
commit 9b6322c546
5 changed files with 154 additions and 24 deletions

View File

@@ -99,13 +99,10 @@ app = FastAPI(
app.add_middleware(SecurityHeadersMiddleware)
# In dev mode, use the default (higher) limit for auth to avoid login lockout
# during repeated disconnect/reconnect cycles.
_auth_rate_limit = (
settings.RATE_LIMIT_DEFAULT
if settings.ENVIRONMENT == "development"
else settings.RATE_LIMIT_AUTH
)
# Prototype mode: use RATE_LIMIT_DEFAULT for auth so demos/testing don't hit
# the stricter RATE_LIMIT_AUTH (10/min). Set RATE_LIMIT_AUTH >= RATE_LIMIT_DEFAULT
# in .env only when going to real production.
_auth_rate_limit = settings.RATE_LIMIT_DEFAULT
app.add_middleware(
RateLimiterMiddleware,