@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.cjs.js CHANGED
@@ -7,14 +7,14 @@ var jsxRuntime = require('react/jsx-runtime');
7
7
  var react = require('react');
8
8
  var icons = require('@ant-design/icons');
9
9
  var x = require('@ant-design/x');
10
- var classNames5 = require('classnames');
10
+ var classNames6 = require('classnames');
11
11
  var valtio = require('valtio');
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
16
  var dayjs__default = /*#__PURE__*/_interopDefault(dayjs);
17
- var classNames5__default = /*#__PURE__*/_interopDefault(classNames5);
17
+ var classNames6__default = /*#__PURE__*/_interopDefault(classNames6);
18
18
  var InfiniteScroll__default = /*#__PURE__*/_interopDefault(InfiniteScroll);
19
19
 
20
20
  var __defProp = Object.defineProperty;
@@ -26,6 +26,19 @@ var __export = (target, all) => {
26
26
  for (var name in all)
27
27
  __defProp(target, name, { get: all[name], enumerable: true });
28
28
  };
29
+ var docQuery, fileCreate;
30
+ var init_file = __esm({
31
+ "src/services/file.ts"() {
32
+ docQuery = (paramsStr) => {
33
+ return common.request.get(`/uc/doc?${paramsStr}`);
34
+ };
35
+ fileCreate = async (fileContent, fileName, targetFormat = "docx") => {
36
+ const blob = await common.request.post(`/uc/doc/convert`, { fileContent, fileName, targetFormat }, { responseType: "blob" });
37
+ const url = URL.createObjectURL(blob);
38
+ common.downloadFile(url, fileName);
39
+ };
40
+ }
41
+ });
29
42
  function transform(source, fieldMap) {
30
43
  const result = {};
31
44
  for (const [targetKey, mapping] of Object.entries(fieldMap)) {
@@ -152,14 +165,6 @@ var init_FileView = __esm({
152
165
  };
153
166
  }
154
167
  });
155
- var docQuery;
156
- var init_file = __esm({
157
- "src/services/file.ts"() {
158
- docQuery = (paramsStr) => {
159
- return common.request.get(`/uc/doc?${paramsStr}`);
160
- };
161
- }
162
- });
163
168
  var DocDrawer_default;
