@zero-library/chat-agent 2.0.5 → 2.0.7

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;
@@ -204,16 +204,7 @@ var init_IndexQuote = __esm({
204
204
  }
205
205
  };
206
206
  const Content = /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsxRuntime.jsx("a", { onClick, children: data.fileName }) }) });
207
- const rootRef = react.useRef(null);
208
- react.useEffect(() => {
209
- const el = rootRef.current;
210
- if (!el) return;
211
- const previous = el.previousElementSibling;
212
- if (!previous) return;
213
- console.log("previous", previous, el);
214
- previous.appendChild(el);
215
- }, []);
216
- return /* @__PURE__ */ jsxRuntime.jsxs("div", { ref: rootRef, className: "inline-block m-l-8", children: [
207
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "inline-block m-l-8", children: [
217
208
  /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Popover, { content: Content, children: /* @__PURE__ */ jsxRuntime.jsx(antd.Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data.index }) }) }),
218
209
  open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { fileUrl: data.fileUrl, title: data.fileName, open, onClose: () => setOpen(false) })
219
210
  ] });
@@ -235,16 +226,15 @@ var init_MdEdit = __esm({
235
226
  const chatStore = useChatStore();
236
227
  const [value, setValue] = react.useState("");
237
228
  const onOk = () => {
238
- console.log("value", value);
239
229
  chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], { outline: value });
240
230
  };
241
231
  react.useEffect(() => {
242
232
  setValue(data.content);
243
233
  }, [data.content]);
244
- return /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.mdEdit, children: [
234
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default2.mdEdit, children: [
245
235
  /* @__PURE__ */ jsxRuntime.jsx(common.MarkdownEditor, { disabled: loading, value, onChange: setValue, showToolbar: false }),
246
236
  !loading && /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { color: "primary", variant: "outlined", onClick: onOk, children: "\u786E\u8BA4\u63D0\u7EB2\u601D\u8DEF\uFF0C\u5F00\u59CB\u5199\u4F5C" }) })
247
- ] }) });
237
+ ] });
248
238
  };
249
239
  }
250
240
  });
@@ -305,7 +295,7 @@ var init_QuoteList = __esm({
305
295
  }
306
296
  };
307
297
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
308
- /* @__PURE__ */ jsxRuntime.jsx(antd.Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxRuntime.jsx(
298
+ /* @__PURE__ */ jsxRuntime.jsx(
309
299
  antd.Collapse,
310
300
  {
311
301
  className: styles_module_default2.quoteList,
@@ -316,11 +306,11 @@ var init_QuoteList = __esm({
316
306
  {
317
307
  key: "1",
318
308
  label: "\u53C2\u8003\u8D44\u6599",
319
- children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 4, children: data.list.map((item) => /* @__PURE__ */ jsxRuntime.jsx("p", { onClick: () => onClick(item), className: "cursor-pointer", children: item.title }, item.fileUrl)) })
309
+ children: /* @__PURE__ */ jsxRuntime.jsx(antd.Flex, { vertical: true, gap: 4, children: data.list.map((item) => /* @__PURE__ */ jsxRuntime.jsx("p", { onClick: () => !loading && onClick(item), className: "cursor-pointer", children: item.title }, item.fileUrl)) })
320
310
  }
321
311
  ]
322
312
  }
323
- ) }),
313
+ ),
324
314
  open && /* @__PURE__ */ jsxRuntime.jsx(DocDrawer_default, { fileUrl: selectItem.fileUrl, title: selectItem.title, open, onClose: () => setOpen(false) })
325
315
  ] });
326
316
  };
@@ -488,21 +478,16 @@ var sendChatMessage = (params) => {
488
478
 
489
479
  // src/stores/index.ts
490
480
  var defaultLayout = {
481
+ leftPanel: false,
491
482
  conversationList: true,
492
- conversationListHeader: true,
493
483
  preview: true,
494
484
  messageList: true,
495
485
  senderHeader: false,
496
486
  sender: true,
497
487
  senderPrompts: true,
498
488
  senderFooter: false,
499
- senderExtraBtn: false,
500
- referencesBtn: false,
501
- header: true,
502
- headerTitle: true,
503
- headerConversationListBtn: true,
504
- headerNewConversationBtn: true,
505
- headerCloseBtn: false,
489
+ globalHeader: false,
490
+ chatHeader: true,
506
491
  disclaimerNotice: true
507
492
  };
508
493
  function createChatStore() {
@@ -661,14 +646,16 @@ function createChatStore() {
661
646
  const switchConversation = async (chat) => {
662
647
  const chatKey = chat?.key || `${agent.active.id}-${DEFAULT_NEW_CONV_ID}`;
663
648
  if (conversation.active.key === chatKey) return;
664
- const canProceed = await config.hooks?.onBeforeSwitchConversation?.(chatKey);
649
+ const isNew = !chat?.key;
650
+ const canProceed = await config.hooks?.onBeforeSwitchConversation?.(chatKey, isNew);
665
651
  if (canProceed === false) return;
666
652
  conversation.active = chat?.key ? chat : { key: chatKey };
653
+ setPreview();
667
654
  if (!conversation.messages[chatKey]) {
668
655
  setInitMessage(chatKey);
669
656
  }
670
- config.hooks?.onAfterSwitchConversation?.(chatKey);
671
- if (!chatKey.endsWith(DEFAULT_NEW_CONV_ID) && conversation.messages[chatKey].message.items.length === 0) {
657
+ config.hooks?.onAfterSwitchConversation?.(chatKey, isNew);
658
+ if (!isNew && conversation.messages[chatKey].message.items.length === 0) {
672
659
  getMessages(agent.active.id, chatKey);
673
660
  }
674
661
  };
@@ -896,6 +883,7 @@ init_Context();
896
883
  // src/ui/common/styles.module.less
897
884
  var styles_module_default = {
898
885
  loadingMessage: "styles_module_loadingMessage",
886
+ conversationListPanel: "styles_module_conversationListPanel",
899
887
  nsConversations: "styles_module_nsConversations",
900
888
  nsBodyWidth: "styles_module_nsBodyWidth",
901
889
  nsBubbleList: "styles_module_nsBubbleList",
@@ -962,7 +950,8 @@ var ConversationList_default = () => {
962
950
  }
963
951
  ) : /* @__PURE__ */ jsxRuntime.jsx(antd.Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: antd.Empty.PRESENTED_IMAGE_SIMPLE }) }) });
964
952
  };
965
- var AgentHeader_default = () => {
953
+ var AgentHeader_default = ({ title = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true }) => {
954
+ console.log("AgentHeader", title, closeBtn, newConversationBtn, conversationListBtn);
966
955
  const chatStore = useChatStore();
967
956
  const agentState = valtio.useSnapshot(chatStore.agent);
968
957
  const configState = valtio.useSnapshot(chatStore.config);
@@ -971,7 +960,7 @@ var AgentHeader_default = () => {
971
960
  /* @__PURE__ */ jsxRuntime.jsx(
972
961
  common.RenderWrapper,
973
962
  {
974
- control: configState.layout.headerTitle,
963
+ control: title,
975
964
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
976
965
  /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { size: 22, src: agentState.active.iconUrl, alt: agentState.active.name }),
977
966
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default.nsChatTitle, children: agentState.active.name })
@@ -984,14 +973,14 @@ var AgentHeader_default = () => {
984
973
  /* @__PURE__ */ jsxRuntime.jsx(
985
974
  common.RenderWrapper,
986
975
  {
987
- control: configState.layout.headerNewConversationBtn,
976
+ control: newConversationBtn,
988
977
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "large", icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}), onClick: () => chatStore.switchConversation() })
989
978
  }
990
979
  ),
991
980
  /* @__PURE__ */ jsxRuntime.jsx(
992
981
  common.RenderWrapper,
993
982
  {
994
- control: configState.layout.headerConversationListBtn,
983
+ control: conversationListBtn,
995
984
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(
996
985
  antd.Popover,
997
986
  {
@@ -1008,7 +997,7 @@ var AgentHeader_default = () => {
1008
997
  /* @__PURE__ */ jsxRuntime.jsx(
1009
998
  common.RenderWrapper,
1010
999
  {
1011
- control: configState.layout.headerCloseBtn,
1000
+ control: closeBtn,
1012
1001
  DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { type: "text", size: "large", onClick: configState.hooks?.onHeaderClose, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.CloseOutlined, {}) })
1013
1002
  }
1014
1003
  )
@@ -1092,7 +1081,7 @@ var MessageAIRender_default = ({ message: message4, placement }) => {
1092
1081
  x.Bubble,
1093
1082
  {
1094
1083
  placement,
1095
- className: classNames5__default.default({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1084
+ className: classNames6__default.default({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1096
1085
  content: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1097
1086
  thinkContents.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
1098
1087
  antd.Collapse,
@@ -1152,7 +1141,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1152
1141
  /* @__PURE__ */ jsxRuntime.jsx(
1153
1142
  x.Welcome,
1154
1143
  {
1155
- className: classNames5__default.default(styles_module_default.chatWelcome, "p-t-32"),
1144
+ className: classNames6__default.default(styles_module_default.chatWelcome, "p-t-32"),
1156
1145
  variant: "borderless",
1157
1146
  icon: /* @__PURE__ */ jsxRuntime.jsx(antd.Avatar, { shape: "square", size: 58, src: agentState.active.iconUrl }),
1158
1147
  title: `\u4F60\u597D\uFF0C\u6211\u662F${agentState.active.name || ""}`,
@@ -1170,7 +1159,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1170
1159
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1171
1160
  children: agentState.active.recommendQuestions.map(({ question, id }) => ({
1172
1161
  key: id,
1173
- description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames5__default.default(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1162
+ description: /* @__PURE__ */ jsxRuntime.jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames6__default.default(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1174
1163
  }))
1175
1164
  }
1176
1165
  ]
@@ -1269,7 +1258,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1269
1258
  {
1270
1259
  ref: listRef,
1271
1260
  items: bubbleListItems,
1272
- className: classNames5__default.default(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in")
1261
+ className: classNames6__default.default(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in")
1273
1262
  },
1274
1263
  conversationState.active.key
1275
1264
  );
@@ -1524,11 +1513,10 @@ var ChatSender_default = react.forwardRef(
1524
1513
 
1525
1514
  // src/ui/common/ChatSender.tsx
1526
1515
  init_Context();
1527
- var ChatSender_default2 = () => {
1516
+ var ChatSender_default2 = ({ placeholder, extraBtn = false, referencesBtn = false }) => {
1528
1517
  const chatStore = useChatStore();
1529
1518
  const agentState = valtio.useSnapshot(chatStore.agent);
1530
1519
  const conversationState = valtio.useSnapshot(chatStore.conversation);
1531
- const configState = valtio.useSnapshot(chatStore.config);
1532
1520
  const chatMessage = react.useMemo(
1533
1521
  () => conversationState.messages[conversationState.active.key] || {},
1534
1522
  [conversationState.messages[conversationState.active.key]]
@@ -1543,7 +1531,7 @@ var ChatSender_default2 = () => {
1543
1531
  return /* @__PURE__ */ jsxRuntime.jsx(
1544
1532
  ChatSender_default,
1545
1533
  {
1546
- placeholder: configState.layout.sender?.props?.placeholder,
1534
+ placeholder,
1547
1535
  content: chatMessage.content,
1548
1536
  fileList: chatMessage.files,
1549
1537
  headerOpen: chatMessage.headerOpen,
@@ -1568,7 +1556,7 @@ var ChatSender_default2 = () => {
1568
1556
  children: "\u6DF1\u5EA6\u601D\u8003"
1569
1557
  }
1570
1558
  ),
1571
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderExtraBtn })
1559
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: extraBtn })
1572
1560
  ] }),
1573
1561
  extraHeader: /* @__PURE__ */ jsxRuntime.jsx(
1574
1562
  x.Sender.Header,
@@ -1581,12 +1569,12 @@ var ChatSender_default2 = () => {
1581
1569
  onOpenChange: () => chatStore.setReferences(),
1582
1570
  classNames: {
1583
1571
  header: styles_module_default.nsSenderReferenceHeaderTitle,
1584
- content: common.shouldRender(configState.layout.referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1572
+ content: common.shouldRender(referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1585
1573
  },
1586
1574
  children: /* @__PURE__ */ jsxRuntime.jsx(
1587
1575
  common.RenderWrapper,
1588
1576
  {
1589
- control: configState.layout.referencesBtn,
1577
+ control: referencesBtn,
1590
1578
  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: [
1591
1579
  con,
1592
1580
  " \u2192"
@@ -1616,13 +1604,19 @@ var ConversationListHeader_default = () => {
1616
1604
  type: "primary",
1617
1605
  shape: "round",
1618
1606
  onClick: () => chatStore.switchConversation(),
1619
- className: classNames5__default.default("m-t-16"),
1607
+ className: classNames6__default.default("m-t-16"),
1620
1608
  icon: /* @__PURE__ */ jsxRuntime.jsx(icons.PlusOutlined, {}),
1621
1609
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
1622
1610
  }
1623
1611
  )
1624
1612
  ] });
1625
1613
  };
1614
+ var ConversationListPanel_default = ({ header }) => {
1615
+ return /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames6__default.default("height-full", styles_module_default.conversationListPanel), children: [
1616
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
1617
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(ConversationList_default, {}) })
1618
+ ] });
1619
+ };
1626
1620
 
1627
1621
  // src/ui/common/SenderPromptsItems.tsx
1628
1622
  init_Context();
@@ -1649,7 +1643,7 @@ var SenderPromptsItems_default = () => {
1649
1643
  title: /* @__PURE__ */ jsxRuntime.jsx(
1650
1644
  "div",
1651
1645
  {
1652
- className: classNames5__default.default(styles_module_default.senderListTitle, "text-ellipsis"),
1646
+ className: classNames6__default.default(styles_module_default.senderListTitle, "text-ellipsis"),
1653
1647
  children: `${agentState.active.name}\u5F00\u59CB\u5173\u6CE8${question.labelName}\u5185\u5BB9\uFF01`
1654
1648
  }
1655
1649
  ),
@@ -1710,111 +1704,102 @@ var layouts_default = react.forwardRef(({ theme, params, hooks, layout, defaultA
1710
1704
  const hasPreView = react.useMemo(() => {
1711
1705
  return common.shouldRender(configState.layout.preview) && (!!configState.preview.file.fileUrl || !!configState.preview.file.content);
1712
1706
  }, [configState.layout.preview, configState.preview.file]);
1713
- 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: [
1714
- 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: [
1715
- /* @__PURE__ */ jsxRuntime.jsx(
1716
- common.RenderWrapper,
1717
- {
1718
- control: configState.layout.conversationListHeader,
1719
- DefaultComponent: ConversationListHeader_default
1720
- }
1721
- ),
1722
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1723
- common.RenderWrapper,
1724
- {
1725
- control: configState.layout.conversationList,
1726
- DefaultComponent: ConversationList_default
1727
- }
1728
- ) })
1729
- ] }) }),
1730
- hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter.Panel, { collapsible: false, resizable: false, children: [
1731
- configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
1732
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1733
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1734
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
1735
- /* @__PURE__ */ jsxRuntime.jsx(
1736
- antd.Button,
1707
+ 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: [
1708
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: AgentHeader_default }),
1709
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { className: "full-scroll", children: [
1710
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.leftPanel, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) }),
1711
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
1712
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter, { onResize: setSplitterSizes, children: [
1713
+ hasPreView && /* @__PURE__ */ jsxRuntime.jsxs(antd.Splitter.Panel, { collapsible: false, resizable: false, children: [
1714
+ configState.preview.file.fileUrl && /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: "height-full", children: [
1715
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1716
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1717
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { gap: 8, justify: "center", align: "center", children: [
1718
+ /* @__PURE__ */ jsxRuntime.jsx(
1719
+ antd.Button,
1720
+ {
1721
+ color: "primary",
1722
+ variant: "outlined",
1723
+ onClick: () => common.downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1724
+ children: "\u4E0B\u8F7D"
1725
+ }
1726
+ ),
1727
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1728
+ ] })
1729
+ ] }),
1730
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1731
+ common.FilePreview,
1737
1732
  {
1738
- color: "primary",
1739
- variant: "outlined",
1740
- onClick: () => common.downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1741
- children: "\u4E0B\u8F7D"
1742
- }
1743
- ),
1744
- /* @__PURE__ */ jsxRuntime.jsx(antd.Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1745
- ] })
1746
- ] }),
1747
- /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1748
- common.FilePreview,
1749
- {
1750
- ...configState.preview.file,
1751
- pdfParams: {
1752
- isHasThumbnails: false
1753
- }
1754
- }
1755
- ) })
1756
- ] }),
1757
- configState.preview.file.content && /* @__PURE__ */ jsxRuntime.jsx(
1758
- common.MarkdownEditor,
1759
- {
1760
- value: configState.preview.file.content,
1761
- onQuote: (text) => {
1762
- chatStore.setReferences({
1763
- type: 2,
1764
- content: {
1765
- name: text,
1766
- markdown: text
1767
- },
1768
- params: {
1769
- outline: text
1733
+ ...configState.preview.file,
1734
+ pdfParams: {
1735
+ isHasThumbnails: false
1736
+ }
1770
1737
  }
1771
- });
1772
- },
1773
- 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, {}) }) })
1774
- }
1775
- )
1776
- ] }),
1777
- /* @__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: [
1778
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.header, DefaultComponent: AgentHeader_default }),
1779
- /* @__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: [
1780
- common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1781
- common.RenderWrapper,
1782
- {
1783
- control: configState.layout.messageList,
1784
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1785
- }
1786
- ) }),
1787
- /* @__PURE__ */ jsxRuntime.jsx(
1788
- common.RenderWrapper,
1789
- {
1790
- control: configState.layout.senderHeader,
1791
- DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1792
- "\u6211\u662F ",
1793
- agentState.active.name
1794
- ] })
1795
- }
1796
- ),
1797
- /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
1798
- /* @__PURE__ */ jsxRuntime.jsx(
1799
- common.RenderWrapper,
1800
- {
1801
- control: configState.layout.senderPrompts,
1802
- DefaultComponent: SenderPromptsItems_default
1803
- }
1804
- ),
1805
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1806
- /* @__PURE__ */ jsxRuntime.jsx(
1807
- common.RenderWrapper,
1738
+ ) })
1739
+ ] }),
1740
+ configState.preview.file.content && /* @__PURE__ */ jsxRuntime.jsx(
1741
+ common.MarkdownEditor,
1808
1742
  {
1809
- control: configState.layout.disclaimerNotice,
1810
- 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" })
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
1753
+ }
1754
+ });
1755
+ },
1756
+ 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, {}) }) })
1811
1757
  }
1812
1758
  )
1813
1759
  ] }),
1814
- /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) })
1815
- ] }) })
1816
- ] }) })
1817
- ] }) }) }) }) });
1760
+ /* @__PURE__ */ jsxRuntime.jsx(antd.Splitter.Panel, { collapsible: false, resizable: true, size: hasPreView ? 400 : void 0, children: /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, className: classNames6__default.default("height-full"), children: [
1761
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: AgentHeader_default }),
1762
+ /* @__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: [
1763
+ common.shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsxRuntime.jsx(
1764
+ common.RenderWrapper,
1765
+ {
1766
+ control: configState.layout.messageList,
1767
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1768
+ }
1769
+ ) }),
1770
+ /* @__PURE__ */ jsxRuntime.jsx(
1771
+ common.RenderWrapper,
1772
+ {
1773
+ control: configState.layout.senderHeader,
1774
+ DefaultComponent: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1775
+ "\u6211\u662F ",
1776
+ agentState.active.name
1777
+ ] })
1778
+ }
1779
+ ),
1780
+ /* @__PURE__ */ jsxRuntime.jsxs(antd.Flex, { vertical: true, gap: 8, children: [
1781
+ /* @__PURE__ */ jsxRuntime.jsx(
1782
+ common.RenderWrapper,
1783
+ {
1784
+ control: configState.layout.senderPrompts,
1785
+ DefaultComponent: SenderPromptsItems_default
1786
+ }
1787
+ ),
1788
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1789
+ /* @__PURE__ */ jsxRuntime.jsx(
1790
+ common.RenderWrapper,
1791
+ {
1792
+ control: configState.layout.disclaimerNotice,
1793
+ 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" })
1794
+ }
1795
+ )
1796
+ ] }),
1797
+ /* @__PURE__ */ jsxRuntime.jsx(common.RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, {}) })
1798
+ ] }) })
1799
+ ] }) })
1800
+ ] })
1801
+ ] })
1802
+ ] }) }) }) });
1818
1803
  });
1819
1804
 
1820
1805
  exports.AgentChat = layouts_default;