#!/bin/bash echo "修复 basePath 配置..." cd /home/ubuntu/vf_react/src/views/AgentChat/neuratalk # 移除 basePath,让它在根路径运行 cat > next.config.js << 'EOF' /** @type {import('next').NextConfig} */ const nextConfig = { // 不设置 basePath,让 Nginx 处理路径重写 // basePath: '/ai-chat', reactStrictMode: true, poweredByHeader: false, outputFileTracingRoot: '/home/ubuntu/vf_react/src/views/AgentChat/neuratalk', async rewrites() { return [ { source: '/api/:path*', destination: 'http://localhost:5001/api/:path*', }, { source: '/mcp/:path*', destination: 'http://localhost:8900/:path*', }, ]; }, images: { domains: ['valuefrontier.cn', 'localhost', '49.232.185.254'], }, }; module.exports = nextConfig; EOF echo "✓ 已移除 basePath" echo "" echo "请重启 Next.js (Ctrl+C 然后 npm run dev)"