164
169
  var init_DocDrawer = __esm({
165
170
  "src/ui/common/markdownAlert/components/DocDrawer.tsx"() {
@@ -317,6 +322,9 @@ var init_QuoteList = __esm({
317
322
  }
318
323
  });
319
324
 
325
+ // src/ui/layouts/index.tsx
326
+ init_file();
327
+
320
328
  // src/core/constants.ts
321
329
  var DEFAULT_NEW_CONV_ID = "newConvId";
322
330
  var ChatRoleMap = {
@@ -392,7 +400,7 @@ async function handleStreamResponse(response, options) {
392
400
  buffer = parseBuffer(buffer, onChunk);
393
401
  }
394
402
  }
395
- async function request(url, data = {}, options = {}) {
403
+ async function request2(url, data = {}, options = {}) {
396
404
  const { stream = false, method = "POST", headers = {}, signal } = options;
397
405
  const controller = new AbortController();
398
406
  signal?.addEventListener("abort", () => controller.abort());
@@ -429,10 +437,10 @@ async function request(url, data = {}, options = {}) {
429
437
  }
430
438
  return r;
431
439
  }
432
- var get = (url, params = {}, options = {}) => request(url, params, { ...options, method: "GET" });
433
- var post = (url, data = {}, options = {}) => request(url, data, { ...options, method: "POST" });
434
- var put = (url, data = {}, options = {}) => request(url, data, { ...options, method: "PUT" });
435
- var del = (url, data = {}, options = {}) => request(url, data, { ...options, method: "DELETE" });
440
+ var get = (url, params = {}, options = {}) => request2(url, params, { ...options, method: "GET" });
441
+ var post = (url, data = {}, options = {}) => request2(url, data, { ...options, method: "POST" });
442
+ var put = (url, data = {}, options = {}) => request2(url, data, { ...options, method: "PUT" });
443
+ var del = (url, data = {}, options = {}) => request2(url, data, { ...options, method: "DELETE" });
436
444
  var fetchRequest_default = { delete: del, get, post, put };
437
445
 
438
446
  // src/services/index.ts
@@ -478,21 +486,16 @@ var sendChatMessage = (params) => {
478
486
 
479
487
  // src/stores/index.ts
480
488
  var defaultLayout = {
489
+ leftPanel: false,
481
490
  conversationList: true,
482
- conversationListHeader: true,
483
491
  preview: true,
484
492
  messageList: true,
485
493
  senderHeader: false,
486
494
  sender: true,
487
495
  senderPrompts: true,
488
496
  senderFooter: false,
489
- senderExtraBtn: false,
490
- referencesBtn: false,
491
- header: true,
492
- headerTitle: true,
493
- headerConversationListBtn: true,
494
- headerNewConversationBtn: true,
495
- headerCloseBtn: false,
497
+ globalHeader: false,
498
+ chatHeader: true,
496
499
  disclaimerNotice: true
497
500
  };
498
501
  function createChatStore() {
@@ -655,11 +658,12 @@ function createChatStore() {
655
658
  const canProceed = await config.hooks?.onBeforeSwitchConversation?.(chatKey, isNew);
656
659
  if (canProceed === false) return;
657
660
  conversation.active = chat?.key ? chat : { key: chatKey };
661
+ setPreview();
658
662
  if (!conversation.messages[chatKey]) {
659
663
  setInitMessage(chatKey);
660
664
  }
661
665
  config.hooks?.onAfterSwitchConversation?.(chatKey, isNew);
662
- if (!chatKey.endsWith(DEFAULT_NEW_CONV_ID) && conversation.messages[chatKey].message.items.length === 0) {
666
+ if (!isNew && conversation.messages[chatKey].message.items.length === 0) {
663
667
  getMessages(agent.active.id, chatKey);
664
668
  }
665
669
  };
@@ -887,6 +891,7 @@ init_Context();
887
891
  // src/ui/common/styles.module.less
888
892
  var styles_module_default = {
889
893
  loadingMessage: "styles_module_loadingMessage",
894
+ conversationListPanel: "styles_module_conversationListPanel",
890
895
  nsConversations: "styles_module_nsConversations",
891
896
  nsBodyWidth: "styles_module_nsBodyWidth",
892
897
  nsBubbleList: "styles_module_nsBubbleList",
@@ -953,7 +958,7 @@ var ConversationList_default = () => {
953
958
  }
954
959
  ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
955
960
  };
956
- var AgentHeader_default = () => {
961
+ var AgentHeader_default = ({ title = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true }) => {
957
962
  const chatStore = useChatStore();
958
963
  const agentState = valtio.useSnapshot(chatStore.agent);
959
964
  const configState = valtio.useSnapshot(chatStore.config);
@@ -962,7 +967,7 @@ var AgentHeader_default = () => {
962
967
  /* @__PURE__ */ jsxRuntime.jsx(
963
968
  common.RenderWrapper,
964
969
  {
965
- control: configState.layout.headerTitle,
970
+ control: title,
966
971
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
967
972
  /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: agentState.active.iconUrl, alt: agentState.active.name }),
968
973
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.nsChatTitle, children: agentState.active.name })
@@ -975,14 +980,14 @@ var AgentHeader_default = () => {
975
980
  /* @__PURE__ */ jsxRuntime.jsx(
976
981
  common.RenderWrapper,
977
982
  {
978
- control: configState.layout.headerNewConversationBtn,
983
+ control: newConversationBtn,
979
984
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "large", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}), onClick: () => chatStore.switchConversation() })
980
985
  }
981
986
  ),
982
987
  /* @__PURE__ */ jsxRuntime.jsx(
983
988
  common.RenderWrapper,
984
989
  {
985
- control: configState.layout.headerConversationListBtn,
990
+ control: conversationListBtn,
986
991
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
987
992
  antd.Popover,
988
993
  {
@@ -999,7 +1004,7 @@ var AgentHeader_default = () => {
999
1004
  /* @__PURE__ */ jsxRuntime.jsx(
1000
1005
  common.RenderWrapper,
1001
1006
  {
1002
- control: configState.layout.headerCloseBtn,
1007
+ control: closeBtn,
1003
1008
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "large", onClick: configState.hooks?.onHeaderClose, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}) })
1004
1009
  }
1005
1010
  )
@@ -1083,7 +1088,7 @@ var MessageAIRender_default = ({ message: message4, placement }) => {
1083
1088
  x.Bubble,
1084
1089
  {
1085
1090
  placement,
1086
- className: classNames5__default.default({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1091
+ className: classNames6__default.default({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1087
1092
  content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1088
1093
  thinkContents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1089
1094
  antd.Collapse,
@@ -1143,7 +1148,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1143
1148
  /* @__PURE__ */ jsxRuntime.jsx(
1144
1149
  x.Welcome,
1145
1150
  {
1146
- className: classNames5__default.default(styles_module_default.chatWelcome, "p-t-32"),
1151
+ className: classNames6__default.default(styles_module_default.chatWelcome, "p-t-32"),
1147
1152
  variant: "borderless",
1148
1153
  icon: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: agentState.active.iconUrl }),
1149
1154
  title: `\u4F60\u597D\uFF0C\u6211\u662F${agentState.active.name || ""}`,
@@ -1161,7 +1166,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1161
1166
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1162
1167
  children: agentState.active.recommendQuestions.map(({ question, id }) => ({
1163
1168
  key: id,
1164
- description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames5__default.default(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1169
+ description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames6__default.default(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1165
1170
  }))
1166
1171
  }
1167
1172
  ]
@@ -1250,17 +1255,37 @@ var BubbleListItems_default = ({ avatar = true }) => {
1250
1255
  return [...placeholderNode];
1251
1256
  }, [chatRecords, questionList, placeholderNode]);
1252
1257
  const listRef = react.useRef(null);
1258
+ const autoScrollRef = react.useRef(true);
1259
+ const handleScroll = (el) => {
1260
+ const target = el.target;
1261
+ const distanceToBottom = target.scrollHeight - target.scrollTop - target.clientHeight;
1262
+ autoScrollRef.current = distanceToBottom < 100;
1263
+ };
1264
+ react.useEffect(() => {
1265
+ autoScrollRef.current = true;
1266
+ }, [bubbleListItems.length]);
1253
1267
  react.useEffect(() => {
1254
- if (bubbleListItems.length && (listRef.current?.nativeElement.scrollHeight ?? 0) - ((listRef.current?.nativeElement.scrollTop ?? 0) + (listRef.current?.nativeElement.clientHeight ?? 0)) < 100) {
1255
- listRef.current?.scrollTo({ key: bubbleListItems[bubbleListItems.length - 1].key, block: "end" });
1268
+ const el = listRef.current?.nativeElement;
1269
+ if (!el || !bubbleListItems.length) return;
1270
+ if (autoScrollRef.current) {
1271
+ setTimeout(() => {
1272
+ if (autoScrollRef.current) {
1273
+ listRef.current?.scrollTo({
1274
+ key: bubbleListItems[bubbleListItems.length - 1].key,
1275
+ block: "end"
1276
+ });
1277
+ }
1278
+ }, 100);
1256
1279
  }
1257
1280
  }, [bubbleListItems]);
1258
1281
  return /* @__PURE__ */ jsxRuntime.jsx(
1259
1282
  x.Bubble.List,
1260
1283
  {
1284
+ autoScroll: false,
1261
1285
  ref: listRef,
1262
1286
  items: bubbleListItems,
1263
- className: classNames5__default.default(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in")
1287
+ className: classNames6__default.default(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in"),
1288
+ onScroll: handleScroll
1264
1289
  },
1265
1290
  conversationState.active.key
1266
1291
  );
@@ -1515,11 +1540,10 @@ var ChatSender_default = react.forwardRef(
1515
1540
 
1516
1541
  // src/ui/common/ChatSender.tsx
1517
1542
  init_Context();
1518
- var ChatSender_default2 = () => {
1543
+ var ChatSender_default2 = ({ placeholder, extraBtn = false, referencesBtn = false }) => {
1519
1544
  const chatStore = useChatStore();
1520
1545
  const agentState = valtio.useSnapshot(chatStore.agent);
1521
1546
  const conversationState = valtio.useSnapshot(chatStore.conversation);
1522
- const configState = valtio.useSnapshot(chatStore.config);
1523
1547
  const chatMessage = react.useMemo(
1524
1548
  () => conversationState.messages[conversationState.active.key] || {},
1525
1549
  [conversationState.messages[conversationState.active.key]]
@@ -1534,7 +1558,7 @@ var ChatSender_default2 = () => {
1534
1558
  return /* @__PURE__ */ jsxRuntime.jsx(
1535
1559
  ChatSender_default,
1536
1560
  {
1537
- placeholder: configState.layout.sender?.props?.placeholder,
1561
+ placeholder,
1538
1562
  content: chatMessage.content,
1539
1563
  fileList: chatMessage.files,
1540
1564
  headerOpen: chatMessage.headerOpen,
@@ -1559,7 +1583,7 @@ var ChatSender_default2 = () => {
1559
1583
  children: "\u6DF1\u5EA6\u601D\u8003"
1560
1584
  }
1561
1585
  ),
1562
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderExtraBtn })
1586
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
1563
1587
  ] }),
1564
1588
  extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
1565
1589
  x.Sender.Header,
@@ -1572,12 +1596,12 @@ var ChatSender_default2 = () => {
1572
1596
  onOpenChange: () => chatStore.setReferences(),
1573
1597
  classNames: {
1574
1598
  header: styles_module_default.nsSenderReferenceHeaderTitle,
1575
- content: common.shouldRender(configState.layout.referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1599
+ content: common.shouldRender(referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1576
1600
  },
1577
1601
  children: /* @__PURE__ */ jsxRuntime.jsx(
1578
1602
  common.RenderWrapper,
1579
1603
  {
1580
- control: configState.layout.referencesBtn,
1604
+ control: referencesBtn,
1581
1605
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { gap: 8, children: ["\u6DF1\u5EA6\u89E3\u8BFB", "\u6982\u8981\u89E3\u8BFB"].map((con) => /* @__PURE__ */ jsxRuntime.jsxs(antd.Button, { color: "primary", variant: "filled", onClick: () => referenceHandle(con), children: [
1582
1606
  con,
1583
1607
  " \u2192"
@@ -1607,13 +1631,19 @@ var ConversationListHeader_default = () => {
1607
1631
  type: "primary",
1608
1632
  shape: "round",
1609
1633
  onClick: () => chatStore.switchConversation(),
1610
- className: classNames5__default.default("m-t-16"),
1634
+ className: classNames6__default.default("m-t-16"),
1611
1635
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
1612
1636
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
1613
1637
  }
1614
1638
  )
1615
1639
  ] });
1616
1640
  };
1641
+ var ConversationListPanel_default = ({ header }) => {
1642
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames6__default.default("height-full", styles_module_default.conversationListPanel), children: [
1643
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
1644
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
1645
+ ] });
1646
+ };
1617
1647
 
1618
1648
  // src/ui/common/SenderPromptsItems.tsx
1619
1649
  init_Context();
@@ -1640,7 +1670,7 @@ var SenderPromptsItems_default = () => {
1640
1670
  title: /* @__PURE__ */ jsxRuntime.jsx(
1641
1671
  "div",
1642
1672
  {
1643
- className: classNames5__default.default(styles_module_default.senderListTitle, "text-ellipsis"),
1673
+ className: classNames6__default.default(styles_module_default.senderListTitle, "text-ellipsis"),
1644
1674
  children: `${agentState.active.name}\u5F00\u59CB\u5173\u6CE8${question.labelName}\u5185\u5BB9\uFF01`
1645
1675
  }
1646
1676
  ),
@@ -1695,117 +1725,117 @@ var layouts_default = react.forwardRef(({ theme, params, hooks, layout, defaultA
1695
1725
  }),
1696
1726
  []
1697
1727
  );
1698
- const setSplitterSizes = (sizes) => {
1699
- console.log(sizes);
1700
- };
1701
1728
  const hasPreView = react.useMemo(() => {
1702
1729
  return common.shouldRender(configState.layout.preview) && (!!configState.preview.file.fileUrl || !!configState.preview.file.content);
1703
1730
  }, [configState.layout.preview, configState.preview.file]);
1704
- return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: agentState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: classNames5__default.default(styles_module_default3.nsChatLayout, "height-full"), children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { onResize: setSplitterSizes, children: [
1705
- common.shouldRender(configState.layout.conversationList) && /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { size: 360, collapsible: false, resizable: false, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
1706
- /* @__PURE__ */ jsxRuntime.jsx(
1707
- common.RenderWrapper,
1708
- {
1709
- control: configState.layout.conversationListHeader,
1710
- DefaultComponent: ConversationListHeader_default
1711
- }
1712
- ),
1713
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1714
- common.RenderWrapper,
1715
- {
1716
- control: configState.layout.conversationList,
1717
- DefaultComponent: ConversationList_default
1718
- }
1719
- ) })
1720
- ] }) }),
1721
- hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter.Panel, { collapsible: false, resizable: false, children: [
1722
- configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
1723
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1724
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1725
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
1726
- /* @__PURE__ */ jsxRuntime.jsx(
1727
- antd.Button,
1731
+ const [sizes, setSizes] = react.useState([0, "100%"]);
1732
+ const setSplitterSizes = (sizes2) => {
1733
+ setSizes(sizes2);
1734
+ };
1735
+ react.useEffect(() => {
1736
+ if (hasPreView) {
1737
+ setSplitterSizes(["70%", "30%"]);
1738
+ } else {
1739
+ setSplitterSizes([0, "100%"]);
1740
+ }
1741
+ }, [hasPreView]);
1742
+ return /* @__PURE__ */ jsxRuntime.jsx(x.XProvider, { theme: { cssVar: true, ...theme }, children: /* @__PURE__ */ jsxRuntime.jsx(ChatProvider, { store: chatStore, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: agentState.loading, wrapperClassName: "full-spin", children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames6__default.default(styles_module_default3.nsChatLayout, "height-full"), children: [
1743
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: AgentHeader_default }),
1744
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
1745
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) }),
1746
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
1747
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { className: "flex-1", onResize: setSplitterSizes, children: [
1748
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, min: 600, size: sizes[0], children: hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1749
+ configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
1750
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1751
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1752
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
1753
+ /* @__PURE__ */ jsxRuntime.jsx(
1754
+ antd.Button,
1755
+ {
1756
+ color: "primary",
1757
+ variant: "outlined",
1758
+ onClick: () => common.downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1759
+ children: "\u4E0B\u8F7D"
1760
+ }
1761
+ ),
1762
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1763
+ ] })
1764
+ ] }),
1765
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1766
+ common.FilePreview,
1728
1767
  {
1729
- color: "primary",
1730
- variant: "outlined",
1731
- onClick: () => common.downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1732
- children: "\u4E0B\u8F7D"
1733
- }
1734
- ),
1735
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1736
- ] })
1737
- ] }),
1738
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1739
- common.FilePreview,
1740
- {
1741
- ...configState.preview.file,
1742
- pdfParams: {
1743
- isHasThumbnails: false
1744
- }
1745
- }
1746
- ) })
1747
- ] }),
1748
- configState.preview.file.content && /* @__PURE__ */ jsxRuntime.jsx(
1749
- common.MarkdownEditor,
1750
- {
1751
- value: configState.preview.file.content,
1752
- onQuote: (text) => {
1753
- chatStore.setReferences({
1754
- type: 1,
1755
- content: {
1756
- name: text,
1757
- markdown: text
1758
- },
1759
- params: {
1760
- outline: text
1768
+ ...configState.preview.file,
1769
+ pdfParams: {
1770
+ isHasThumbnails: false
1771
+ }
1761
1772
  }
1762
- });
1763
- },
1764
- extraNav: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: () => chatStore.setPreview(), children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}) }) })
1765
- }
1766
- )
1767
- ] }),
1768
- /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, resizable: false, size: hasPreView ? 400 : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames5__default.default("height-full"), children: [
1769
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.header, DefaultComponent: AgentHeader_default }),
1770
- /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames5__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "center", vertical: true, gap: 24, className: classNames5__default.default("height-full p-t-8 p-b-8", styles_module_default.nsBodyWidth), children: [
1771
- common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1772
- common.RenderWrapper,
1773
- {
1774
- control: configState.layout.messageList,
1775
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1776
- }
1777
- ) }),
1778
- /* @__PURE__ */ jsxRuntime.jsx(
1779
- common.RenderWrapper,
1780
- {
1781
- control: configState.layout.senderHeader,
1782
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1783
- "\u6211\u662F ",
1784
- agentState.active.name
1785
- ] })
1786
- }
1787
- ),
1788
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
1789
- /* @__PURE__ */ jsxRuntime.jsx(
1790
- common.RenderWrapper,
1791
- {
1792
- control: configState.layout.senderPrompts,
1793
- DefaultComponent: SenderPromptsItems_default
1794
- }
1795
- ),
1796
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1797
- /* @__PURE__ */ jsxRuntime.jsx(
1798
- common.RenderWrapper,
1773
+ ) })
1774
+ ] }),
1775
+ configState.preview.file.content && /* @__PURE__ */ jsxRuntime.jsx(
1776
+ common.MarkdownEditor,
1799
1777
  {
1800
- control: configState.layout.disclaimerNotice,
1801
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
1778
+ value: configState.preview.file.content,
1779
+ onQuote: (text) => {
1780
+ chatStore.setReferences({
1781
+ type: 1,
1782
+ content: {
1783
+ name: text,
1784
+ markdown: text
1785
+ },
1786
+ params: {
1787
+ outline: text
1788
+ }
1789
+ });
1790
+ },
1791
+ onDownloadFile: (content, type) => fileCreate(content, configState.preview.file.fileName, type),
1792
+ extraNav: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: () => chatStore.setPreview(), children: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}) }) })
1802
1793
  }
1803
1794
  )
1804
- ] }),
1805
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) })
1806
- ] }) })
1807
- ] }) })
1808
- ] }) }) }) }) });
1795
+ ] }) }),
1796
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, max: 800, min: 400, size: sizes[1], children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames6__default.default("height-full"), children: [
1797
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: AgentHeader_default }),
1798
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, className: classNames6__default.default("full-scroll"), children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "center", vertical: true, gap: 24, className: classNames6__default.default("height-full p-t-8 p-b-8", styles_module_default.nsBodyWidth), children: [
1799
+ common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1800
+ common.RenderWrapper,
1801
+ {
1802
+ control: configState.layout.messageList,
1803
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1804
+ }
1805
+ ) }),
1806
+ /* @__PURE__ */ jsxRuntime.jsx(
1807
+ common.RenderWrapper,
1808
+ {
1809
+ control: configState.layout.senderHeader,
1810
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1811
+ "\u6211\u662F ",
1812
+ agentState.active.name
1813
+ ] })
1814
+ }
1815
+ ),
1816
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
1817
+ /* @__PURE__ */ jsxRuntime.jsx(
1818
+ common.RenderWrapper,
1819
+ {
1820
+ control: configState.layout.senderPrompts,
1821
+ DefaultComponent: SenderPromptsItems_default
1822
+ }
1823
+ ),
1824
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1825
+ /* @__PURE__ */ jsxRuntime.jsx(
1826
+ common.RenderWrapper,
1827
+ {
1828
+ control: configState.layout.disclaimerNotice,
1829
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsDisclaimerNotice, children: "\u5185\u5BB9\u7531AI\u751F\u6210\uFF0C\u4EC5\u4F9B\u53C2\u8003\uFF0C\u8BF7\u4ED4\u7EC6\u7504\u522B" })
1830
+ }
1831
+ )
1832
+ ] }),
1833
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) })
1834
+ ] }) })
1835
+ ] }) })
1836
+ ] })
1837
+ ] })
1838
+ ] }) }) }) });
1809
1839
  });
1810
1840
 
1811
1841
  exports.AgentChat = layouts_default;