@zero-library/chat-agent 2.1.20 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,12 +1,11 @@
1
- import { useRefState, useDebounce, useSyncInput, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, getWebSocketUrl, getToken, isLocalhost, downloadFile, FilePreview, MarkdownEditor, isNumber, getFileSuffixName, isObject, isNullOrUnDef, isBoolean, UserAvatar, copyText, deepCopy, transforms, transform, getCurrentUser, deepMerge, createRequest, RenderMarkdown, useCreateValtioContext, FileIcon, isExternal } from '@zero-library/common';
1
+ import { createSecureManager, createTokenManager, useRefState, useDebounce, useSyncInput, RenderWrapper, shouldRender, isFunction, useDeepEffect, useWebSocket, downloadFile, FilePreview, MarkdownEditor, isNumber, getFileSuffixName, isObject, isNullOrUnDef, isBoolean, UserAvatar, copyText, deepCopy, transforms, deepMerge, createRequest, HttpStatus, isArray, isString, RenderMarkdown, transform, emit, buildUrlParams, getWebSocketUrl, useCreateValtioContext, FileIcon, isExternal } from '@zero-library/common';
2
2
  import { App, Badge, Button, Flex, Typography, Spin, Splitter, Tag, Popover, List, Avatar, Space, message, Empty, Modal, Row, Col, Collapse, Drawer } from 'antd';
3
3
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
4
4
  import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
5
5
  import { useSnapshot, proxy } from 'valtio';
6
6
  import { CloudUploadOutlined, PaperClipOutlined, EnterOutlined, UserSwitchOutlined, CloseOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, DeleteOutlined, RedoOutlined, PlayCircleOutlined, CaretRightOutlined } from '@ant-design/icons';
7
- import { Attachments, Sender, Suggestion, XProvider, Welcome, Prompts, Bubble, Conversations } from '@ant-design/x';
8
- export * from '@ant-design/x';
9
- import classNames8 from 'classnames';
7
+ import { Attachments, Sender, Suggestion, XProvider, Prompts, Bubble, Conversations, Welcome } from '@ant-design/x';
8
+ import classNames9 from 'classnames';
10
9
  import dayjs from 'dayjs';
11
10
  import InfiniteScroll from 'react-infinite-scroll-component';
12
11
 
@@ -275,6 +274,18 @@ var init_Think = __esm({
275
274
  };
276
275
  }
277
276
  });
