@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.cjs.js CHANGED
@@ -7,13 +7,13 @@ var react = require('react');
7
7
  var valtio = require('valtio');
8
8
  var icons = require('@ant-design/icons');
9
9
  var x = require('@ant-design/x');
10
- var classNames8 = require('classnames');
10
+ var classNames9 = require('classnames');
11
11
  var dayjs = require('dayjs');
12
12
  var InfiniteScroll = require('react-infinite-scroll-component');
13
13
 
14
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
15
15
 
16
- var classNames8__default = /*#__PURE__*/_interopDefault(classNames8);
16
+ var classNames9__default = /*#__PURE__*/_interopDefault(classNames9);
17
17
  var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
18
18
  var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
19
19
 
@@ -282,6 +282,18 @@ var init_Think = __esm({
282
282
  };
283
283
  }
284
284
  });
285
+ var userInfoManager = common.createSecureManager({
286
+ key: "NS-USER",
287
+ aesKey: "((#II))"
288
+ });
289
+ var TOKEN_KEY = "NS-TOKEN";
290
+ var tokenManager = common.createTokenManager({
291
+ key: TOKEN_KEY
292
+ });
293
+ var redirectUrl = () => {
294
+ const path = localStorage.getItem("SIGNPATH");
295
+ common.emit("jumpLink", { url: `/uc${path || "/sign-in"}` });
296
+ };
285
297
  var classifyTime = (timestamp) => {
286
298
  const now = dayjs__default.default();
287
299
  const target = dayjs__default.default(timestamp);
@@ -302,6 +314,9 @@ var classifyTime = (timestamp) => {
302
314
  var replaceThinkTags = (str) => {
303
315
  return str.replace(/<think>/g, ":::alert type=think data={content:'").replace(/<\/think>/g, "'} :::");
304
316
  };
317
+ var getChatSocketUrl = (baseURL, params) => {
318
+ return common.buildUrlParams(params, common.getWebSocketUrl(`${baseURL}/lolr/conversation/ws/subscribe`), "comma");
319
+ };
305
320
 
306
321
  // src/services/index.ts
307
322
  var createChatService = (request) => {
@@ -421,8 +436,6 @@ var defaultExpertLayout = {
421
436
  globalHeader: false,
422
437
  chatHeader: {
423
438
  props: {
424
- title: true,
425
- closeBtn: false,
426
439
  newConversationBtn: false,
427
440
  agentCharacter: false,
428
441
  conversationListBtn: false
@@ -433,7 +446,10 @@ var defaultExpertLayout = {
433
446
  function createChatStore() {
434
447
  const config = valtio.proxy({
435
448
  services: {
436
- websocketBaseUrls: []
449
+ /** WebSocket地址 */
450
+ websocketUrls: ["", ""],
451
+ /** HTTP请求实例 */
452
+ request: {}
437
453
  },
438
454
  hooks: {},
439
455
  layout: {},
@@ -450,13 +466,37 @@ function createChatStore() {
450
466
  /** 聊天参数配置 */
451
467
  params: {}
452
468
  });
453
- const setServices = ({ baseUrl = "/api" } = {}) => {
454
- config.services.baseUrl = baseUrl;
455
- if (!config.services.websocketBaseUrls?.includes(baseUrl)) {
456
- config.services.websocketBaseUrls = [...config.services.websocketBaseUrls, baseUrl];
469
+ const setServices = ({ http, websocket } = {}) => {
470
+ const httpConfig = { baseURL: "/api", headers: { [TOKEN_KEY]: tokenManager.get() }, ...http?.config };
471
+ const request = common.createRequest(httpConfig);
472
+ if (config.hooks?.onRequestInterceptor) {
473
+ request.instance.interceptors.request.use(...config.hooks.onRequestInterceptor);
474
+ }
475
+ request.instance.interceptors.response.use(void 0, (err) => {
476
+ if (err?.response?.status === common.HttpStatus.UNAUTHORIZED) {
477
+ if (config.hooks.onRedirectLogin) {
478
+ config.hooks.onRedirectLogin();
479
+ } else {
480
+ redirectUrl();
481
+ }
482
+ }
483
+ return Promise.reject(err);
484
+ });
485
+ if (config.hooks?.onResponseInterceptor) {
486
+ request.instance.interceptors.response.use(...config.hooks.onResponseInterceptor);
487
+ }
488
+ config.services.request = { ...createChatService(request), ...createFileService(request), ...http?.request };
489
+ config.services.websocketUrls = ["", ""];
490
+ if (common.isArray(websocket?.baseURLs)) {
491
+ websocket.baseURLs.forEach((baseURL, index) => {
492
+ if (common.isString(baseURL)) {
493
+ config.services.websocketUrls[index] = getChatSocketUrl(baseURL, websocket?.params || httpConfig.headers);
494
+ }
495
+ });
496
+ } else {
497
+ const url = getChatSocketUrl(httpConfig.baseURL, websocket?.params || httpConfig.headers);
498
+ config.services.websocketUrls = [url, ""];
457
499
  }
458
- const request = common.createRequest(baseUrl);
459
- config.services.request = { ...createChatService(request), ...createFileService(request) };
460
500
  };
461
501
  const setPreview = (file = {}, isEdit = false) => {
462
502
  if (common.shouldRender(config.layout.preview)) {
@@ -483,14 +523,8 @@ function createChatStore() {
483
523
  config.hooks = hooks;
484
524
  };
485
525
  const setUserInfo = (userInfo) => {
486
- config.userInfo = common.transform(userInfo || common.getCurrentUser() || {}, {
487
- id: (userInfo2) => {
488
- return String(userInfo2["id"]);
489
- },
490
- name: "name",
491
- iconUrl: "avatar",
492
- description: "remark"
493
- });
526
+ config.userInfo = userInfo || userInfoManager.get() || {};
527
+ config.userInfo.id = String(config.userInfo.id || "");
494
528
  };
495
529
  const receiver = valtio.proxy({
496
530
  /** 当前激活的接收者信息(智能体或专家) */
@@ -942,9 +976,13 @@ function createChatStore() {
942
976
  messages[idx] = { ...msg, type: void 0 };
943
977
  conversation.messages[msg.conversationId].loading = false;
944
978
  };
945
- const acceptMessage = (newMessage) => {
979
+ const acceptMessage = async (newMessage) => {
946
980
  const conversationId = newMessage.data.conversationId;
947
981
  if (!conversation.messages[conversationId]?.message) return;
982
+ const canProceed = await config.hooks?.onBeforeAcceptMessage?.(newMessage.data);
983
+ if (canProceed === false) {
984
+ throw new Error("\u64CD\u4F5C\u88AB\u963B\u6B62");
985
+ }
948
986
  switch (newMessage.data.type) {
949
987
  case "TEXT_MESSAGE_START":
950
988
  startCallback(newMessage.data);
@@ -962,6 +1000,7 @@ function createChatStore() {
962
1000
  errCallback(newMessage.data);
963
1001
  break;
964
1002
  }
1003
+ config.hooks?.onAfterAcceptMessage?.(newMessage.data);
965
1004
  };
966
1005
  return {
967
1006
  /** 全局配置对象 */
@@ -1054,7 +1093,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
1054
1093
  x.Bubble,
1055
1094
  {
1056
1095
  placement,
1057
- className: classNames8__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1096
+ className: classNames9__default.default({ [styles_module_default2.loadingMessage]: message2.type }),
1058
1097
  content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderMarkdown, { content: replaceThinkTags(message2.msgContent), customComponents })
1059
1098
  }
1060
1099
  ),
@@ -1081,7 +1120,7 @@ var MessageRender_default = ({ message: message2, placement }) => {
1081
1120
  message2.quoteMsg?.id && /* @__PURE__ */ jsxRuntime.jsx(
1082
1121
  x.Bubble,
1083
1122
  {
1084
- className: classNames8__default.default(styles_module_default2.chatQuoteMsg),
1123
+ className: classNames9__default.default(styles_module_default2.chatQuoteMsg),
1085
1124
  placement,
1086
1125
  content: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
1087
1126
  message2.quoteMsg.msgContent && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { children: [
@@ -1143,7 +1182,55 @@ var styles_module_default3 = {
1143
1182
  nsAvatarListItemIconActive: "styles_module_nsAvatarListItemIconActive",
1144
1183
  nsAvatarListItemName: "styles_module_nsAvatarListItemName"
1145
1184
  };
1146
- var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, agent: true, other: true } }) => {
1185
+
1186
+ // src/ui/common/WelcomeItem.tsx
1187
+ init_Context();
1188
+ var WelcomeItem_default = ({ icon = true, title = true, description = true, prompts = true }) => {
1189
+ const chatStore = useChatStore();
1190
+ const receiverState = valtio.useSnapshot(chatStore.receiver);
1191
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { direction: "vertical", size: 16, className: styles_module_default3.chatWelcomeWrap, children: [
1192
+ /* @__PURE__ */ jsxRuntime.jsx(
1193
+ x.Welcome,
1194
+ {
1195
+ className: classNames9__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1196
+ variant: "borderless",
1197
+ icon: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: icon, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: receiverState.active.logo }) }),
1198
+ title: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}` }),
1199
+ description: /* @__PURE__ */ jsxRuntime.jsx(
1200
+ common.RenderWrapper,
1201
+ {
1202
+ control: description,
1203
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: receiverState.active.description || "" } })
1204
+ }
1205
+ )
1206
+ }
1207
+ ),
1208
+ receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1209
+ common.RenderWrapper,
1210
+ {
1211
+ control: prompts,
1212
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
1213
+ x.Prompts,
1214
+ {
1215
+ className: "m-t-16",
1216
+ wrap: true,
1217
+ items: [
1218
+ {
1219
+ key: "1",
1220
+ label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1221
+ children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1222
+ key: question,
1223
+ description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames9__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1224
+ }))
1225
+ }
1226
+ ]
1227
+ }
1228
+ )
1229
+ }
1230
+ )
1231
+ ] });
1232
+ };
1233
+ var BubbleListItems_default = ({ firstMessage = false, welcomeMessage = true, avatar = { user: false, agent: true, other: true } }) => {
1147
1234
  const chatStore = useChatStore();
1148
1235
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1149
1236
  const conversationState = valtio.useSnapshot(chatStore.conversation);
@@ -1183,44 +1270,16 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
1183
1270
  () => conversationState.messages[conversationState.active.id] || {},
1184
1271
  [conversationState.messages[conversationState.active.id]]
1185
1272
  );
1186
- const placeholderNode = react.useMemo(
1187
- () => [
1273
+ const welcomeMessageRecord = react.useMemo(() => {
1274
+ const isExist = common.shouldRender(welcomeMessage);
1275
+ return isExist ? [
1188
1276
  {
1189
1277
  key: "placeholder",
1190
- content: /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { direction: "vertical", size: 16, className: styles_module_default3.chatWelcomeWrap, children: [
1191
- /* @__PURE__ */ jsxRuntime.jsx(
1192
- x.Welcome,
1193
- {
1194
- className: classNames8__default.default(styles_module_default3.chatWelcome, "p-t-32"),
1195
- variant: "borderless",
1196
- icon: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: receiverState.active.logo }),
1197
- title: `\u4F60\u597D\uFF0C\u6211\u662F${receiverState.active.name || ""}`,
1198
- description: /* @__PURE__ */ jsxRuntime.jsx("div", { dangerouslySetInnerHTML: { __html: receiverState.active.description || "" } })
1199
- }
1200
- ),
1201
- receiverState.active.config?.recommendQuestions?.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1202
- x.Prompts,
1203
- {
1204
- className: "m-t-16",
1205
- wrap: true,
1206
- items: [
1207
- {
1208
- key: "1",
1209
- label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1210
- children: receiverState.active.config.recommendQuestions.map(({ question }) => ({
1211
- key: question,
1212
- description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames8__default.default(styles_module_default3.chatWelcomePrompts, "text-ellipsis"), children: question })
1213
- }))
1214
- }
1215
- ]
1216
- }
1217
- )
1218
- ] }),
1278
+ content: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: welcomeMessage, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(WelcomeItem_default, {}) }),
1219
1279
  variant: "borderless"
1220
1280
  }
1221
- ],
1222
- [receiverState.active]
1223
- );
1281
+ ] : [];
1282
+ }, [receiverState.active, welcomeMessage]);
1224
1283
  const questionList = react.useMemo(
1225
1284
  () => chatMessage?.questionList?.length ? [
1226
1285
  {
@@ -1300,17 +1359,13 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
1300
1359
  }, [firstMessage]);
1301
1360
  const bubbleListItems = react.useMemo(() => {
1302
1361
  const list = [];
1303
- if (firstMessageRecord.length > 0) {
1304
- list.push(...firstMessageRecord);
1305
- }
1306
- if (chatRecords.length > 0) {
1307
- list.push(...chatRecords, ...questionList);
1308
- }
1362
+ list.push(...firstMessageRecord);
1363
+ list.push(...chatRecords, ...questionList);
1309
1364
  if (list.length) {
1310
1365
  return list;
1311
1366
  }
1312
- return [...placeholderNode];
1313
- }, [chatRecords, questionList, placeholderNode, firstMessageRecord]);
1367
+ return [...welcomeMessageRecord];
1368
+ }, [chatRecords, questionList, welcomeMessageRecord, firstMessageRecord]);
1314
1369
  const listRef = react.useRef(null);
1315
1370
  const autoScrollRef = react.useRef(true);
1316
1371
  const handleScroll = (el) => {
@@ -1341,7 +1396,7 @@ var BubbleListItems_default = ({ firstMessage = false, avatar = { user: false, a
1341
1396
  autoScroll: false,
1342
1397
  ref: listRef,
1343
1398
  items: bubbleListItems,
1344
- className: classNames8__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1399
+ className: classNames9__default.default(styles_module_default3.nsBubbleList, "height-full", "scroll-fade-in", "zero-chat-bubbles"),
1345
1400
  onScroll: handleScroll
1346
1401
  },
1347
1402
  conversationState.active.id
@@ -1376,7 +1431,7 @@ var CharacterList_default = () => {
1376
1431
  /* @__PURE__ */ jsxRuntime.jsx(
1377
1432
  antd.Avatar,
1378
1433
  {
1379
- className: classNames8__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1434
+ className: classNames9__default.default(styles_module_default3.nsAvatarListItemIcon, "cursor-pointer", {
1380
1435
  [styles_module_default3.nsAvatarListItemIconActive]: activeCharacter.id === item.id
1381
1436
  }),
1382
1437
  size: 50,
@@ -1463,6 +1518,7 @@ var ConversationList_default = () => {
1463
1518
  };
1464
1519
  var ChatHeader_default = ({
1465
1520
  title = true,
1521
+ avatar = true,
1466
1522
  closeBtn = false,
1467
1523
  newConversationBtn = true,
1468
1524
  agentCharacter = true,
@@ -1471,18 +1527,10 @@ var ChatHeader_default = ({
1471
1527
  const chatStore = useChatStore();
1472
1528
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1473
1529
  const configState = valtio.useSnapshot(chatStore.config);
1474
- return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames8__default.default(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1530
+ return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", className: classNames9__default.default(styles_module_default3.nsChatHeader, "zero-chat-header"), children: [
1475
1531
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 4, align: "center", children: [
1476
- /* @__PURE__ */ jsxRuntime.jsx(
1477
- common.RenderWrapper,
1478
- {
1479
- control: title,
1480
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1481
- /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }),
1482
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name })
1483
- ] })
1484
- }
1485
- ),
1532
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: avatar, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: receiverState.active.logo, alt: receiverState.active.name }) }),
1533
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: title, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsChatTitle, children: receiverState.active.name }) }),
1486
1534
  " "
1487
1535
  ] }),
1488
1536
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Space, { size: 2, children: [
@@ -1781,7 +1829,7 @@ var SenderPromptsItems_default = () => {
1781
1829
  title: /* @__PURE__ */ jsxRuntime.jsx(
1782
1830
  "div",
1783
1831
  {
1784
- className: classNames8__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1832
+ className: classNames9__default.default(styles_module_default3.nsSenderListTitle, "text-ellipsis"),
1785
1833
  children: `${receiverState.active.name}\u5F00\u59CB\u5173\u6CE8${question.name}\u5185\u5BB9\uFF01`
1786
1834
  }
1787
1835
  ),
@@ -1910,7 +1958,7 @@ var ConversationListHeader_default = () => {
1910
1958
  type: "primary",
1911
1959
  shape: "round",
1912
1960
  onClick: () => chatStore.createConversation(),
1913
- className: classNames8__default.default("m-t-16"),
1961
+ className: classNames9__default.default("m-t-16"),
1914
1962
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
1915
1963
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
1916
1964
  }
@@ -1918,7 +1966,7 @@ var ConversationListHeader_default = () => {
1918
1966
  ] });
1919
1967
  };
1920
1968
  var ConversationListPanel_default = ({ header }) => {
1921
- return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames8__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
1969
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default("height-full", "zero-chat-conversations", styles_module_default3.nsConversationListPanel), children: [
1922
1970
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
1923
1971
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
1924
1972
  ] });
@@ -1937,6 +1985,18 @@ var styles_module_default4 = {
1937
1985
  var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout, config, services }, ref) => {
1938
1986
  const chatStore = react.useMemo(() => createChatStore(), []);
1939
1987
  const senderRef = react.useRef();
1988
+ react.useEffect(() => {
1989
+ chatStore.setHooks(hooks);
1990
+ }, [hooks]);
1991
+ react.useEffect(() => {
1992
+ chatStore.setUserInfo(userInfo);
1993
+ }, [userInfo]);
1994
+ react.useEffect(() => {
1995
+ chatStore.setLayout(layout, config?.receiverType);
1996
+ }, [layout, config?.receiverType]);
1997
+ react.useEffect(() => {
1998
+ chatStore.setParams(params);
1999
+ }, [params]);
1940
2000
  common.useDeepEffect(() => {
1941
2001
  chatStore.setServices(services);
1942
2002
  }, [services]);
@@ -1949,18 +2009,6 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
1949
2009
  chatStore.switchAgentConversation(config.receiverId, config.conversationStrategy);
1950
2010
  }
1951
2011
  }, [config]);
1952
- react.useEffect(() => {
1953
- chatStore.setUserInfo(userInfo);
1954
- }, [userInfo]);
1955
- react.useEffect(() => {
1956
- chatStore.setLayout(layout, config?.receiverType);
1957
- }, [layout, config?.receiverType]);
1958
- react.useEffect(() => {
1959
- chatStore.setParams(params);
1960
- }, [params]);
1961
- react.useEffect(() => {
1962
- chatStore.setHooks(hooks);
1963
- }, [hooks]);
1964
2012
  const receiverState = valtio.useSnapshot(chatStore.receiver);
1965
2013
  const configState = valtio.useSnapshot(chatStore.config);
1966
2014
  react.useImperativeHandle(
@@ -1996,19 +2044,13 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
1996
2044
  }
1997
2045
  }, [hasPreView]);
1998
2046
  common.useWebSocket({
1999
- url: configState.services.websocketBaseUrls?.[0] && common.getWebSocketUrl(
2000
- `${configState.services.websocketBaseUrls?.[0]}/lolr/conversation/ws/subscribe?NS-TOKEN=${common.getToken()}`,
2001
- common.isLocalhost() ? "192.168.3.102" : ""
2002
- ),
2047
+ url: configState.services.websocketUrls?.[0],
2003
2048
  onMessage: chatStore.acceptMessage,
2004
2049
  clientHeartbeat: false,
2005
2050
  reconnectInterval: 1e4
2006
2051
  });
2007
2052
  common.useWebSocket({
2008
- url: configState.services.websocketBaseUrls?.[1] && common.getWebSocketUrl(
2009
- `${configState.services.websocketBaseUrls?.[1]}/lolr/conversation/ws/subscribe?NS-TOKEN=${common.getToken()}`,
2010
- common.isLocalhost() ? "192.168.3.102" : ""
2011
- ),
2053
+ url: configState.services.websocketUrls?.[1],
2012
2054
  onMessage: chatStore.acceptMessage,
2013
2055
  clientHeartbeat: false,
2014
2056
  reconnectInterval: 1e4
@@ -2016,7 +2058,7 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2016
2058
  react.useEffect(() => {
2017
2059
  configState.hooks?.onBeforeInit?.();
2018
2060
  }, []);
2019
- return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames8__default.default(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2061
+ return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: receiverState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default(styles_module_default4.nsChatLayout, "zero-chat-layout", "height-full"), children: [
2020
2062
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: ChatHeader_default }),
2021
2063
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
2022
2064
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel }),
@@ -2070,15 +2112,15 @@ var layouts_default = react.forwardRef(({ theme, params, userInfo, hooks, layout
2070
2112
  }
2071
2113
  )
2072
2114
  ] }) }),
2073
- /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames8__default.default("height-full"), children: [
2115
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames9__default.default("height-full"), children: [
2074
2116
  /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: ChatHeader_default }),
2075
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames8__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2117
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames9__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(
2076
2118
  antd.Flex,
2077
2119
  {
2078
2120
  justify: "center",
2079
2121
  vertical: true,
2080
2122
  gap: 24,
2081
- className: classNames8__default.default("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
2123
+ className: classNames9__default.default("height-full", styles_module_default4.nsChatBody, "zero-chat-body", styles_module_default4.nsBodyWidth),
2082
2124
  children: [
2083
2125
  common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.messageList, DefaultComponent: BubbleListItems_default }) }),
2084
2126
  /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
@@ -2115,11 +2157,5 @@ exports.Attachments = Attachments_default;
2115
2157
  exports.ChatCopilot = layouts_default;
2116
2158
  exports.ChatSender = ChatSender_default;
2117
2159
  exports.MessageRender = MessageRender_default;
2118
- Object.keys(x).forEach(function (k) {
2119
- if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
2120
- enumerable: true,
2121
- get: function () { return x[k]; }
2122
- });
2123
- });
2124
2160
  //# sourceMappingURL=index.cjs.js.map
2125
2161
  //# sourceMappingURL=index.cjs.js.map