feat/ui-0.22:set static NEXT_PUBLIC_MCP_URL

This commit is contained in:
riverLethe committed 2025-07-25 23:02:42 +08:00
1 parent f108551780
commit d91c1c5369
3 files changed
+2 -6

No files matched your search

-4
View File
@@ -29,10 +29,6 @@ const nextConfig = {
source: "/uploads/:path*",
destination: `${process.env.NEXT_PUBLIC_API_URL || "http://127.0.0.1:8001"}/uploads/:path*`,
},
{
source: "/mcp/:path*",
destination: `${process.env.NEXT_PUBLIC_MCP_URL || "http://127.0.0.1:8002"}/mcp/:path*`,
},
];
},
@@ -30,7 +30,7 @@ export const ProductDetailThemeSelector: React.FC<
const [mcpName, setMcpName] = useState<string>("");
useEffect(() => {
if (url || !product.slug_name) return;
setUrl(`${window.location.origin}/mcp/${product.slug_name}`);
setUrl(`${window.location.protocol}//${window.location.hostname}:8002/mcp/${product.slug_name}`);
}, [product.slug_name]);
function sanitizeMCPServerName(rawName: string | undefined): string {
if (!rawName) return "xpack-mcp-service";
@@ -21,7 +21,7 @@ export const ServerConfig: React.FC<ServerConfigProps> = ({ product, mcpName })
const [url, setUrl] = useState<string>(process.env.NEXT_PUBLIC_MCP_URL || "");
useEffect(() => {
if (url || !product.slug_name) return
setUrl(`${window.location.origin}/mcp/${product.slug_name}`);
setUrl(`${window.location.protocol}//${window.location.hostname}:8002/mcp/${product.slug_name}`);
}, [product.slug_name]);