From f36317b0818686c833526bc190b7e677dab43362 Mon Sep 17 00:00:00 2001 From: kuaifan Date: Mon, 19 Jan 2026 10:30:02 +0800 Subject: [PATCH] =?UTF-8?q?fix(operation-client):=20=E4=BF=AE=E6=AD=A3=20W?= =?UTF-8?q?ebSocket=20=E8=B7=AF=E5=BE=84=E6=A0=BC=E5=BC=8F=E5=B9=B6?= =?UTF-8?q?=E4=BC=98=E5=8C=96=E8=BF=9E=E6=8E=A5=20URL=20=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../js/components/AIAssistant/operation-client.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/resources/assets/js/components/AIAssistant/operation-client.js b/resources/assets/js/components/AIAssistant/operation-client.js index 0dc3a3eaf..a44ca61b4 100644 --- a/resources/assets/js/components/AIAssistant/operation-client.js +++ b/resources/assets/js/components/AIAssistant/operation-client.js @@ -4,8 +4,7 @@ * 负责与 MCP Server 建立 WebSocket 连接, * 接收来自 MCP 工具的请求并返回响应。 */ - -const WS_PATH = '/apps/mcp_server/mcp/operation'; +const WS_PATH = 'apps/mcp_server/mcp/operation'; const RECONNECT_DELAY = 3000; const MAX_RECONNECT_ATTEMPTS = 5; @@ -59,9 +58,10 @@ export class OperationClient { return; } - const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:'; - const host = window.location.host; - const url = `${protocol}//${host}${WS_PATH}?token=${encodeURIComponent(token)}`; + let url = $A.mainUrl(WS_PATH); + url = url.replace("https://", "wss://"); + url = url.replace("http://", "ws://"); + url += `?token=${encodeURIComponent(token)}`; try { this.ws = new WebSocket(url);