diff --git a/.github/workflows/nextjs_bundle_analysis.yml b/.github/workflows/nextjs_bundle_analysis.yml index 86c6da2..d68563f 100644 --- a/.github/workflows/nextjs_bundle_analysis.yml +++ b/.github/workflows/nextjs_bundle_analysis.yml @@ -72,7 +72,7 @@ jobs: run: npx -p nextjs-bundle-analysis report - name: Upload bundle - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: bundle path: .next/analyze/__bundle_analysis.json diff --git a/pages/docs/configuration/authentication/OAuth2-OIDC/authelia.mdx b/pages/docs/configuration/authentication/OAuth2-OIDC/authelia.mdx index 9d5b58d..1d031ec 100644 --- a/pages/docs/configuration/authentication/OAuth2-OIDC/authelia.mdx +++ b/pages/docs/configuration/authentication/OAuth2-OIDC/authelia.mdx @@ -38,4 +38,7 @@ description: Learn how to configure LibreChat to use Authelia for user authentic OPENID_SESSION_SECRET=ANY_RANDOM_STRING OPENID_CALLBACK_URL=https://auth.example.com/api/oidc/authorization OPENID_SCOPE="openid profile email" + + # Optional: redirects the user to the end session endpoint after logging out + OPENID_USE_END_SESSION_ENDPOINT=true ``` diff --git a/pages/docs/configuration/authentication/OAuth2-OIDC/authentik.mdx b/pages/docs/configuration/authentication/OAuth2-OIDC/authentik.mdx index 86443f7..1bc5796 100644 --- a/pages/docs/configuration/authentication/OAuth2-OIDC/authentik.mdx +++ b/pages/docs/configuration/authentication/OAuth2-OIDC/authentik.mdx @@ -41,6 +41,8 @@ OPENID_SCOPE=openid profile email # Optional customization below OPENID_BUTTON_LABEL=Login with Authentik OPENID_IMAGE_URL=https://cdn.jsdelivr.net/gh/selfhst/icons/png/authentik.png +# Redirects the user to the end session endpoint after logging out +OPENID_USE_END_SESSION_ENDPOINT=true ``` > Note: Make sure nothing is wrapped in quotes in your .env and you have allowed social login. diff --git a/pages/docs/configuration/authentication/OAuth2-OIDC/aws.mdx b/pages/docs/configuration/authentication/OAuth2-OIDC/aws.mdx index 60f330f..f0e6ab0 100644 --- a/pages/docs/configuration/authentication/OAuth2-OIDC/aws.mdx +++ b/pages/docs/configuration/authentication/OAuth2-OIDC/aws.mdx @@ -107,6 +107,9 @@ OPENID_ISSUER=https://cognito-idp.[AWS REGION].amazonaws.com/[USER POOL ID]/.wel OPENID_SESSION_SECRET=Any random string OPENID_SCOPE=openid profile email OPENID_CALLBACK_URL=/oauth/openid/callback + +# Optional: redirects the user to the end session endpoint after logging out +OPENID_USE_END_SESSION_ENDPOINT=true ``` 7. Save the .env file diff --git a/pages/docs/configuration/authentication/OAuth2-OIDC/azure.mdx b/pages/docs/configuration/authentication/OAuth2-OIDC/azure.mdx index 5e5ac3b..306f736 100644 --- a/pages/docs/configuration/authentication/OAuth2-OIDC/azure.mdx +++ b/pages/docs/configuration/authentication/OAuth2-OIDC/azure.mdx @@ -52,6 +52,9 @@ OPENID_REQUIRED_ROLE_TOKEN_KIND=id # If you want to restrict access by groups OPENID_REQUIRED_ROLE_PARAMETER_PATH="roles" OPENID_REQUIRED_ROLE="Your Group Name" + +# Optional: redirects the user to the end session endpoint after logging out +OPENID_USE_END_SESSION_ENDPOINT=true ``` 11. Save the .env file diff --git a/pages/docs/configuration/authentication/OAuth2-OIDC/keycloak.mdx b/pages/docs/configuration/authentication/OAuth2-OIDC/keycloak.mdx index 9b572c4..7d24268 100644 --- a/pages/docs/configuration/authentication/OAuth2-OIDC/keycloak.mdx +++ b/pages/docs/configuration/authentication/OAuth2-OIDC/keycloak.mdx @@ -65,4 +65,7 @@ If you want to restrict access to users with specific roles, you can define role OPENID_REQUIRED_ROLE=[YourRequiredRole] OPENID_REQUIRED_ROLE_TOKEN_KIND=(access|id) # that means, `access` or `id` OPENID_REQUIRED_ROLE_PARAMETER_PATH="realm_access.roles" + + # Optional: redirects the user to the end session endpoint after logging out + OPENID_USE_END_SESSION_ENDPOINT=true ``` diff --git a/pages/docs/configuration/dotenv.mdx b/pages/docs/configuration/dotenv.mdx index 6a6e5e7..6f90ba7 100644 --- a/pages/docs/configuration/dotenv.mdx +++ b/pages/docs/configuration/dotenv.mdx @@ -828,6 +828,7 @@ For more information: ['OPENID_REQUIRED_ROLE_PARAMETER_PATH', 'string', 'The parameter path for required role validation.','OPENID_REQUIRED_ROLE_PARAMETER_PATH='], ['OPENID_BUTTON_LABEL', 'string', 'The label for the OpenID login button.','OPENID_BUTTON_LABEL='], ['OPENID_IMAGE_URL', 'string', 'The URL of the OpenID login button image.','OPENID_IMAGE_URL='], + ['OPENID_USE_END_SESSION_ENDPOINT', 'string', 'Whether to use the Issuer End Session Endpoint as a Logout Redirect','OPENID_USE_END_SESSION_ENDPOINT=TRUE'], ]} /> diff --git a/pages/docs/configuration/librechat_yaml/object_structure/mcp_servers.mdx b/pages/docs/configuration/librechat_yaml/object_structure/mcp_servers.mdx index f07ff15..65b08f4 100644 --- a/pages/docs/configuration/librechat_yaml/object_structure/mcp_servers.mdx +++ b/pages/docs/configuration/librechat_yaml/object_structure/mcp_servers.mdx @@ -167,7 +167,7 @@ The `mcpServers` configurations allow LibreChat to dynamically interact with var ## References -- [Model Context Protocol (MCP) Documentation](https://github.com/anthropic/mcp) +- [Model Context Protocol (MCP) Documentation](https://github.com/modelcontextprotocol) - [Node.js child_process.spawn](https://nodejs.org/api/child_process.html#child_processspawncommand-args-options) --- diff --git a/pages/docs/configuration/metrics.mdx b/pages/docs/configuration/metrics.mdx new file mode 100644 index 0000000..6dae8f3 --- /dev/null +++ b/pages/docs/configuration/metrics.mdx @@ -0,0 +1,52 @@ +--- +title: Metrics +description: This document explains how to add a metrics exporter for Prometheus to LibreChat. +--- + +### General + +![Active users in LibreChat](/images/metrics/librechat-metrics-active-users.png) + +You can use Prometheus or any other OpenMetrics compatible monitoring tool to get metrics about active usage of LibreChat. +This includes technical information like the usage of tokens, +but also information about end users like the number of total or active users. + +The metrics exporter is available at [virtUOS/librechat_exporter](https://github.com/virtUOS/librechat_exporter). +It is a separate tool you deploy alongside LibreChat. + +### Setup + +To deploy the exporter, just add the necessary container to your compose configuration like this: + +```yaml + metrics: + image: ghcr.io/virtuos/librechat_exporter:main + depends_on: + - mongodb + ports: + - "8000:8000" + restart: unless-stopped +``` + +You can optionally also configure the exporter. +But usually, the defaults should be just fine. +```yaml + environment: + - MONGODB_URI=mongodb://mongodb:27017/ + - LOGGING_LEVEL=info +``` + +### Usage + +You can now add the exporter to your Prometheus scrape configuration: +```yaml +- job_name: librechat + static_configs: + - targets: + - 'librechat.example.com:8000' +``` + +Once scraping the metrics has started, look for `librechat_*` metrics (e.g., `librechat_registered_users`). +The exporter provides several metrics. + +Have fun building your Grafana dashboard! diff --git a/pages/docs/configuration/tools/index.mdx b/pages/docs/configuration/tools/index.mdx index 0f7723d..4b50166 100644 --- a/pages/docs/configuration/tools/index.mdx +++ b/pages/docs/configuration/tools/index.mdx @@ -44,3 +44,32 @@ description: Tools and Plugins setup instructions - You can get an API key here: **[https://serpapi.com/dashboard](https://serpapi.com/dashboard)** - For free tier, you are limited to 100 queries/month - With google, you are limited to 100/day for free, which is a better deal, and any after may cost you a few pennies + +### YouTube +- Requires a YouTube API key from the [Google Cloud Console](https://console.cloud.google.com/) + - Create a new project or select an existing one + - Enable the YouTube Data API v3 + - Create credentials (API key) + - Set the API key in your environment variables as `YOUTUBE_API_KEY` + +The YouTube tool provides four main operations: + +1. **Search Videos** + - Search for YouTube videos with customizable results + - Example: Search for "cooking pasta" videos, limit to 5 results + +2. **Get Video Info** + - Retrieve detailed information about a specific video + - Includes title, description, views, likes, and comment count + +3. **Get Comments** + - Fetch comments from a specific video + - Customizable number of comments (1-50, default: 10) + - Returns author, text, and like count + +4. **Get Transcript** + - Retrieve video transcripts + - Attempts to fetch English transcript first + - Finally tries any available language if neither is found + + diff --git a/public/images/metrics/librechat-metrics-active-users.png b/public/images/metrics/librechat-metrics-active-users.png new file mode 100644 index 0000000..9344f1f Binary files /dev/null and b/public/images/metrics/librechat-metrics-active-users.png differ