Files
vf_react/fix-basepath.sh
2025-11-22 09:36:58 +08:00

41 lines
919 B
Bash
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/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)"