feat: track user interest in paid plans and enhance admin analytics

- Added tracking for user interest in the pro plan on the PricingPage.
- Implemented auto-retry for CSRF token failures in API response interceptor.
- Introduced new interfaces and API functions for enhanced admin analytics, including ratings, tool usage, user stats, plan interest, and system health.
This commit is contained in:
Your Name
2026-03-21 13:49:02 +02:00
parent c800f707e3
commit d8a51d8494
9 changed files with 2027 additions and 406 deletions

View File

@@ -246,7 +246,8 @@ def stream_site_assistant_chat(
check_ai_budget()
settings = get_openrouter_settings()
if not settings.api_key:
raise RuntimeError("OPENROUTER_API_KEY is not configured for the application.")
logger.error("OPENROUTER_API_KEY is not set — assistant AI unavailable.")
raise RuntimeError("AI assistant is temporarily unavailable. Please try again later.")
response_model = settings.model
messages = _build_ai_messages(
@@ -436,7 +437,8 @@ def _request_ai_reply(
settings = get_openrouter_settings()
if not settings.api_key:
raise RuntimeError("OPENROUTER_API_KEY is not configured for the application.")
logger.error("OPENROUTER_API_KEY is not set — assistant AI unavailable.")
raise RuntimeError("AI assistant is temporarily unavailable. Please try again later.")
messages = _build_ai_messages(
message=message,