import type { NextConfig } from "next"; const nextConfig: NextConfig = { // 配置基础路径为 /ai-chat basePath: '/ai-chat', // 配置资源前缀 assetPrefix: '/ai-chat/', // 启用严格模式 reactStrictMode: true, // 生产环境优化 poweredByHeader: false, // 环境变量 env: { // 这些会在构建时被替换 NEXT_PUBLIC_BASE_PATH: '/ai-chat', }, // 重写规则 - 将 API 请求代理到后端 async rewrites() { return [ { source: '/api/:path*', destination: 'http://localhost:5001/api/:path*', }, { source: '/mcp/:path*', destination: 'http://localhost:8900/:path*', }, ]; }, // 配置允许的域名(用于 Next.js Image 组件) images: { domains: ['valuefrontier.cn', 'localhost', 'thirdwx.qlogo.cn'], remotePatterns: [ { protocol: 'https', hostname: 'thirdwx.qlogo.cn', pathname: '/**', }, ], }, }; export default nextConfig;