mirror of
https://github.com/LibreChat-AI/librechat.ai.git
synced 2026-03-27 10:48:32 +07:00
📝 docs: Corrections, Metrics, YouTube API, and OpenID Redirect (#216)
* Update mcp_servers.mdx to reflect correct MCP documentation URL The URL for MCP documentation was wrong * Provide documentation for Monitoring/Metrics We wrote a LibreChat metrics exporter for Prometheus a while ago and have been running it on our production LibreChat for a while to monitor how the tool is being used and to alert us if there are any problems. This patch adds a simple documentation (because deploying is actually pretty simple) of how to set-up the metrics exporter for your LibreChat. We are hoping this will help others as well. * 📘 docs: Add YouTube API integration details to tools documentation * chore: Update upload-artifact action to version 4 in bundle analysis workflow * feat: Add OPENID_USE_END_SESSION_ENDPOINT option for logout redirection in OIDC configurations --------- Co-authored-by: Aldrin Salazar <salazar.aldrin@gmail.com> Co-authored-by: Lars Kiesow <lkiesow@uos.de> Co-authored-by: Danilo Pejakovic <danilo.pejakovic@leoninestudios.com>
This commit is contained in:
2
.github/workflows/nextjs_bundle_analysis.yml
vendored
2
.github/workflows/nextjs_bundle_analysis.yml
vendored
@@ -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
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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.
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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'],
|
||||
]}
|
||||
/>
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
---
|
||||
|
||||
52
pages/docs/configuration/metrics.mdx
Normal file
52
pages/docs/configuration/metrics.mdx
Normal file
@@ -0,0 +1,52 @@
|
||||
---
|
||||
title: Metrics
|
||||
description: This document explains how to add a metrics exporter for Prometheus to LibreChat.
|
||||
---
|
||||
|
||||
### General
|
||||
|
||||

|
||||
|
||||
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!
|
||||
@@ -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
|
||||
|
||||
|
||||
|
||||
BIN
public/images/metrics/librechat-metrics-active-users.png
Normal file
BIN
public/images/metrics/librechat-metrics-active-users.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 112 KiB |
Reference in New Issue
Block a user