mirror of
https://github.com/LibreChat-AI/librechat.ai.git
synced 2026-03-27 02:38:32 +07:00
* chore: update configuration and dependencies for improved performance and compatibility - Refactored \`next-env.d.ts` to use import syntax for route types. - Updated \`next.config.mjs\` to enable turbopack and removed ESLint ignore settings. - Modified \`package.json\` and \`pnpm-lock.yaml\` to upgrade dependencies, including Next.js to version 16.1.6 and ajv to version 8.18.0. - Adjusted build scripts in \`package.json\` to use webpack. - Added a new \`proxy.ts\` file for handling markdown requests. - Updated \`tsconfig.json\` to include additional TypeScript definitions for development. * chore: update Next.js bundle analysis workflow for improved compatibility and performance - Updated GitHub Actions workflow to use the latest versions of actions for better stability. - Changed Node.js version to 20 and updated pnpm setup to version 4. - Simplified ESLint command and build process by using `pnpm lint` and `pnpm build`. - Enhanced comment handling by consolidating create/update comment steps into a single action. - Removed deprecated steps and comments for a cleaner workflow configuration. * chore: update package manager version in package.json - Set packageManager to pnpm@9.5.0 for improved dependency management. * chore: enhance Next.js bundle analysis workflow with caching and telemetry settings - Added environment variable to disable Next.js telemetry for privacy. - Implemented caching for Next.js build to improve workflow performance by restoring build artifacts. * refactor: simplify credentials generation logic in credentialsGenerator.ts - Replaced crypto module with window.crypto for generating random hex values. - Streamlined the generateCredentials function to use concise object return syntax.
25 lines
658 B
TypeScript
25 lines
658 B
TypeScript
import { NextRequest, NextResponse } from 'next/server'
|
|
|
|
function isMarkdownPreferred(request: NextRequest): boolean {
|
|
const accept = request.headers.get('accept') ?? ''
|
|
return accept.includes('text/markdown')
|
|
}
|
|
|
|
export default function proxy(request: NextRequest) {
|
|
if (isMarkdownPreferred(request)) {
|
|
const { pathname } = request.nextUrl
|
|
|
|
if (pathname.startsWith('/docs')) {
|
|
const rest = pathname.slice('/docs'.length)
|
|
const rewritten = `/llms.mdx/docs${rest}`
|
|
return NextResponse.rewrite(new URL(rewritten, request.nextUrl))
|
|
}
|
|
}
|
|
|
|
return NextResponse.next()
|
|
}
|
|
|
|
export const config = {
|
|
matcher: ['/docs/:path*'],
|
|
}
|