mirror of
https://github.com/kuaifan/dootask.git
synced 2026-01-24 10:58:12 +00:00
fix(operation-client): 修正 WebSocket 路径格式并优化连接 URL 生成
This commit is contained in:
parent
066a5a619c
commit
f36317b081
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user