mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-25 03:48:17 +00:00
fix(operation-client): 修正 WebSocket 路径格式并优化连接 URL 生成
This commit is contained in:
parent
066a5a619c
commit
f36317b081
@ -4,8 +4,7 @@
|
|||||||
* 负责与 MCP Server 建立 WebSocket 连接,
|
* 负责与 MCP Server 建立 WebSocket 连接,
|
||||||
* 接收来自 MCP 工具的请求并返回响应。
|
* 接收来自 MCP 工具的请求并返回响应。
|
||||||
*/
|
*/
|
||||||
|
const WS_PATH = 'apps/mcp_server/mcp/operation';
|
||||||
const WS_PATH = '/apps/mcp_server/mcp/operation';
|
|
||||||
const RECONNECT_DELAY = 3000;
|
const RECONNECT_DELAY = 3000;
|
||||||
const MAX_RECONNECT_ATTEMPTS = 5;
|
const MAX_RECONNECT_ATTEMPTS = 5;
|
||||||
|
|
||||||
@ -59,9 +58,10 @@ export class OperationClient {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
|
let url = $A.mainUrl(WS_PATH);
|
||||||
const host = window.location.host;
|
url = url.replace("https://", "wss://");
|
||||||
const url = `${protocol}//${host}${WS_PATH}?token=${encodeURIComponent(token)}`;
|
url = url.replace("http://", "ws://");
|
||||||
|
url += `?token=${encodeURIComponent(token)}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
this.ws = new WebSocket(url);
|
this.ws = new WebSocket(url);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user