mirror of
https://github.com/LibreChat-AI/librechat.ai.git
synced 2026-03-27 10:48:32 +07:00
* docs: enhance API key setup instructions for clarity * docs: update section title for API key setup clarity * docs: add comprehensive guide for OpenAI image generation and editing tools * docs: clarify Stable Diffusion section and update link in Image Generation overview * docs: add Flux cloud generator configuration details and environment variables * fix: Firebase CDN configuration link * docs: enhance fileStrategy section with CDN options and notes * docs: enhance Image Generation section with improved structure and pricing details * docs: add Code Interpreter section with environment variable details and enterprise plan notes * fix: formatting * chore: bump next * fix: correct markdown formatting for artifact example in agents documentation * docs: add deprecation notices for tools, plugins, presets, and enhance image generation section * feat: implement GitHub stats API and update Usage component to fetch stars dynamically * fix: update Docker pulls value in Usage component
165 lines
4.4 KiB
JavaScript
165 lines
4.4 KiB
JavaScript
/* eslint-disable no-undef */
|
|
|
|
import remarkGfm from 'remark-gfm'
|
|
import nextra from 'nextra'
|
|
import NextBundleAnalyzer from '@next/bundle-analyzer'
|
|
|
|
const withBundleAnalyzer = NextBundleAnalyzer({
|
|
enabled: process.env.ANALYZE === 'true',
|
|
})
|
|
|
|
/**
|
|
* CSP headers
|
|
* img-src https to allow loading images from SSO providers
|
|
*/
|
|
const cspHeader = `
|
|
default-src 'self' https: wss:;
|
|
script-src 'self' 'unsafe-eval' 'unsafe-inline' https:;
|
|
style-src 'self' 'unsafe-inline' https:;
|
|
img-src 'self' https: blob: data:;
|
|
media-src 'self' https: blob: data:;
|
|
font-src 'self' https:;
|
|
frame-src 'self' https:;
|
|
worker-src 'self' blob:;
|
|
object-src 'none';
|
|
base-uri 'self';
|
|
form-action 'self';
|
|
frame-ancestors 'none';
|
|
upgrade-insecure-requests;
|
|
block-all-mixed-content;
|
|
`
|
|
|
|
const nonPermanentRedirects = [
|
|
// Up to date Redirects:
|
|
['/discord', 'https://discord.librechat.ai'],
|
|
['/demo', 'https://chat.librechat.ai'],
|
|
['/issue', 'https://github.com/danny-avila/LibreChat/issues/new/choose'],
|
|
['/new-issue', 'https://github.com/danny-avila/LibreChat/issues/new/choose'],
|
|
['/issues', 'https://github.com/danny-avila/LibreChat/issues'],
|
|
['/gh-support', 'https://github.com/danny-avila/LibreChat/discussions/categories/support'],
|
|
['/gh-discussions', 'https://github.com/danny-avila/LibreChat/discussions'],
|
|
['/roadmap', '/docs/roadmap'],
|
|
['/features', '/docs/features'],
|
|
/* Danny moved these :P */
|
|
['/docs/configuration/librechat_yaml/ai_endpoints/azure', '/docs/configuration/azure'],
|
|
['/docs/user_guides/artifacts', '/docs/features/artifacts'],
|
|
['/docs/user_guides/fork', '/docs/features/fork'],
|
|
['/docs/user_guides/authentication', '/docs/features/authentication'],
|
|
['/docs/user_guides/mod_system', '/docs/features/mod_system'],
|
|
['/docs/user_guides/search', '/docs/features/search'],
|
|
['/docs/user_guides/import_convos', '/docs/features/import_convos'],
|
|
['/docs/user_guides/password_reset', '/docs/features/password_reset'],
|
|
['/docs/user_guides/rag_api', '/docs/features/rag_api'],
|
|
['/docs/user_guides/plugins', '/docs/features/plugins'],
|
|
// Redirect to overview pages
|
|
...[].map((path) => [path, path + '/overview']),
|
|
]
|
|
|
|
const permanentRedirects = []
|
|
|
|
// nextra config
|
|
const withNextra = nextra({
|
|
theme: 'nextra-theme-docs',
|
|
themeConfig: './theme.config.tsx',
|
|
mdxOptions: {
|
|
remarkPlugins: [remarkGfm],
|
|
},
|
|
latex: {
|
|
renderer: 'mathjax'
|
|
},
|
|
defaultShowCopyCode: true,
|
|
})
|
|
|
|
// next config
|
|
const nextraConfig = withNextra({
|
|
experimental: {
|
|
esmExternals: 'loose',
|
|
scrollRestoration: true,
|
|
},
|
|
serverExternalPackages: ['mongoose'],
|
|
transpilePackages: ['react-tweet', 'react-syntax-highlighter', 'geist'],
|
|
images: {
|
|
remotePatterns: [
|
|
{
|
|
protocol: 'https',
|
|
hostname: 'static.librechat.ai',
|
|
port: '',
|
|
pathname: '/**',
|
|
},
|
|
{
|
|
protocol: 'https',
|
|
hostname: 'github.com',
|
|
port: '',
|
|
pathname: '/**',
|
|
},
|
|
{
|
|
protocol: 'https',
|
|
hostname: 'firebasestorage.googleapis.com',
|
|
port: '',
|
|
pathname: '/**',
|
|
},
|
|
{
|
|
protocol: 'https',
|
|
hostname: 'www.librechat.ai',
|
|
port: '',
|
|
pathname: '/**',
|
|
},
|
|
{
|
|
protocol: 'https',
|
|
hostname: 'librechat.ai',
|
|
port: '',
|
|
pathname: '/**',
|
|
},
|
|
],
|
|
},
|
|
headers() {
|
|
return [
|
|
{
|
|
source: '/:path*',
|
|
headers: [
|
|
{
|
|
key: 'x-frame-options',
|
|
value: 'SAMEORIGIN',
|
|
},
|
|
{
|
|
key: 'X-Content-Type-Options',
|
|
value: 'nosniff',
|
|
},
|
|
{
|
|
key: 'Referrer-Policy',
|
|
value: 'strict-origin-when-cross-origin',
|
|
},
|
|
{
|
|
key: 'Permissions-Policy',
|
|
value: 'autoplay=*, fullscreen=*, microphone=*',
|
|
},
|
|
],
|
|
},
|
|
{
|
|
source: '/:path((?!api).*)*',
|
|
headers: [
|
|
{
|
|
key: 'Content-Security-Policy',
|
|
value: cspHeader.replaceAll('\n', ''),
|
|
},
|
|
],
|
|
},
|
|
]
|
|
},
|
|
redirects: async () => [
|
|
...nonPermanentRedirects.map(([source, destination]) => ({
|
|
source,
|
|
destination,
|
|
permanent: false,
|
|
})),
|
|
...permanentRedirects.map(([source, destination]) => ({
|
|
source,
|
|
destination,
|
|
permanent: false,
|
|
})),
|
|
],
|
|
})
|
|
|
|
|
|
export default withBundleAnalyzer(nextraConfig)
|