From 5ab8377ac1d2cd319b7d14152147a8d897066b14 Mon Sep 17 00:00:00 2001 From: zhengkunwang <31820853+zhengkunwang223@users.noreply.github.com> Date: Wed, 9 Apr 2025 10:47:54 +0800 Subject: [PATCH] feat: update allowPort check (#8355) --- .../src/views/ai/mcp/server/operate/index.vue | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/frontend/src/views/ai/mcp/server/operate/index.vue b/frontend/src/views/ai/mcp/server/operate/index.vue index 18b0fde59..dd3e3f720 100644 --- a/frontend/src/views/ai/mcp/server/operate/index.vue +++ b/frontend/src/views/ai/mcp/server/operate/index.vue @@ -170,6 +170,14 @@ const hasWebsite = ref(false); const acceptParams = async (params: AI.McpServer) => { hasWebsite.value = false; mode.value = params.id ? 'edit' : 'create'; + let mcpDomainRes; + try { + mcpDomainRes = await getMcpDomain(); + if (mcpDomainRes.data.connUrl != '') { + hasWebsite.value = true; + } + } catch (error) {} + if (mode.value == 'edit') { mcpServer.value = params; if (!mcpServer.value.environments) { @@ -186,16 +194,12 @@ const acceptParams = async (params: AI.McpServer) => { if (params.port) { mcpServer.value.port = params.port; } - try { - const res = await getMcpDomain(); - if (res.data.connUrl != '') { - const parts = res.data.connUrl.split(/(https?:\/\/)/).filter(Boolean); - mcpServer.value.protocol = parts[0]; - mcpServer.value.url = parts[1]; - mcpServer.value.baseUrl = res.data.connUrl; - hasWebsite.value = true; - } - } catch (error) {} + if (mcpDomainRes.data && mcpDomainRes.data.connUrl != '') { + const parts = mcpDomainRes.data.connUrl.split(/(https?:\/\/)/).filter(Boolean); + mcpServer.value.protocol = parts[0]; + mcpServer.value.url = parts[1]; + mcpServer.value.baseUrl = mcpDomainRes.data.connUrl; + } } open.value = true; };