277
+ var userInfoManager = createSecureManager({
278
+ key: "NS-USER",
279
+ aesKey: "((#II))"
280
+ });
281
+ var TOKEN_KEY = "NS-TOKEN";
282
+ var tokenManager = createTokenManager({
283
+ key: TOKEN_KEY
284
+ });
285
+ var redirectUrl = () => {
286
+ const path = localStorage.getItem("SIGNPATH");
287
+ emit("jumpLink", { url: `/uc${path || "/sign-in"}` });
288
+ };
278
289
  var classifyTime = (timestamp) => {
279
290
  const now = dayjs();
280
291
  const target = dayjs(timestamp);
@@ -295,6 +306,9 @@ var classifyTime = (timestamp) => {
295
306
  var replaceThinkTags = (str) => {
296
307
  return str.replace(/<think>/g, ":::alert type=think data={content:'").replace(/<\/think>/g, "'} :::");
297
308
  };
309
+ var getChatSocketUrl = (baseURL, params) => {
310
+ return buildUrlParams(params, getWebSocketUrl(`${baseURL}/lolr/conversation/ws/subscribe`), "comma");
311
+ };
298
312
 
299
313
  // src/services/index.ts
300
314
  var createChatService = (request) => {
@@ -414,8 +428,6 @@ var defaultExpertLayout = {
414
428
  globalHeader: false,
415
429
  chatHeader: {
416
430
  props: {
417
- title: true,
418
- closeBtn: false,
419
431
  newConversationBtn: false,
420
432
  agentCharacter: false,
421
433
  conversationListBtn: false
@@ -426,7 +438,10 @@ var defaultExpertLayout = {
426
438
  function createChatStore() {
427
439
  const config = proxy({
428
440
  services: {
429
- websocketBaseUrls: []
441
+ /** WebSocket地址 */
442
+ websocketUrls: ["", ""],
443
+ /** HTTP请求实例 */
444
+ request: {}
430
445
  },
431
446
  hooks: {},
432
447
  layout: {},
@@ -443,13 +458,37 @@ function createChatStore() {
443
458
  /** 聊天参数配置 */
444
459
  params: {}
445
460
  });
446
- const setServices = ({ baseUrl = "/api" } = {}) => {
447
- config.services.baseUrl = baseUrl;
448
- if (!config.services.websocketBaseUrls?.includes(baseUrl)) {
449
- config.services.websocketBaseUrls = [...config.services.websocketBaseUrls, baseUrl];
461
+ const setServices = ({ http, websocket } = {}) => {
462
+ const httpConfig = { baseURL: "/api", headers: { [TOKEN_KEY]: tokenManager.get() }, ...http?.config };
463
+ const request = createRequest(httpConfig);
464
+ if (config.hooks?.onRequestInterceptor) {
465
+ request.instance.interceptors.request.use(...config.hooks.onRequestInterceptor);
466
+ }
467
+ request.instance.interceptors.response.use(void 0, (err) => {
468
+ if (err?.response?.status === HttpStatus.UNAUTHORIZED) {
469
+ if (config.hooks.onRedirectLogin) {
470
+ config.hooks.onRedirectLogin();
471
+ } else {
472
+ redirectUrl();
473
+ }
474
+ }
475
+ return Promise.reject(err);
476
+ });
477
+ if (config.hooks?.onResponseInterceptor) {
478
+ request.instance.interceptors.response.use(...config.hooks.onResponseInterceptor);
479
+ }
480
+ config.services.request = { ...createChatService(request), ...createFileService(request), ...http?.request };
481
+ config.services.websocketUrls = ["", ""];
482
+ if (isArray(websocket?.baseURLs)) {
483
+ websocket.baseURLs.forEach((baseURL, index) => {
484
+ if (isString(baseURL)) {
485
+ config.services.websocketUrls[index] = getChatSocketUrl(baseURL, websocket?.params || httpConfig.headers);
486
+ }
487
+ });
488
+ } else {
489
+ const url = getChatSocketUrl(httpConfig.baseURL, websocket?.params || httpConfig.headers);
490
+ config.services.websocketUrls = [url, ""];
450
491
  }
451
- const request = createRequest(baseUrl);
452
- config.services.request = { ...createChatService(request), ...createFileService(request) };
453
492
  };
454
493
  const setPreview = (file = {}, isEdit = false) => {
455
494
  if (shouldRender(config.layout.preview)) {
@@ -476,14 +515,8 @@ function createChatStore() {
476
515
  config.hooks = hooks;
477
516
  };
478
517
  const setUserInfo = (userInfo) => {
479
- config.userInfo = transform(userInfo || getCurrentUser() || {}, {
480
- id: (userInfo2) => {
481
- return String(userInfo2["id"]);
482
- },
483
- name: "name",
484
- iconUrl: "avatar",
485
- description: "remark"
486
- });
518
+ config.userInfo = userInfo || userInfoManager.get() || {};
519
+ config.userInfo.id = String(config.userInfo.id || "");
487
520
  };
488
521
  const receiver = proxy({
489
522
  /** 当前激活的接收者信息(智能体或专家) */
@@ -935,9 +968,13 @@ function createChatStore() {
935
968
  messages[idx] = { ...msg, type: void 0 };
936
969
  conversation.messages[msg.conversationId].loading = false;
937
970
  };
938
- const acceptMessage = (newMessage) => {
971
+ const acceptMessage = async (newMessage) => {
939
972
  const conversationId = newMessage.data.conversationId;
940
973
  if (!conversation.messages[conversationId]?.message) return;
974
+ const canProceed = await config.hooks?.onBeforeAcceptMessage?.(newMessage.data);
975
+ if (canProceed === false) {
976
+ throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
977
+ }
941
978
  switch (newMessage.data.type) {
942
979
  case "TEXT_MESSAGE_START":
943
980
  startCallback(newMessage.data);
@@ -955,6 +992,7 @@ function createChatStore() {
955
992
  errCallback(newMessage.data);
956
993
  break;
957
994
  }
995
+ config.hooks?.onAfterAcceptMessage?.(newMessage.data);
958
996
  };
959
997
  return {
960
998
  /** 全局配置对象 */
@@ -1047,7 +1085,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
1047
1085
  Bubble,
1048
1086
  {
1049
1087
  placement,
1050
- className: classNames8({ [styles_module_default2.loadingMessage]: message2.type }),
1088
+ className: classNames9({ [styles_module_default2.loadingMessage]: message2.type }),
1051
1089
  content: /* @__PURE__ */ jsx(RenderMarkdown, { content: replaceThinkTags(message2.msgContent), customComponents })
1052
1090
  }
1053
1091
  ),
@@ -1074,7 +1112,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
1074
1112
  message2.quoteMsg?.id && /* @__PURE__ */ jsx(
1075
1113
  Bubble,
1076
1114
  {
1077
- className: classNames8(styles_module_default2.chatQuoteMsg),
1115
+ className: classNames9(styles_module_default2.chatQuoteMsg),
1078
1116
  placement,
1079
1117
  content: /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
1080
1118
  message2.quoteMsg.msgContent && /* @__PURE__ */ jsxs(Flex, { children: [
@@ -1136,7 +1174,55 @@ var styles_module_default3 = {
1136
1174
  nsAvatarListItemIconActive: "styles_module_nsAvatarListItemIconActive",
1137
1175
  nsAvatarListItemName: "styles_module_nsAvatarListItemName"
1138
1176
  };
1139
- var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, agent: true, other: true } }) => {
1177
+
1178
+ // src/ui/common/WelcomeItem.tsx
1179
+ init_Context();
1180
+ var WelcomeItem_default = ({ icon = true, title = true, description = true, prompts = true }) => {
1181
+ const chatStore = useChatStore();
1182
+ const receiverState = useSnapshot(chatStore.receiver);
1183
+ return /* @__PURE__ */ jsxs(Space, { direction: "vertical", size: 16, className: styles_module_default3.chatWelcomeWrap, children: [
1184
+ /* @__PURE__ */ jsx(
1185
+ Welcome,
1186
+ {
1187
+ className: classNames9(styles_module_default3.chatWelcome, "p-t-32"),
1188
+ variant: "borderless",
1189
+ icon: /* @__PURE__ */ jsx(RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1190
+ title: /* @__PURE__ */ jsx(RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
1191
+ description: /* @__PURE__ */ jsx(
1192
+ RenderWrapper,
1193
+ {
1194
+ control: description,
1195
+ DefaultComponent: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: receiverState.active.description || "" } })
1196
+ }
1197
+ )
1198
+ }
1199
+ ),
1200
+ receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsx(
1201
+ RenderWrapper,
1202
+ {
1203
+ control: prompts,
1204
+ DefaultComponent: /* @__PURE__ */ jsx(
1205
+ Prompts,
1206
+ {
1207
+ className: "m-t-16",
1208
+ wrap: true,
1209
+ items: [
1210
+ {
1211
+ key: "1",
1212
+ label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1213
+ children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1214
+ key: question,
1215
+ description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames9(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1216
+ }))
1217
+ }
1218
+ ]
1219
+ }
1220
+ )
1221
+ }
1222
+ )
1223
+ ] });
1224
+ };
1225
+ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, avatar = { user: false, agent: true, other: true } }) => {
1140
1226
  const chatStore = useChatStore();
1141
1227
  const receiverState = useSnapshot(chatStore.receiver);
1142
1228
  const conversationState = useSnapshot(chatStore.conversation);
@@ -1176,44 +1262,16 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
1176
1262
  () => conversationState.messages[conversationState.active.id] || {},
1177
1263
  [conversationState.messages[conversationState.active.id]]
1178
1264
  );
1179
- const placeholderNode = useMemo(
1180
- () => [
1265
+ const welcomeMessageRecord = useMemo(() => {
1266
+ const isExist = shouldRender(welcomeMessage);
1267
+ return isExist ? [
1181
1268
  {
1182
1269
  key: "placeholder",
1183
- content: /* @__PURE__ */ jsxs(Space, { direction: "vertical", size: 16, className: styles_module_default3.chatWelcomeWrap, children: [
1184
- /* @__PURE__ */ jsx(
1185
- Welcome,
1186
- {
1187
- className: classNames8(styles_module_default3.chatWelcome, "p-t-32"),
1188
- variant: "borderless",
1189
- icon: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: receiverState.active.logo }),
1190
- title: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}`,
1191
- description: /* @__PURE__ */ jsx("div", { dangerouslySetInnerHTML: { __html: receiverState.active.description || "" } })
1192
- }
1193
- ),
1194
- receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsx(
1195
- Prompts,
1196
- {
1197
- className: "m-t-16",
1198
- wrap: true,
1199
- items: [
1200
- {
1201
- key: "1",
1202
- label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1203
- children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1204
- key: question,
1205
- description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames8(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1206
- }))
1207
- }
1208
- ]
1209
- }
1210
- )
1211
- ] }),
1270
+ content: /* @__PURE__ */ jsx(RenderWrapper, { control: welcomeMessage, DefaultComponent: /* @__PURE__ */ jsx(WelcomeItem_default, {}) }),
1212
1271
  variant: "borderless"
1213
1272
  }
1214
- ],
1215
- [receiverState.active]
1216
- );
1273
+ ] : [];
1274
+ }, [receiverState.active, welcomeMessage]);
1217
1275
  const questionList = useMemo(
1218
1276
  () => chatMessage?.questionList?.length ? [
1219
1277
  {
@@ -1293,17 +1351,13 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
1293
1351
  }, [firstMessage]);
1294
1352
  const bubbleListItems = useMemo(() => {
1295
1353
  const list = [];
1296
- if (firstMessageRecord.length > 0) {
1297
- list.push(...firstMessageRecord);
1298
- }
1299
- if (chatRecords.length > 0) {
1300
- list.push(...chatRecords, ...questionList);
1301
- }
1354
+ list.push(...firstMessageRecord);
1355
+ list.push(...chatRecords, ...questionList);
1302
1356
  if (list.length) {
1303
1357
  return list;
1304
1358
  }
1305
- return [...placeholderNode];
1306
- }, [chatRecords, questionList, placeholderNode, firstMessageRecord]);
1359
+ return [...welcomeMessageRecord];
1360
+ }, [chatRecords, questionList, welcomeMessageRecord, firstMessageRecord]);
1307
1361
  const listRef = useRef(null);
1308
1362
  const autoScrollRef = useRef(true);
1309
1363
  const handleScroll = (el) => {
@@ -1334,7 +1388,7 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
1334
1388
  autoScroll: false,
1335
1389
  ref: listRef,
1336
1390
  items: bubbleListItems,
1337
- className: classNames8(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1391
+ className: classNames9(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1338
1392
  onScroll: handleScroll
1339
1393
  },
1340
1394
  conversationState.active.id
@@ -1369,7 +1423,7 @@ var CharacterList_default = () => {
1369
1423
  /* @__PURE__ */ jsx(
1370
1424
  Avatar,
1371
1425
  {
1372
- className: classNames8(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1426
+ className: classNames9(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1373
1427
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1374
1428
  }),
1375
1429
  size: 50,
@@ -1456,6 +1510,7 @@ var ConversationList_default = () => {
1456
1510
  };
1457
1511
  var ChatHeader_default = ({
1458
1512
  title = true,
1513
+ avatar = true,
1459
1514
  closeBtn = false,
1460
1515
  newConversationBtn = true,
1461
1516
  agentCharacter = true,
@@ -1464,18 +1519,10 @@ var ChatHeader_default = ({
1464
1519
  const chatStore = useChatStore();
1465
1520
  const receiverState = useSnapshot(chatStore.receiver);
1466
1521
  const configState = useSnapshot(chatStore.config);
1467
- return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames8(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1522
+ return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", className: classNames9(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1468
1523
  /* @__PURE__ */ jsxs(Flex, { gap: 4, align: "center", children: [
1469
- /* @__PURE__ */ jsx(
1470
- RenderWrapper,
1471
- {
1472
- control: title,
1473
- DefaultComponent: /* @__PURE__ */ jsxs(Fragment, { children: [
1474
- /* @__PURE__ */ jsx(Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }),
1475
- /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name })
1476
- ] })
1477
- }
1478
- ),
1524
+ /* @__PURE__ */ jsx(RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsx(Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1525
+ /* @__PURE__ */ jsx(RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
1479
1526
  " "
1480
1527
  ] }),
1481
1528
  /* @__PURE__ */ jsxs(Space, { size: 2, children: [
@@ -1774,7 +1821,7 @@ var SenderPromptsItems_default = () => {
1774
1821
  title: /* @__PURE__ */ jsx(
1775
1822
  "div",
1776
1823
  {
1777
- className: classNames8(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1824
+ className: classNames9(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1778
1825
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
1779
1826
  }
1780
1827
  ),
@@ -1903,7 +1950,7 @@ var ConversationListHeader_default = () => {
1903
1950
  type: "primary",
1904
1951
  shape: "round",
1905
1952
  onClick: () => chatStore.createConversation(),
1906
- className: classNames8("m-t-16"),
1953
+ className: classNames9("m-t-16"),
1907
1954
  icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
1908
1955
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
1909
1956
  }
@@ -1911,7 +1958,7 @@ var ConversationListHeader_default = () => {
1911
1958
  ] });
1912
1959
  };
1913
1960
  var ConversationListPanel_default = ({ header }) => {
1914
- return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames8("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
1961
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
1915
1962
  /* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
1916
1963
  /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
1917
1964
  ] });
@@ -1930,6 +1977,18 @@ var styles_module_default4 = {
1930
1977
  var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, config, services }, ref) => {
1931
1978
  const chatStore = useMemo(() => createChatStore(), []);
1932
1979
  const senderRef = useRef();
1980
+ useEffect(() => {
1981
+ chatStore.setHooks(hooks);
1982
+ }, [hooks]);
1983
+ useEffect(() => {
1984
+ chatStore.setUserInfo(userInfo);
1985
+ }, [userInfo]);
1986
+ useEffect(() => {
1987
+ chatStore.setLayout(layout, config?.receiverType);
1988
+ }, [layout, config?.receiverType]);
1989
+ useEffect(() => {
1990
+ chatStore.setParams(params);
1991
+ }, [params]);
1933
1992
  useDeepEffect(() => {
1934
1993
  chatStore.setServices(services);
1935
1994
  }, [services]);
@@ -1942,18 +2001,6 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
1942
2001
  chatStore.switchAgentConversation(config.receiverId, config.conversationStrategy);
1943
2002
  }
1944
2003
  }, [config]);
1945
- useEffect(() => {
1946
- chatStore.setUserInfo(userInfo);
1947
- }, [userInfo]);
1948
- useEffect(() => {
1949
- chatStore.setLayout(layout, config?.receiverType);
1950
- }, [layout, config?.receiverType]);
1951
- useEffect(() => {
1952
- chatStore.setParams(params);
1953
- }, [params]);
1954
- useEffect(() => {
1955
- chatStore.setHooks(hooks);
1956
- }, [hooks]);
1957
2004
  const receiverState = useSnapshot(chatStore.receiver);
1958
2005
  const configState = useSnapshot(chatStore.config);
1959
2006
  useImperativeHandle(
@@ -1989,19 +2036,13 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
1989
2036
  }
1990
2037
  }, [hasPreView]);
1991
2038
  useWebSocket({
1992
- url: configState.services.websocketBaseUrls?.[0] && getWebSocketUrl(
1993
- `${configState.services.websocketBaseUrls?.[0]}/lolr/conversation/ws/subscribe?NS-TOKEN=${getToken()}`,
1994
- isLocalhost() ? "192.168.3.102" : ""
1995
- ),
2039
+ url: configState.services.websocketUrls?.[0],
1996
2040
  onMessage: chatStore.acceptMessage,
1997
2041
  clientHeartbeat: false,
1998
2042
  reconnectInterval: 1e4
1999
2043
  });
2000
2044
  useWebSocket({
2001
- url: configState.services.websocketBaseUrls?.[1] && getWebSocketUrl(
2002
- `${configState.services.websocketBaseUrls?.[1]}/lolr/conversation/ws/subscribe?NS-TOKEN=${getToken()}`,
2003
- isLocalhost() ? "192.168.3.102" : ""
2004
- ),
2045
+ url: configState.services.websocketUrls?.[1],
2005
2046
  onMessage: chatStore.acceptMessage,
2006
2047
  clientHeartbeat: false,
2007
2048
  reconnectInterval: 1e4
@@ -2009,7 +2050,7 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2009
2050
  useEffect(() => {
2010
2051
  configState.hooks?.onBeforeInit?.();
2011
2052
  }, []);
2012
- return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames8(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2053
+ return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2013
2054
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2014
2055
  /* @__PURE__ */ jsxs(Flex, { className: "full-scroll", children: [
2015
2056
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2063,15 +2104,15 @@ var layouts_default = forwardRef(({ theme, params, userInfo, hooks, layout, conf
2063
2104
  }
2064
2105
  )
2065
2106
  ] }) }),
2066
- /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames8("height-full"), children: [
2107
+ /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames9("height-full"), children: [
2067
2108
  /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2068
- /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames8("full-scroll"), children: /* @__PURE__ */ jsxs(
2109
+ /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames9("full-scroll"), children: /* @__PURE__ */ jsxs(
2069
2110
  Flex,
2070
2111
  {
2071
2112
  justify: "center",
2072
2113
  vertical: true,
2073
2114
  gap: 24,
2074
- className: classNames8("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
2115
+ className: classNames9("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
2075
2116
  children: [
2076
2117
  shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
2077
2118
  /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [