@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.esm.js CHANGED
@@ -1,11 +1,11 @@
1
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';
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
 
@@ -196,16 +196,7 @@ var init_IndexQuote = __esm({
196
196
  }
197
197
  };
198
198
  const Content = /* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Flex, { align: "center", gap: 8, children: /* @__PURE__ */ jsx("a", { onClick, children: data.fileName }) }) });
199
- const rootRef = useRef(null);
200
- useEffect(() => {
201
- const el = rootRef.current;
202
- if (!el) return;
203
- const previous = el.previousElementSibling;
204
- if (!previous) return;
205
- console.log("previous", previous, el);
206
- previous.appendChild(el);
207
- }, []);
208
- return /* @__PURE__ */ jsxs("div", { ref: rootRef, className: "inline-block m-l-8", children: [
199
+ return /* @__PURE__ */ jsxs("div", { className: "inline-block m-l-8", children: [
209
200
  /* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(Popover, { content: Content, children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "processing", className: "cursor-pointer", children: data.index }) }) }),
210
201
  open && /* @__PURE__ */ jsx(DocDrawer_default, { fileUrl: data.fileUrl, title: data.fileName, open, onClose: () => setOpen(false) })
211
202
  ] });
@@ -227,16 +218,15 @@ var init_MdEdit = __esm({
227
218
  const chatStore = useChatStore();
228
219
  const [value, setValue] = useState("");
229
220
  const onOk = () => {
230
- console.log("value", value);
231
221
  chatStore.sendMessage("\u5F00\u59CB\u5199\u4F5C", [], { outline: value });
232
222
  };
233
223
  useEffect(() => {
234
224
  setValue(data.content);
235
225
  }, [data.content]);
236
- return /* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsxs("div", { className: styles_module_default2.mdEdit, children: [
226
+ return /* @__PURE__ */ jsxs("div", { className: styles_module_default2.mdEdit, children: [
237
227
  /* @__PURE__ */ jsx(MarkdownEditor, { disabled: loading, value, onChange: setValue, showToolbar: false }),
238
228
  !loading && /* @__PURE__ */ jsx(Flex, { justify: "end", className: "m-t-16", children: /* @__PURE__ */ jsx(Button, { color: "primary", variant: "outlined", onClick: onOk, children: "\u786E\u8BA4\u63D0\u7EB2\u601D\u8DEF\uFF0C\u5F00\u59CB\u5199\u4F5C" }) })
239
- ] }) });
229
+ ] });
240
230
  };
241
231
  }
242
232
  });
@@ -297,7 +287,7 @@ var init_QuoteList = __esm({
297
287
  }
298
288
  };
299
289
  return /* @__PURE__ */ jsxs(Fragment, { children: [
300
- /* @__PURE__ */ jsx(Spin, { spinning: loading, size: "small", children: /* @__PURE__ */ jsx(
290
+ /* @__PURE__ */ jsx(
301
291
  Collapse,
302
292
  {
303
293
  className: styles_module_default2.quoteList,
@@ -308,11 +298,11 @@ var init_QuoteList = __esm({
308
298
  {
309
299
  key: "1",
310
300
  label: "\u53C2\u8003\u8D44\u6599",
311
- children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 4, children: data.list.map((item) => /* @__PURE__ */ jsx("p", { onClick: () => onClick(item), className: "cursor-pointer", children: item.title }, item.fileUrl)) })
301
+ children: /* @__PURE__ */ jsx(Flex, { vertical: true, gap: 4, children: data.list.map((item) => /* @__PURE__ */ jsx("p", { onClick: () => !loading && onClick(item), className: "cursor-pointer", children: item.title }, item.fileUrl)) })
312
302
  }
313
303
  ]
314
304
  }
315
- ) }),
305
+ ),
316
306
  open && /* @__PURE__ */ jsx(DocDrawer_default, { fileUrl: selectItem.fileUrl, title: selectItem.title, open, onClose: () => setOpen(false) })
317
307
  ] });
318
308
  };
@@ -480,21 +470,16 @@ var sendChatMessage = (params) => {
480
470
 
481
471
  // src/stores/index.ts
482
472
  var defaultLayout = {
473
+ leftPanel: false,
483
474
  conversationList: true,
484
- conversationListHeader: true,
485
475
  preview: true,
486
476
  messageList: true,
487
477
  senderHeader: false,
488
478
  sender: true,
489
479
  senderPrompts: true,
490
480
  senderFooter: false,
491
- senderExtraBtn: false,
492
- referencesBtn: false,
493
- header: true,
494
- headerTitle: true,
495
- headerConversationListBtn: true,
496
- headerNewConversationBtn: true,
497
- headerCloseBtn: false,
481
+ globalHeader: false,
482
+ chatHeader: true,
498
483
  disclaimerNotice: true
499
484
  };
500
485
  function createChatStore() {
@@ -653,14 +638,16 @@ function createChatStore() {
653
638
  const switchConversation = async (chat) => {
654
639
  const chatKey = chat?.key || `${agent.active.id}-${DEFAULT_NEW_CONV_ID}`;
655
640
  if (conversation.active.key === chatKey) return;
656
- const canProceed = await config.hooks?.onBeforeSwitchConversation?.(chatKey);
641
+ const isNew = !chat?.key;
642
+ const canProceed = await config.hooks?.onBeforeSwitchConversation?.(chatKey, isNew);
657
643
  if (canProceed === false) return;
658
644
  conversation.active = chat?.key ? chat : { key: chatKey };
645
+ setPreview();
659
646
  if (!conversation.messages[chatKey]) {
660
647
  setInitMessage(chatKey);
661
648
  }
662
- config.hooks?.onAfterSwitchConversation?.(chatKey);
663
- if (!chatKey.endsWith(DEFAULT_NEW_CONV_ID) && conversation.messages[chatKey].message.items.length === 0) {
649
+ config.hooks?.onAfterSwitchConversation?.(chatKey, isNew);
650
+ if (!isNew && conversation.messages[chatKey].message.items.length === 0) {
664
651
  getMessages(agent.active.id, chatKey);
665
652
  }
666
653
  };
@@ -888,6 +875,7 @@ init_Context();
888
875
  // src/ui/common/styles.module.less
889
876
  var styles_module_default = {
890
877
  loadingMessage: "styles_module_loadingMessage",
878
+ conversationListPanel: "styles_module_conversationListPanel",
891
879
  nsConversations: "styles_module_nsConversations",
892
880
  nsBodyWidth: "styles_module_nsBodyWidth",
893
881
  nsBubbleList: "styles_module_nsBubbleList",
@@ -954,7 +942,8 @@ var ConversationList_default = () => {
954
942
  }
955
943
  ) : /* @__PURE__ */ jsx(Empty, { description: "\u6682\u65E0\u4F1A\u8BDD\u8BB0\u5F55", image: Empty.PRESENTED_IMAGE_SIMPLE }) }) });
956
944
  };
957
- var AgentHeader_default = () => {
945
+ var AgentHeader_default = ({ title = true, closeBtn = false, newConversationBtn = true, conversationListBtn = true }) => {
946
+ console.log("AgentHeader", title, closeBtn, newConversationBtn, conversationListBtn);
958
947
  const chatStore = useChatStore();
959
948
  const agentState = useSnapshot(chatStore.agent);
960
949
  const configState = useSnapshot(chatStore.config);
@@ -963,7 +952,7 @@ var AgentHeader_default = () => {
963
952
  /* @__PURE__ */ jsx(
964
953
  RenderWrapper,
965
954
  {
966
- control: configState.layout.headerTitle,
955
+ control: title,
967
956
  DefaultComponent: /* @__PURE__ */ jsxs(Fragment, { children: [
968
957
  /* @__PURE__ */ jsx(Avatar, { size: 22, src: agentState.active.iconUrl, alt: agentState.active.name }),
969
958
  /* @__PURE__ */ jsx("div", { className: styles_module_default.nsChatTitle, children: agentState.active.name })
@@ -976,14 +965,14 @@ var AgentHeader_default = () => {
976
965
  /* @__PURE__ */ jsx(
977
966
  RenderWrapper,
978
967
  {
979
- control: configState.layout.headerNewConversationBtn,
968
+ control: newConversationBtn,
980
969
  DefaultComponent: /* @__PURE__ */ jsx(Button, { type: "text", size: "large", icon: /* @__PURE__ */ jsx(PlusOutlined, {}), onClick: () => chatStore.switchConversation() })
981
970
  }
982
971
  ),
983
972
  /* @__PURE__ */ jsx(
984
973
  RenderWrapper,
985
974
  {
986
- control: configState.layout.headerConversationListBtn,
975
+ control: conversationListBtn,
987
976
  DefaultComponent: /* @__PURE__ */ jsx(
988
977
  Popover,
989
978
  {
@@ -1000,7 +989,7 @@ var AgentHeader_default = () => {
1000
989
  /* @__PURE__ */ jsx(
1001
990
  RenderWrapper,
1002
991
  {
1003
- control: configState.layout.headerCloseBtn,
992
+ control: closeBtn,
1004
993
  DefaultComponent: /* @__PURE__ */ jsx(Button, { type: "text", size: "large", onClick: configState.hooks?.onHeaderClose, icon: /* @__PURE__ */ jsx(CloseOutlined, {}) })
1005
994
  }
1006
995
  )
@@ -1084,7 +1073,7 @@ var MessageAIRender_default = ({ message: message4, placement }) => {
1084
1073
  Bubble,
1085
1074
  {
1086
1075
  placement,
1087
- className: classNames5({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1076
+ className: classNames6({ [styles_module_default.loadingMessage]: message4.status === "loading" }),
1088
1077
  content: /* @__PURE__ */ jsxs(Fragment, { children: [
1089
1078
  thinkContents.length > 0 && /* @__PURE__ */ jsx(
1090
1079
  Collapse,
@@ -1144,7 +1133,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1144
1133
  /* @__PURE__ */ jsx(
1145
1134
  Welcome,
1146
1135
  {
1147
- className: classNames5(styles_module_default.chatWelcome, "p-t-32"),
1136
+ className: classNames6(styles_module_default.chatWelcome, "p-t-32"),
1148
1137
  variant: "borderless",
1149
1138
  icon: /* @__PURE__ */ jsx(Avatar, { shape: "square", size: 58, src: agentState.active.iconUrl }),
1150
1139
  title: `\u4F60\u597D\uFF0C\u6211\u662F${agentState.active.name || ""}`,
@@ -1162,7 +1151,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1162
1151
  label: "\u{1F914} \u63A8\u8350\u95EE\u9898:",
1163
1152
  children: agentState.active.recommendQuestions.map(({ question, id }) => ({
1164
1153
  key: id,
1165
- description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames5(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1154
+ description: /* @__PURE__ */ jsx("span", { onClick: () => chatStore.sendMessage(question), className: classNames6(styles_module_default.chatWelcomePrompts, "text-ellipsis"), children: question })
1166
1155
  }))
1167
1156
  }
1168
1157
  ]
@@ -1261,7 +1250,7 @@ var BubbleListItems_default = ({ avatar = true }) => {
1261
1250
  {
1262
1251
  ref: listRef,
1263
1252
  items: bubbleListItems,
1264
- className: classNames5(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in")
1253
+ className: classNames6(styles_module_default.nsBubbleList, "height-full", "scroll-fade-in")
1265
1254
  },
1266
1255
  conversationState.active.key
1267
1256
  );
@@ -1516,11 +1505,10 @@ var ChatSender_default = forwardRef(
1516
1505
 
1517
1506
  // src/ui/common/ChatSender.tsx
1518
1507
  init_Context();
1519
- var ChatSender_default2 = () => {
1508
+ var ChatSender_default2 = ({ placeholder, extraBtn = false, referencesBtn = false }) => {
1520
1509
  const chatStore = useChatStore();
1521
1510
  const agentState = useSnapshot(chatStore.agent);
1522
1511
  const conversationState = useSnapshot(chatStore.conversation);
1523
- const configState = useSnapshot(chatStore.config);
1524
1512
  const chatMessage = useMemo(
1525
1513
  () => conversationState.messages[conversationState.active.key] || {},
1526
1514
  [conversationState.messages[conversationState.active.key]]
@@ -1535,7 +1523,7 @@ var ChatSender_default2 = () => {
1535
1523
  return /* @__PURE__ */ jsx(
1536
1524
  ChatSender_default,
1537
1525
  {
1538
- placeholder: configState.layout.sender?.props?.placeholder,
1526
+ placeholder,
1539
1527
  content: chatMessage.content,
1540
1528
  fileList: chatMessage.files,
1541
1529
  headerOpen: chatMessage.headerOpen,
@@ -1560,7 +1548,7 @@ var ChatSender_default2 = () => {
1560
1548
  children: "\u6DF1\u5EA6\u601D\u8003"
1561
1549
  }
1562
1550
  ),
1563
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderExtraBtn })
1551
+ /* @__PURE__ */ jsx(RenderWrapper, { control: extraBtn })
1564
1552
  ] }),
1565
1553
  extraHeader: /* @__PURE__ */ jsx(
1566
1554
  Sender.Header,
@@ -1573,12 +1561,12 @@ var ChatSender_default2 = () => {
1573
1561
  onOpenChange: () => chatStore.setReferences(),
1574
1562
  classNames: {
1575
1563
  header: styles_module_default.nsSenderReferenceHeaderTitle,
1576
- content: shouldRender(configState.layout.referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1564
+ content: shouldRender(referencesBtn) ? "" : styles_module_default.nsSenderReferenceHeaderContent
1577
1565
  },
1578
1566
  children: /* @__PURE__ */ jsx(
1579
1567
  RenderWrapper,
1580
1568
  {
1581
- control: configState.layout.referencesBtn,
1569
+ control: referencesBtn,
1582
1570
  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: [
1583
1571
  con,
1584
1572
  " \u2192"
@@ -1608,13 +1596,19 @@ var ConversationListHeader_default = () => {
1608
1596
  type: "primary",
1609
1597
  shape: "round",
1610
1598
  onClick: () => chatStore.switchConversation(),
1611
- className: classNames5("m-t-16"),
1599
+ className: classNames6("m-t-16"),
1612
1600
  icon: /* @__PURE__ */ jsx(PlusOutlined, {}),
1613
1601
  children: "\u65B0\u5EFA\u4F1A\u8BDD"
1614
1602
  }
1615
1603
  )
1616
1604
  ] });
1617
1605
  };
1606
+ var ConversationListPanel_default = ({ header }) => {
1607
+ return /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames6("height-full", styles_module_default.conversationListPanel), children: [
1608
+ /* @__PURE__ */ jsx(RenderWrapper, { control: header, DefaultComponent: ConversationListHeader_default }),
1609
+ /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(ConversationList_default, {}) })
1610
+ ] });
1611
+ };
1618
1612
 
1619
1613
  // src/ui/common/SenderPromptsItems.tsx
1620
1614
  init_Context();
@@ -1641,7 +1635,7 @@ var SenderPromptsItems_default = () => {
1641
1635
  title: /* @__PURE__ */ jsx(
1642
1636
  "div",
1643
1637
  {
1644
- className: classNames5(styles_module_default.senderListTitle, "text-ellipsis"),
1638
+ className: classNames6(styles_module_default.senderListTitle, "text-ellipsis"),
1645
1639
  children: `${agentState.active.name}\u5F00\u59CB\u5173\u6CE8${question.labelName}\u5185\u5BB9\uFF01`
1646
1640
  }
1647
1641
  ),
@@ -1702,111 +1696,102 @@ var layouts_default = forwardRef(({ theme, params, hooks, layout, defaultAgent }
1702
1696
  const hasPreView = useMemo(() => {
1703
1697
  return shouldRender(configState.layout.preview) && (!!configState.preview.file.fileUrl || !!configState.preview.file.content);
1704
1698
  }, [configState.layout.preview, configState.preview.file]);
1705
- 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: [
1706
- shouldRender(configState.layout.conversationList) && /* @__PURE__ */ jsx(Splitter.Panel, { size: 360, collapsible: false, resizable: false, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
1707
- /* @__PURE__ */ jsx(
1708
- RenderWrapper,
1709
- {
1710
- control: configState.layout.conversationListHeader,
1711
- DefaultComponent: ConversationListHeader_default
1712
- }
1713
- ),
1714
- /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1715
- RenderWrapper,
1716
- {
1717
- control: configState.layout.conversationList,
1718
- DefaultComponent: ConversationList_default
1719
- }
1720
- ) })
1721
- ] }) }),
1722
- hasPreView && /* @__PURE__ */ jsxs(Splitter.Panel, { collapsible: false, resizable: false, children: [
1723
- configState.preview.file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
1724
- /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1725
- /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1726
- /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
1727
- /* @__PURE__ */ jsx(
1728
- Button,
1699
+ 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: [
1700
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.globalHeader, DefaultComponent: AgentHeader_default }),
1701
+ /* @__PURE__ */ jsxs(Flex, { className: "full-scroll", children: [
1702
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.leftPanel, DefaultComponent: /* @__PURE__ */ jsx(Fragment, {}) }),
1703
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.conversationList, DefaultComponent: ConversationListPanel_default }),
1704
+ /* @__PURE__ */ jsxs(Splitter, { onResize: setSplitterSizes, children: [
1705
+ hasPreView && /* @__PURE__ */ jsxs(Splitter.Panel, { collapsible: false, resizable: false, children: [
1706
+ configState.preview.file.fileUrl && /* @__PURE__ */ jsxs(Flex, { vertical: true, className: "height-full", children: [
1707
+ /* @__PURE__ */ jsxs(Flex, { justify: "space-between", align: "center", gap: 16, className: styles_module_default3.nsPreviewHeader, children: [
1708
+ /* @__PURE__ */ jsx("div", { className: styles_module_default3.nsPreviewHeaderTitle, children: configState.preview.file.fileName }),
1709
+ /* @__PURE__ */ jsxs(Flex, { gap: 8, justify: "center", align: "center", children: [
1710
+ /* @__PURE__ */ jsx(
1711
+ Button,
1712
+ {
1713
+ color: "primary",
1714
+ variant: "outlined",
1715
+ onClick: () => downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1716
+ children: "\u4E0B\u8F7D"
1717
+ }
1718
+ ),
1719
+ /* @__PURE__ */ jsx(Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1720
+ ] })
1721
+ ] }),
1722
+ /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1723
+ FilePreview,
1729
1724
  {
1730
- color: "primary",
1731
- variant: "outlined",
1732
- onClick: () => downloadFile(configState.preview.file.fileUrl, configState.preview.file.fileName),
1733
- children: "\u4E0B\u8F7D"
1734
- }
1735
- ),
1736
- /* @__PURE__ */ jsx(Button, { onClick: () => chatStore.setPreview(), children: "\u5173\u95ED" })
1737
- ] })
1738
- ] }),
1739
- /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1740
- FilePreview,
1741
- {
1742
- ...configState.preview.file,
1743
- pdfParams: {
1744
- isHasThumbnails: false
1745
- }
1746
- }
1747
- ) })
1748
- ] }),
1749
- configState.preview.file.content && /* @__PURE__ */ jsx(
1750
- MarkdownEditor,
1751
- {
1752
- value: configState.preview.file.content,
1753
- onQuote: (text) => {
1754
- chatStore.setReferences({
1755
- type: 2,
1756
- content: {
1757
- name: text,
1758
- markdown: text
1759
- },
1760
- params: {
1761
- outline: text
1725
+ ...configState.preview.file,
1726
+ pdfParams: {
1727
+ isHasThumbnails: false
1728
+ }
1762
1729
  }
1763
- });
1764
- },
1765
- extraNav: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: () => chatStore.setPreview(), children: /* @__PURE__ */ jsx(CloseOutlined, {}) }) })
1766
- }
1767
- )
1768
- ] }),
1769
- /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, resizable: false, size: hasPreView ? 400 : void 0, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames5("height-full"), children: [
1770
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.header, DefaultComponent: AgentHeader_default }),
1771
- /* @__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: [
1772
- shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1773
- RenderWrapper,
1774
- {
1775
- control: configState.layout.messageList,
1776
- DefaultComponent: /* @__PURE__ */ jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1777
- }
1778
- ) }),
1779
- /* @__PURE__ */ jsx(
1780
- RenderWrapper,
1781
- {
1782
- control: configState.layout.senderHeader,
1783
- DefaultComponent: /* @__PURE__ */ jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1784
- "\u6211\u662F ",
1785
- agentState.active.name
1786
- ] })
1787
- }
1788
- ),
1789
- /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
1790
- /* @__PURE__ */ jsx(
1791
- RenderWrapper,
1792
- {
1793
- control: configState.layout.senderPrompts,
1794
- DefaultComponent: SenderPromptsItems_default
1795
- }
1796
- ),
1797
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1798
- /* @__PURE__ */ jsx(
1799
- RenderWrapper,
1730
+ ) })
1731
+ ] }),
1732
+ configState.preview.file.content && /* @__PURE__ */ jsx(
1733
+ MarkdownEditor,
1800
1734
  {
1801
- control: configState.layout.disclaimerNotice,
1802
- 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" })
1735
+ value: configState.preview.file.content,
1736
+ onQuote: (text) => {
1737
+ chatStore.setReferences({
1738
+ type: 1,
1739
+ content: {
1740
+ name: text,
1741
+ markdown: text
1742
+ },
1743
+ params: {
1744
+ outline: text
1745
+ }
1746
+ });
1747
+ },
1748
+ extraNav: /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(Tag, { bordered: false, color: "default", className: "cursor-pointer", onClick: () => chatStore.setPreview(), children: /* @__PURE__ */ jsx(CloseOutlined, {}) }) })
1803
1749
  }
1804
1750
  )
1805
1751
  ] }),
1806
- /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsx(Fragment, {}) })
1807
- ] }) })
1808
- ] }) })
1809
- ] }) }) }) }) });
1752
+ /* @__PURE__ */ jsx(Splitter.Panel, { collapsible: false, resizable: true, size: hasPreView ? 400 : void 0, children: /* @__PURE__ */ jsxs(Flex, { vertical: true, className: classNames6("height-full"), children: [
1753
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.chatHeader, DefaultComponent: AgentHeader_default }),
1754
+ /* @__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: [
1755
+ shouldRender(configState.layout.messageList) && /* @__PURE__ */ jsx("div", { className: "full-scroll", children: /* @__PURE__ */ jsx(
1756
+ RenderWrapper,
1757
+ {
1758
+ control: configState.layout.messageList,
1759
+ DefaultComponent: /* @__PURE__ */ jsx(BubbleListItems_default, { avatar: { user: false, assistant: true } })
1760
+ }
1761
+ ) }),
1762
+ /* @__PURE__ */ jsx(
1763
+ RenderWrapper,
1764
+ {
1765
+ control: configState.layout.senderHeader,
1766
+ DefaultComponent: /* @__PURE__ */ jsxs("div", { className: styles_module_default3.nsChatSenderHeader, children: [
1767
+ "\u6211\u662F ",
1768
+ agentState.active.name
1769
+ ] })
1770
+ }
1771
+ ),
1772
+ /* @__PURE__ */ jsxs(Flex, { vertical: true, gap: 8, children: [
1773
+ /* @__PURE__ */ jsx(
1774
+ RenderWrapper,
1775
+ {
1776
+ control: configState.layout.senderPrompts,
1777
+ DefaultComponent: SenderPromptsItems_default
1778
+ }
1779
+ ),
1780
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.sender, DefaultComponent: ChatSender_default2 }),
1781
+ /* @__PURE__ */ jsx(
1782
+ RenderWrapper,
1783
+ {
1784
+ control: configState.layout.disclaimerNotice,
1785
+ 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" })
1786
+ }
1787
+ )
1788
+ ] }),
1789
+ /* @__PURE__ */ jsx(RenderWrapper, { control: configState.layout.senderFooter, DefaultComponent: /* @__PURE__ */ jsx(Fragment, {}) })
1790
+ ] }) })
1791
+ ] }) })
1792
+ ] })
1793
+ ] })
1794
+ ] }) }) }) });
1810
1795
  });
1811
1796
 
1812
1797
  export { layouts_default as AgentChat };