@zero-library/chat-agent 2.0.6 → 2.0.8

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,11 +1,11 @@
1
- import { useRefState, useDebounce, isNumber, useSyncInput, shouldRender, RenderWrapper, downloadFile, FilePreview, MarkdownEditor, createValtioContext, isObject, isNullOrUnDef, isBoolean, UserAvatar, request as request$1, getCurrentUser, deepMerge, RenderMarkdown, OK, getToken, TOKEN_KEY, copyText, FileIcon, isExternal } from '@zero-library/common';
2
- import { message, Badge, Button, Flex, Spin, Splitter, Tag, Avatar, Empty, Space, Popover, List, Typography, Collapse, Drawer } from 'antd';
1
+ import { useRefState, useDebounce, isNumber, useSyncInput, shouldRender, RenderWrapper, downloadFile, FilePreview, MarkdownEditor, createValtioContext, isObject, isNullOrUnDef, isBoolean, UserAvatar, request, getCurrentUser, deepMerge, RenderMarkdown, OK, getToken, TOKEN_KEY, copyText, FileIcon, isExternal } from '@zero-library/common';
2
+ import { message, Badge, Button, Flex, Spin, Splitter, Tag, Avatar, Space, Popover, List, Typography, Empty, Collapse, Drawer } from 'antd';
3
3
  import dayjs from 'dayjs';
4
4
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
5
5
  import { forwardRef, useRef, useEffect, useImperativeHandle, useMemo, useState } from 'react';
6
- import { CloudUploadOutlined, PaperClipOutlined, CloseOutlined, PlusOutlined, DeleteOutlined, RedoOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, EnterOutlined, CloseCircleOutlined, PlayCircleOutlined, CaretRightOutlined } from '@ant-design/icons';
7
- import { Attachments, Sender, Suggestion, XProvider, Conversations, Welcome, Prompts, Bubble } from '@ant-design/x';
8
- import classNames5 from 'classnames';
6
+ import { CloudUploadOutlined, PaperClipOutlined, CloseOutlined, PlusOutlined, CommentOutlined, OpenAIOutlined, CopyOutlined, LikeOutlined, DislikeOutlined, EnterOutlined, DeleteOutlined, RedoOutlined, CloseCircleOutlined, PlayCircleOutlined, CaretRightOutlined } from '@ant-design/icons';
7
+ import { Attachments, Sender, Suggestion, XProvider, Welcome, Prompts, Bubble, Conversations } from '@ant-design/x';
8
+ import classNames6 from 'classnames';
9
9
  import { useSnapshot, proxy } from 'valtio';
10
10
  import InfiniteScroll from 'react-infinite-scroll-component';
11
11
 
@@ -18,6 +18,19 @@ var __export = (target, all) => {
18
18
  for (var name in all)
19
19
  __defProp(target, name, { get: all[name], enumerable: true });
20
20
  };
21
+ var docQuery, fileCreate;
22
+ var init_file = __esm({
23
+ "src/services/file.ts"() {
24
+ docQuery = (paramsStr) => {
25
+ return request.get(`/uc/doc?${paramsStr}`);
26
+ };
27
+ fileCreate = async (fileContent, fileName, targetFormat = "docx") => {
28
+ const blob = await request.post(`/uc/doc/convert`, { fileContent, fileName, targetFormat }, { responseType: "blob" });
29
+ const url = URL.createObjectURL(blob);
30
+ downloadFile(url, fileName);
31
+ };
32
+ }
33
+ });
21
34
  function transform(source, fieldMap) {
22
35
  const result = {};
23
36
  for (const [targetKey, mapping] of Object.entries(fieldMap)) {
@@ -144,14 +157,6 @@ var init_FileView = __esm({
144
157
  };
145
158
  }
146
159
  });
147
- var docQuery;
148
- var init_file = __esm({
149
- "src/services/file.ts"() {
150
- docQuery = (paramsStr) => {
151
- return request$1.get(`/uc/doc?${paramsStr}`);
152
- };
153
- }
154
- });
155
160
  var DocDrawer_default;
