refactor: update visitor references to guest in WebSocket service and related files

This commit is contained in:
mlogclub
2026-04-27 18:52:33 +08:00
parent c14ade27e4
commit 24105781d9
6 changed files with 27 additions and 27 deletions
+2 -2
View File
@@ -1,5 +1,5 @@
import { createWebSocketBaseUrl } from "@/lib/api/websocket"
import { getImVisitorId, type ImMessage } from "@/lib/api/im"
import { getGuestId, type ImMessage } from "@/lib/api/im"
import { readKefuWidgetConfig } from "@/lib/kefu-widget-config"
import type {
RealtimeConversationPatch,
@@ -20,7 +20,7 @@ export function createImRealtimeConnection() {
? apiBaseUrl.replace(/^http/, "ws").replace(/\/$/, "")
: createWebSocketBaseUrl()
const resolvedExternalId = encodeURIComponent(
(config.externalId ?? "").trim() || getImVisitorId()
(config.externalId ?? "").trim() || getGuestId()
)
const externalSource = encodeURIComponent(
(config.externalSource ?? "web_chat").trim() || "web_chat"