156
161
  var init_DocDrawer = __esm({
157
162
  "src/ui/common/markdownAlert/components/DocDrawer.tsx"() {
@@ -309,6 +314,9 @@ var init_QuoteList = __esm({
309
314
  }
310
315
  });
311
316
 
317
+ // src/ui/layouts/index.tsx
318
+ init_file();
319
+
312
320
  // src/core/constants.ts
313
321
  var DEFAULT_NEW_CONV_ID = "newConvId";
314
322
  var ChatRoleMap = {
@@ -384,7 +392,7 @@ async function handleStreamResponse(response, options) {
384
392
  buffer = parseBuffer(buffer, onChunk);
385
393
  }
386
394
  }
387
- async function request(url, data = {}, options = {}) {
395
+ async function request2(url, data = {}, options = {}) {
388
396
  const { stream = false, method = "POST", headers = {}, signal } = options;
389
397
  const controller = new AbortController();
390
398
  signal?.addEventListener("abort", () => controller.abort());
@@ -421,36 +429,36 @@ async function request(url, data = {}, options = {}) {
421
429
  }
422
430
  return r;
423
431
  }
424
- var get = (url, params = {}, options = {}) => request(url, params, { ...options, method: "GET" });
425
- var post = (url, data = {}, options = {}) => request(url, data, { ...options, method: "POST" });
426
- var put = (url, data = {}, options = {}) => request(url, data, { ...options, method: "PUT" });
427
- var del = (url, data = {}, options = {}) => request(url, data, { ...options, method: "DELETE" });
432
+ var get = (url, params = {}, options = {}) => request2(url, params, { ...options, method: "GET" });
433
+ var post = (url, data = {}, options = {}) => request2(url, data, { ...options, method: "POST" });
434
+ var put = (url, data = {}, options = {}) => request2(url, data, { ...options, method: "PUT" });
435
+ var del = (url, data = {}, options = {}) => request2(url, data, { ...options, method: "DELETE" });
428
436
  var fetchRequest_default = { delete: del, get, post, put };
429
437
 
430
438
  // src/services/index.ts
431
439
  var agentInfoQuery = (agentId) => {
432
- return request$1.get("/agent/detail", { agentId });
440
+ return request.get("/agent/detail", { agentId });
433
441
  };
434
442
  var agentsQuery = () => {
435
- return request$1.get("/agent");
443
+ return request.get("/agent");
436
444
  };
437
445
  var conversationsQuery = (params) => {
438
- return request$1.get("/agent/conversation", params);
446
+ return request.get("/agent/conversation", params);
439
447
  };
440
448
  var deleteConversation = (params) => {
441
- return request$1.delete("/agent/conversation", params);
449
+ return request.delete("/agent/conversation", params);
442
450
  };
443
451
  var chatMessagesQuery = (params) => {
444
- return request$1.get("/agent/message", params);
452
+ return request.get("/agent/message", params);
445
453
  };
446
454
  var chatMessageSuggestedQuery = (agentId, messageId) => {
447
- return request$1.get("/agent/message/suggested", { agentId, messageId });
455
+ return request.get("/agent/message/suggested", { agentId, messageId });
448
456
  };
449
457
  var updateFeedback = (params) => {
450
- return request$1.put("/agent/message/feedback", params);
458
+ return request.put("/agent/message/feedback", params);
451
459
  };
452
460
  var uploadFile = (formData) => {
453
- return request$1.post("/agent/file", formData);
461
+ return request.post("/agent/file", formData);
454
462
  };
455
463
  var sendChatMessage = (params) => {
456
464
  return fetchRequest_default.post(
@@ -470,21 +478,16 @@ var sendChatMessage = (params) => {
470
478
 
471
479
  // src/stores/index.ts
472
480
  var defaultLayout = {
481
+ leftPanel: false,
473
482
  conversationList: true,
474
- conversationListHeader: true,
475
483
  preview: true,
476
484
  messageList: true,
477
485
  senderHeader: false,
478
486
  sender: true,
479
487
  senderPrompts: true,
480
488
  senderFooter: false,
481
- senderExtraBtn: false,
482
- referencesBtn: false,
483
- header: true,
484
- headerTitle: true,
485
- headerConversationListBtn: true,
486
- headerNewConversationBtn: true,
487
- headerCloseBtn: false,
489
+ globalHeader: false,
490
+ chatHeader: true,
488
491
  disclaimerNotice: true
489
492
  };
490
493
  function createChatStore() {
@@ -647,11 +650,12 @@ function createChatStore() {
647
650
  const canProceed = await config.hooks?.onBeforeSwitchConversation?.(chatKey, isNew);
648
651
  if (canProceed === false) return;
649
652
  conversation.active = chat?.key ? chat : { key: chatKey };
653
+ setPreview();
650
654
  if (!conversation.messages[chatKey]) {
651
655
  setInitMessage(chatKey);
652
656
  }
653
657
  config.hooks?.onAfterSwitchConversation?.(chatKey, isNew);
654
- if (!chatKey.endsWith(DEFAULT_NEW_CONV_ID) && conversation.messages[chatKey].message.items.length === 0) {
658
+ if (!isNew && conversation.messages[chatKey].message.items.length === 0) {
655
659
  getMessages(agent.active.id, chatKey);
656
660
  }
657
661
  };
@@ -879,6 +883,7 @@ init_Context();
879
883
  // src/ui/common/styles.module.less
880
884
  var styles_module_default = {
881
885
  loadingMessage: "styles_module_loadingMessage",
886
+ conversationListPanel: "styles_module_conversationListPanel",
882
887
  nsConversations: "styles_module_nsConversations",
883
888
  nsBodyWidth: "styles_module_nsBodyWidth",
884
889
  nsBubbleList: "styles_module_nsBubbleList",
@@ -945,7 +950,7 @@ var ConversationList_default = () => {
945
950
  }
946
951
  ) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
947
952
  };
948
- var AgentHeader_default = () => {
953
+ var AgentHeader_default = ({ title = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true }) => {
949
954
  const chatStore = useChatStore();
950
955
  const agentState = useSnapshot(chatStore.agent);
951
956
  const configState = useSnapshot(chatStore.config);
@@ -954,7 +959,7 @@ var AgentHeader_default = () => {
954
959
  /* @__PURE__ */ jsx(
955
960
  RenderWrapper,
956
961
  {
957
- control: configState.layout.headerTitle,
962
+ control: title,
958
963
  DefaultComponent: /* @__PURE__ */ jsxs(Fragment, { children: [
959
964
  /* @__PURE__ */ jsx(Avatar, { size: 22, src: agentState.active.iconUrl, alt: agentState.active.name }),
960
965
  /* @__PURE__ */ jsx("div", { className: styles_module_default.nsChatTitle, children: agentState.active.name })
@@ -967,14 +972,14 @@ var AgentHeader_default = () => {
967
972
  /* @__PURE__ */ jsx(
968
973
  RenderWrapper,
969
974
  {
970
- control: configState.layout.headerNewConversationBtn,
975
+ control: newConversationBtn,
971
976
  DefaultComponent: /* @__PURE__ */ jsx(Button, { type: "text", size: "large", icon: /* @__PURE__ */ jsx(PlusOutlined, {}), onClick: () => chatStore.switchConversation() })
972
977
  }
973
978
  ),
974
979
  /* @__PURE__ */ jsx(
975
980
  RenderWrapper,
976
981
  {
977
- control: configState.layout.headerConversationListBtn,
982
+ control: conversationListBtn,
978
983
  DefaultComponent: /* @__PURE__ */ jsx(
979
984
  Popover,
980
985
  {
@@ -991,7 +996,7 @@ var AgentHeader_default = () => {
991
996
  /* @__PURE__ */ jsx(
992
997
  RenderWrapper,
993
998
  {
994
- control: configState.layout.headerCloseBtn,
999
+ control: closeBtn,
995
1000
  DefaultComponent: /* @__PURE__ */ jsx(Button, { type: "text", size: "large", onClick: configState.hooks?.onHeaderClose, icon: /* @__PURE__ */ jsx(CloseOutlined, {}) })
996
1001
  }
997
1002
  )
@@ -1075,7 +1080,7 @@ var MessageAIRender_default = ({ message: message4, placement }) => {
1075
1080
  Bubble,
1076
1081
  {
1077
1082
  placement,
1078
- className: classNames5({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1083
+ className: classNames6({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1079
1084
  content: /* @__PURE__ */ jsxs(Fragment, { children: [
1080
1085
  thinkContents.length > 0 && /* @__PURE__ */ jsx(
1081
1086
  Collapse,
@@ -1135,7 +1140,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1135
1140
  /* @__PURE__ */ jsx(
1136
1141
  Welcome,
1137
1142
  {
1138
- className: classNames5(styles_module_default.chatWelcome, "p-t-32"),
1143
+ className: classNames6(styles_module_default.chatWelcome, "p-t-32"),
1139
1144
  variant: "borderless",
1140
1145
  icon: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: agentState.active.iconUrl }),
1141
1146
  title: `\u4F60\u597D\uFF0C\u6211\u662F${agentState.active.name || ""}`,
@@ -1153,7 +1158,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1153
1158
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1154
1159
  children: agentState.active.recommendQuestions.map(({ question, id }) => ({
1155
1160
  key: id,
1156
- description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames5(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1161
+ description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames6(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1157
1162
  }))
1158
1163
  }
1159
1164
  ]
@@ -1242,17 +1247,37 @@ var BubbleListItems_default = ({ avatar = true }) => {
1242
1247
  return [...placeholderNode];
1243
1248
  }, [chatRecords, questionList, placeholderNode]);
1244
1249
  const listRef = useRef(null);
1250
+ const autoScrollRef = useRef(true);
1251
+ const handleScroll = (el) => {
1252
+ const target = el.target;
1253
+ const distanceToBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
1254
+ autoScrollRef.current = distanceToBottom < 100;
1255
+ };
1245
1256
  useEffect(() => {
1246
- if (bubbleListItems.length && (listRef.current?.nativeElement.scrollHeight ?? 0) - ((listRef.current?.nativeElement.scrollTop ?? 0) + (listRef.current?.nativeElement.clientHeight ?? 0)) < 100) {
1247
- listRef.current?.scrollTo({ key: bubbleListItems[bubbleListItems.length - 1].key, block: "end" });
1257
+ autoScrollRef.current = true;
1258
+ }, [bubbleListItems.length]);
1259
+ useEffect(() => {
1260
+ const el = listRef.current?.nativeElement;
1261
+ if (!el || !bubbleListItems.length) return;
1262
+ if (autoScrollRef.current) {
1263
+ setTimeout(() => {
1264
+ if (autoScrollRef.current) {
1265
+ listRef.current?.scrollTo({
1266
+ key: bubbleListItems[bubbleListItems.length - 1].key,
1267
+ block: "end"
1268
+ });
1269
+ }
1270
+ }, 100);
1248
1271
  }
1249
1272
  }, [bubbleListItems]);
1250
1273
  return /* @__PURE__ */ jsx(
1251
1274
  Bubble.List,
1252
1275
  {
1276
+ autoScroll: false,
1253
1277
  ref: listRef,
1254
1278
  items: bubbleListItems,
1255
- className: classNames5(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in")
1279
+ className: classNames6(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in"),
1280
+ onScroll: handleScroll
1256
1281
  },
1257
1282
  conversationState.active.key
1258
1283
  );
@@ -1507,11 +1532,10 @@ var ChatSender_default = forwardRef(
1507
1532
 
1508
1533
  // src/ui/common/ChatSender.tsx
1509
1534
  init_Context();
1510
- var ChatSender_default2 = () => {
1535
+ var ChatSender_default2 = ({ placeholder, extraBtn = false, referencesBtn = false }) => {
1511
1536
  const chatStore = useChatStore();
1512
1537
  const agentState = useSnapshot(chatStore.agent);
1513
1538
  const conversationState = useSnapshot(chatStore.conversation);
1514
- const configState = useSnapshot(chatStore.config);
1515
1539
  const chatMessage = useMemo(
1516
1540
  () => conversationState.messages[conversationState.active.key] || {},
1517
1541
  [conversationState.messages[conversationState.active.key]]
@@ -1526,7 +1550,7 @@ var ChatSender_default2 = () => {
1526
1550
  return /* @__PURE__ */ jsx(
1527
1551
  ChatSender_default,
1528
1552
  {
1529
- placeholder: configState.layout.sender?.props?.placeholder,
1553
+ placeholder,
1530
1554
  content: chatMessage.content,
1531
1555
  fileList: chatMessage.files,
1532
1556
  headerOpen: chatMessage.headerOpen,
@@ -1551,7 +1575,7 @@ var ChatSender_default2 = () => {
1551
1575
  children: "\u6DF1\u5EA6\u601D\u8003"
1552
1576
  }
1553
1577
  ),
1554
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderExtraBtn })
1578
+ /* @__PURE__ */ jsx(RenderWrapper, { control: extraBtn })
1555
1579
  ] }),
1556
1580
  extraHeader: /* @__PURE__ */ jsx(
1557
1581
  Sender.Header,
@@ -1564,12 +1588,12 @@ var ChatSender_default2 = () => {
1564
1588
  onOpenChange: () => chatStore.setReferences(),
1565
1589
  classNames: {
1566
1590
  header: styles_module_default.nsSenderReferenceHeaderTitle,
1567
- content: shouldRender(configState.layout.referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1591
+ content: shouldRender(referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1568
1592
  },
1569
1593
  children: /* @__PURE__ */ jsx(
1570
1594
  RenderWrapper,
1571
1595
  {
1572
- control: configState.layout.referencesBtn,
1596
+ control: referencesBtn,
1573
1597
  DefaultComponent: /* @__PURE__ */ jsx(Flex, { gap: 8, children: ["\u6DF1\u5EA6\u89E3\u8BFB", "\u6982\u8981\u89E3\u8BFB"].map((con) => /* @__PURE__ */ jsxs(Button, { color: "primary", variant: "filled", onClick: () => referenceHandle(con), children: [
1574
1598
  con,
1575
1599
  " \u2192"
@@ -1599,13 +1623,19 @@ var ConversationListHeader_default = () => {
1599
1623
  type: "primary",
1600
1624
  shape: "round",
1601
1625
  onClick: () => chatStore.switchConversation(),
1602
- className: classNames5("m-t-16"),
1626
+ className: classNames6("m-t-16"),
1603
1627
  icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
1604
1628
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
1605
1629
  }
1606
1630
  )
1607
1631
  ] });
1608
1632
  };
1633
+ var ConversationListPanel_default = ({ header }) => {
1634
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames6("height-full", styles_module_default.conversationListPanel), children: [
1635
+ /* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
1636
+ /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
1637
+ ] });
1638
+ };
1609
1639
 
1610
1640
  // src/ui/common/SenderPromptsItems.tsx
1611
1641
  init_Context();
@@ -1632,7 +1662,7 @@ var SenderPromptsItems_default = () => {
1632
1662
  title: /* @__PURE__ */ jsx(
1633
1663
  "div",
1634
1664
  {
1635
- className: classNames5(styles_module_default.senderListTitle, "text-ellipsis"),
1665
+ className: classNames6(styles_module_default.senderListTitle, "text-ellipsis"),
1636
1666
  children: `${agentState.active.name}\u5F00\u59CB\u5173\u6CE8${question.labelName}\u5185\u5BB9\uFF01`
1637
1667
  }
1638
1668
  ),
@@ -1687,117 +1717,117 @@ var layouts_default = forwardRef(({ theme, params, hooks, layout, defaultAgent }
1687
1717
  }),
1688
1718
  []
1689
1719
  );
1690
- const setSplitterSizes = (sizes) => {
1691
- console.log(sizes);
1692
- };
1693
1720
  const hasPreView = useMemo(() => {
1694
1721
  return shouldRender(configState.layout.preview) && (!!configState.preview.file.fileUrl || !!configState.preview.file.content);
1695
1722
  }, [configState.layout.preview, configState.preview.file]);
1696
- return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: agentState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsx("div", { className: classNames5(styles_module_default3.nsChatLayout, "height-full"), children: /* @__PURE__ */ jsxs(Splitter, { onResize: setSplitterSizes, children: [
1697
- shouldRender(configState.layout.conversationList) && /* @__PURE__ */ jsx(Splitter.Panel, { size: 360, collapsible: false, resizable: false, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
1698
- /* @__PURE__ */ jsx(
1699
- RenderWrapper,
1700
- {
1701
- control: configState.layout.conversationListHeader,
1702
- DefaultComponent: ConversationListHeader_default
1703
- }
1704
- ),
1705
- /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1706
- RenderWrapper,
1707
- {
1708
- control: configState.layout.conversationList,
1709
- DefaultComponent: ConversationList_default
1710
- }
1711
- ) })
1712
- ] }) }),
1713
- hasPreView && /* @__PURE__ */ jsxs(Splitter.Panel, { collapsible: false, resizable: false, children: [
1714
- configState.preview.file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
1715
- /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1716
- /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1717
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
1718
- /* @__PURE__ */ jsx(
1719
- Button,
1723
+ const [sizes, setSizes] = useState([0, "100%"]);
1724
+ const setSplitterSizes = (sizes2) => {
1725
+ setSizes(sizes2);
1726
+ };
1727
+ useEffect(() => {
1728
+ if (hasPreView) {
1729
+ setSplitterSizes(["70%", "30%"]);
1730
+ } else {
1731
+ setSplitterSizes([0, "100%"]);
1732
+ }
1733
+ }, [hasPreView]);
1734
+ return /* @__PURE__ */ jsx(XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsx(Spin, { spinning: agentState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames6(styles_module_default3.nsChatLayout, "height-full"), children: [
1735
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: AgentHeader_default }),
1736
+ /* @__PURE__ */ jsxs(Flex, { className: "full-scroll", children: [
1737
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel, DefaultComponent: /* @__PURE__ */ jsx(Fragment, {}) }),
1738
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
1739
+ /* @__PURE__ */ jsxs(Splitter, { className: "flex-1", onResize: setSplitterSizes, children: [
1740
+ /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxs(Fragment, { children: [
1741
+ configState.preview.file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
1742
+ /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1743
+ /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1744
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
1745
+ /* @__PURE__ */ jsx(
1746
+ Button,
1747
+ {
1748
+ color: "primary",
1749
+ variant: "outlined",
1750
+ onClick: () => downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1751
+ children: "\u4E0B\u8F7D"
1752
+ }
1753
+ ),
1754
+ /* @__PURE__ */ jsx(Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1755
+ ] })
1756
+ ] }),
1757
+ /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1758
+ FilePreview,
1720
1759
  {
1721
- color: "primary",
1722
- variant: "outlined",
1723
- onClick: () => downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1724
- children: "\u4E0B\u8F7D"
1725
- }
1726
- ),
1727
- /* @__PURE__ */ jsx(Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1728
- ] })
1729
- ] }),
1730
- /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1731
- FilePreview,
1732
- {
1733
- ...configState.preview.file,
1734
- pdfParams: {
1735
- isHasThumbnails: false
1736
- }
1737
- }
1738
- ) })
1739
- ] }),
1740
- configState.preview.file.content && /* @__PURE__ */ jsx(
1741
- MarkdownEditor,
1742
- {
1743
- value: configState.preview.file.content,
1744
- onQuote: (text) => {
1745
- chatStore.setReferences({
1746
- type: 1,
1747
- content: {
1748
- name: text,
1749
- markdown: text
1750
- },
1751
- params: {
1752
- outline: text
1760
+ ...configState.preview.file,
1761
+ pdfParams: {
1762
+ isHasThumbnails: false
1763
+ }
1753
1764
  }
1754
- });
1755
- },
1756
- extraNav: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: () => chatStore.setPreview(), children: /* @__PURE__ */ jsx(CloseOutlined, {}) }) })
1757
- }
1758
- )
1759
- ] }),
1760
- /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, resizable: false, size: hasPreView ? 400 : void 0, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames5("height-full"), children: [
1761
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.header, DefaultComponent: AgentHeader_default }),
1762
- /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames5("full-scroll"), children: /* @__PURE__ */ jsxs(Flex, { justify: "center", vertical: true, gap: 24, className: classNames5("height-full p-t-8 p-b-8", styles_module_default.nsBodyWidth), children: [
1763
- shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1764
- RenderWrapper,
1765
- {
1766
- control: configState.layout.messageList,
1767
- DefaultComponent: /* @__PURE__ */ jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1768
- }
1769
- ) }),
1770
- /* @__PURE__ */ jsx(
1771
- RenderWrapper,
1772
- {
1773
- control: configState.layout.senderHeader,
1774
- DefaultComponent: /* @__PURE__ */ jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1775
- "\u6211\u662F ",
1776
- agentState.active.name
1777
- ] })
1778
- }
1779
- ),
1780
- /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
1781
- /* @__PURE__ */ jsx(
1782
- RenderWrapper,
1783
- {
1784
- control: configState.layout.senderPrompts,
1785
- DefaultComponent: SenderPromptsItems_default
1786
- }
1787
- ),
1788
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1789
- /* @__PURE__ */ jsx(
1790
- RenderWrapper,
1765
+ ) })
1766
+ ] }),
1767
+ configState.preview.file.content && /* @__PURE__ */ jsx(
1768
+ MarkdownEditor,
1791
1769
  {
1792
- control: configState.layout.disclaimerNotice,
1793
- DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
1770
+ value: configState.preview.file.content,
1771
+ onQuote: (text) => {
1772
+ chatStore.setReferences({
1773
+ type: 1,
1774
+ content: {
1775
+ name: text,
1776
+ markdown: text
1777
+ },
1778
+ params: {
1779
+ outline: text
1780
+ }
1781
+ });
1782
+ },
1783
+ onDownloadFile: (content, type) => fileCreate(content, configState.preview.file.fileName, type),
1784
+ extraNav: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: () => chatStore.setPreview(), children: /* @__PURE__ */ jsx(CloseOutlined, {}) }) })
1794
1785
  }
1795
1786
  )
1796
- ] }),
1797
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsx(Fragment, {}) })
1798
- ] }) })
1799
- ] }) })
1800
- ] }) }) }) }) });
1787
+ ] }) }),
1788
+ /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames6("height-full"), children: [
1789
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: AgentHeader_default }),
1790
+ /* @__PURE__ */ jsx(Flex, { vertical: true, className: classNames6("full-scroll"), children: /* @__PURE__ */ jsxs(Flex, { justify: "center", vertical: true, gap: 24, className: classNames6("height-full p-t-8 p-b-8", styles_module_default.nsBodyWidth), children: [
1791
+ shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1792
+ RenderWrapper,
1793
+ {
1794
+ control: configState.layout.messageList,
1795
+ DefaultComponent: /* @__PURE__ */ jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1796
+ }
1797
+ ) }),
1798
+ /* @__PURE__ */ jsx(
1799
+ RenderWrapper,
1800
+ {
1801
+ control: configState.layout.senderHeader,
1802
+ DefaultComponent: /* @__PURE__ */ jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1803
+ "\u6211\u662F ",
1804
+ agentState.active.name
1805
+ ] })
1806
+ }
1807
+ ),
1808
+ /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
1809
+ /* @__PURE__ */ jsx(
1810
+ RenderWrapper,
1811
+ {
1812
+ control: configState.layout.senderPrompts,
1813
+ DefaultComponent: SenderPromptsItems_default
1814
+ }
1815
+ ),
1816
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1817
+ /* @__PURE__ */ jsx(
1818
+ RenderWrapper,
1819
+ {
1820
+ control: configState.layout.disclaimerNotice,
1821
+ DefaultComponent: /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
1822
+ }
1823
+ )
1824
+ ] }),
1825
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsx(Fragment, {}) })
1826
+ ] }) })
1827
+ ] }) })
1828
+ ] })
1829
+ ] })
1830
+ ] }) }) }) });
1801
1831
  });
1802
1832
 
1803
1833
  export { layouts_default as AgentChat };