@axiom-lattice/react-sdk 2.0.3 → 2.0.4

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.mjs CHANGED
@@ -71,9 +71,22 @@ function useChat(threadId, options = {}) {
71
71
  }, [options.initialMessages]);
72
72
  const handleStreamEvent = useCallback((chunk) => {
73
73
  chunkMessageMerger.current.push(chunk);
74
+ let todos;
75
+ if (chunk.type === "tool" && chunk.data && typeof chunk.data.content === "string" && chunk.data.content.startsWith("```todo_list")) {
76
+ try {
77
+ const content = chunk.data.content;
78
+ const match = content.match(/```todo_list\s*([\s\S]*?)\s*```/);
79
+ if (match && match[1]) {
80
+ todos = JSON.parse(match[1]);
81
+ }
82
+ } catch (e) {
83
+ console.error("Failed to parse todo list from chunk", e);
84
+ }
85
+ }
74
86
  const updatedMessages = chunkMessageMerger.current.getMessages();
75
87
  setState((prev) => ({
76
88
  ...prev,
89
+ todos: todos || prev.todos,
77
90
  messages: updatedMessages,
78
91
  isLoading: true,
79
92
  streamingMessage: null
@@ -204,14 +217,14 @@ function useChat(threadId, options = {}) {
204
217
  }
205
218
  setState((prev) => ({ ...prev, isLoading: true, error: null }));
206
219
  try {
207
- const fetchedMessages = await client.getMessages({
208
- threadId,
209
- limit
210
- });
220
+ const agentState = await client.getAgentState(threadId);
221
+ const fetchedMessages = await client.getMessages({ threadId });
211
222
  chunkMessageMerger.current.reset();
212
223
  chunkMessageMerger.current.initialMessages(fetchedMessages);
213
224
  setState((prev) => ({
214
225
  ...prev,
226
+ agentState,
227
+ todos: agentState?.values?.todos,
215
228
  messages: chunkMessageMerger.current.getMessages(),
216
229
  isLoading: false
217
230
  }));
@@ -1527,7 +1540,9 @@ var IFrameCard = ({ src }) => {
1527
1540
  // src/components/Chat/Chating.tsx
1528
1541
  import {
1529
1542
  CloudUploadOutlined,
1530
- PaperClipOutlined
1543
+ PaperClipOutlined,
1544
+ FileTextOutlined as FileTextOutlined2,
1545
+ CheckSquareOutlined
1531
1546
  } from "@ant-design/icons";
1532
1547
  import {
1533
1548
  Attachments,
@@ -1543,28 +1558,221 @@ import {
1543
1558
  Button as Button3,
1544
1559
  Flex as Flex3,
1545
1560
  Space as Space6,
1546
- message
1561
+ message,
1562
+ Modal,
1563
+ Tooltip,
1564
+ Popover
1547
1565
  } from "antd";
1548
1566
  import ErrorBoundary from "antd/es/alert/ErrorBoundary";
1549
- import React2, {
1567
+ import React3, {
1550
1568
  memo,
1551
1569
  useCallback as useCallback5,
1552
- useEffect as useEffect5,
1553
- useMemo as useMemo3,
1570
+ useEffect as useEffect6,
1571
+ useMemo as useMemo4,
1554
1572
  useRef as useRef5,
1555
- useState as useState8
1573
+ useState as useState9
1556
1574
  } from "react";
1557
1575
  import { useTranslation } from "react-i18next";
1558
- import { Fragment, jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1576
+
1577
+ // src/components/FileExplorer.tsx
1578
+ import { useState as useState8, useEffect as useEffect5, useMemo as useMemo3 } from "react";
1579
+ import { Tabs, Empty } from "antd";
1580
+ import {
1581
+ FileOutlined,
1582
+ FileTextOutlined,
1583
+ FileMarkdownOutlined,
1584
+ FileImageOutlined,
1585
+ CodeOutlined as CodeOutlined2,
1586
+ Html5Outlined,
1587
+ FileUnknownOutlined
1588
+ } from "@ant-design/icons";
1589
+ import { createStyles as createStyles5 } from "antd-style";
1590
+ import { jsx as jsx10, jsxs as jsxs6 } from "react/jsx-runtime";
1591
+ var useStyles2 = createStyles5(({ token, css }) => ({
1592
+ container: css`
1593
+ height: 100%;
1594
+ background: ${token.colorBgContainer};
1595
+ border: 1px solid ${token.colorBorder};
1596
+ border-radius: ${token.borderRadiusLG}px;
1597
+ overflow: hidden;
1598
+ display: flex;
1599
+ flex-direction: column;
1600
+ `,
1601
+ tabs: css`
1602
+ height: 100%;
1603
+
1604
+ .ant-tabs-nav {
1605
+ margin-bottom: 0 !important;
1606
+ padding: 0 16px;
1607
+ border-bottom: 1px solid ${token.colorBorderSecondary};
1608
+ }
1609
+
1610
+ .ant-tabs-content-holder {
1611
+ height: 100%;
1612
+ overflow: hidden;
1613
+ }
1614
+
1615
+ .ant-tabs-content {
1616
+ height: 100%;
1617
+ }
1618
+
1619
+ .ant-tabs-tabpane {
1620
+ height: 100%;
1621
+ outline: none;
1622
+ }
1623
+ `,
1624
+ contentBody: css`
1625
+ padding: 24px;
1626
+ height: 100%;
1627
+ overflow-y: auto;
1628
+
1629
+ pre {
1630
+ margin: 0 !important;
1631
+ border-radius: ${token.borderRadius}px !important;
1632
+ }
1633
+ `,
1634
+ emptyState: css`
1635
+ display: flex;
1636
+ flex-direction: column;
1637
+ align-items: center;
1638
+ justify-content: center;
1639
+ height: 100%;
1640
+ color: ${token.colorTextQuaternary};
1641
+ `
1642
+ }));
1643
+ var getFileIcon = (filename) => {
1644
+ const ext = filename.split(".").pop()?.toLowerCase();
1645
+ switch (ext) {
1646
+ case "ts":
1647
+ case "tsx":
1648
+ case "js":
1649
+ case "jsx":
1650
+ return /* @__PURE__ */ jsx10(CodeOutlined2, {});
1651
+ case "html":
1652
+ return /* @__PURE__ */ jsx10(Html5Outlined, {});
1653
+ case "css":
1654
+ case "less":
1655
+ case "scss":
1656
+ return /* @__PURE__ */ jsx10(FileUnknownOutlined, {});
1657
+ // Or a style icon if available
1658
+ case "md":
1659
+ return /* @__PURE__ */ jsx10(FileMarkdownOutlined, {});
1660
+ case "json":
1661
+ return /* @__PURE__ */ jsx10(FileTextOutlined, {});
1662
+ case "png":
1663
+ case "jpg":
1664
+ case "jpeg":
1665
+ case "gif":
1666
+ case "svg":
1667
+ return /* @__PURE__ */ jsx10(FileImageOutlined, {});
1668
+ default:
1669
+ return /* @__PURE__ */ jsx10(FileOutlined, {});
1670
+ }
1671
+ };
1672
+ function getLanguageFromFileName(filename) {
1673
+ const ext = filename.split(".").pop()?.toLowerCase();
1674
+ switch (ext) {
1675
+ case "ts":
1676
+ case "tsx":
1677
+ return "typescript";
1678
+ case "js":
1679
+ case "jsx":
1680
+ return "javascript";
1681
+ case "py":
1682
+ return "python";
1683
+ case "md":
1684
+ return "markdown";
1685
+ case "json":
1686
+ return "json";
1687
+ case "html":
1688
+ return "html";
1689
+ case "css":
1690
+ return "css";
1691
+ case "java":
1692
+ return "java";
1693
+ case "go":
1694
+ return "go";
1695
+ case "rs":
1696
+ return "rust";
1697
+ case "c":
1698
+ return "c";
1699
+ case "cpp":
1700
+ return "cpp";
1701
+ case "yaml":
1702
+ case "yml":
1703
+ return "yaml";
1704
+ case "sql":
1705
+ return "sql";
1706
+ case "sh":
1707
+ case "bash":
1708
+ return "bash";
1709
+ default:
1710
+ return "text";
1711
+ }
1712
+ }
1713
+ var FileExplorer = ({
1714
+ files = [],
1715
+ className,
1716
+ style,
1717
+ title = "EXPLORER"
1718
+ }) => {
1719
+ const { styles, cx } = useStyles2();
1720
+ const [fileList, setFileList] = useState8([]);
1721
+ useEffect5(() => {
1722
+ if (Array.isArray(files)) {
1723
+ setFileList(files);
1724
+ } else {
1725
+ const list = Object.keys(files).map((key) => ({
1726
+ name: key,
1727
+ content: files[key]
1728
+ }));
1729
+ setFileList(list);
1730
+ }
1731
+ }, [files]);
1732
+ const items = useMemo3(() => {
1733
+ return fileList.map((file) => {
1734
+ const language = file.language || getLanguageFromFileName(file.name);
1735
+ const content = `\`\`\`${language}
1736
+ ${file.content}
1737
+ \`\`\``;
1738
+ return {
1739
+ key: file.name,
1740
+ label: /* @__PURE__ */ jsxs6("span", { style: { display: "flex", alignItems: "center", gap: 8 }, children: [
1741
+ getFileIcon(file.name),
1742
+ file.name
1743
+ ] }),
1744
+ children: /* @__PURE__ */ jsx10("div", { className: styles.contentBody, children: /* @__PURE__ */ jsx10(MDResponse, { content }) })
1745
+ };
1746
+ });
1747
+ }, [fileList, styles]);
1748
+ return /* @__PURE__ */ jsx10("div", { className: cx(styles.container, className), style, children: fileList.length > 0 ? /* @__PURE__ */ jsx10(
1749
+ Tabs,
1750
+ {
1751
+ defaultActiveKey: fileList[0]?.name,
1752
+ items,
1753
+ className: styles.tabs,
1754
+ tabBarStyle: { margin: 0 }
1755
+ }
1756
+ ) : /* @__PURE__ */ jsx10("div", { className: styles.emptyState, children: /* @__PURE__ */ jsx10(
1757
+ Empty,
1758
+ {
1759
+ description: "No file selected",
1760
+ image: Empty.PRESENTED_IMAGE_SIMPLE
1761
+ }
1762
+ ) }) });
1763
+ };
1764
+
1765
+ // src/components/Chat/Chating.tsx
1766
+ import { Fragment, jsx as jsx11, jsxs as jsxs7 } from "react/jsx-runtime";
1559
1767
  var LazyBubble = ({
1560
1768
  message: message2,
1561
1769
  renderContent,
1562
1770
  autoLoadRightPanel
1563
1771
  }) => {
1564
1772
  const ref = useRef5(null);
1565
- const [isVisible, setIsVisible] = useState8(false);
1566
- const [wasEverVisible, setWasEverVisible] = useState8(false);
1567
- useEffect5(() => {
1773
+ const [isVisible, setIsVisible] = useState9(false);
1774
+ const [wasEverVisible, setWasEverVisible] = useState9(false);
1775
+ useEffect6(() => {
1568
1776
  const observer = new IntersectionObserver(
1569
1777
  ([entry]) => {
1570
1778
  const visible = entry.isIntersecting;
@@ -1584,21 +1792,21 @@ var LazyBubble = ({
1584
1792
  }
1585
1793
  };
1586
1794
  }, [wasEverVisible]);
1587
- useEffect5(() => {
1795
+ useEffect6(() => {
1588
1796
  autoLoadRightPanel?.();
1589
1797
  }, []);
1590
1798
  const getPlaceholder = () => {
1591
1799
  const estimatedHeight = message2.content ? Math.min(100, message2.content.length / 5) : 100;
1592
- return /* @__PURE__ */ jsx10("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
1800
+ return /* @__PURE__ */ jsx11("div", { style: { height: `${estimatedHeight}px`, minHeight: "50px" } });
1593
1801
  };
1594
- return /* @__PURE__ */ jsx10(ErrorBoundary, { children: /* @__PURE__ */ jsx10("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message2) : getPlaceholder() }) });
1802
+ return /* @__PURE__ */ jsx11(ErrorBoundary, { children: /* @__PURE__ */ jsx11("div", { ref, style: { width: "100%" }, children: isVisible || wasEverVisible ? renderContent(message2) : getPlaceholder() }) });
1595
1803
  };
1596
1804
  var MemoizedBubbleList = memo(
1597
1805
  ({
1598
1806
  items,
1599
1807
  roles,
1600
1808
  className
1601
- }) => /* @__PURE__ */ jsx10(
1809
+ }) => /* @__PURE__ */ jsx11(
1602
1810
  Bubble.List,
1603
1811
  {
1604
1812
  autoScroll: true,
@@ -1631,15 +1839,18 @@ var Chating = ({
1631
1839
  extra,
1632
1840
  attachment_placeholder,
1633
1841
  extraMeta = [],
1634
- uploadAction = "/api/file_storage/upload?path=temp"
1842
+ uploadAction = "/api/file_storage/upload?path=temp",
1843
+ files,
1844
+ todos
1635
1845
  }) => {
1636
1846
  const { t } = useTranslation();
1637
- const [content, setContent] = useState8("");
1638
- const [attachedFiles, setAttachedFiles] = useState8([]);
1639
- const [headerOpen, setHeaderOpen] = useState8(false);
1847
+ const [content, setContent] = useState9("");
1848
+ const [attachedFiles, setAttachedFiles] = useState9([]);
1849
+ const [headerOpen, setHeaderOpen] = useState9(false);
1850
+ const [fileExplorerVisible, setFileExplorerVisible] = useState9(false);
1640
1851
  const attachmentsRef = useRef5(null);
1641
- const senderRef = React2.useRef(null);
1642
- useEffect5(() => {
1852
+ const senderRef = React3.useRef(null);
1853
+ useEffect6(() => {
1643
1854
  regsiterElement("action_show_attachments_uploader", {
1644
1855
  card_view: () => null,
1645
1856
  action: (data) => {
@@ -1649,18 +1860,18 @@ var Chating = ({
1649
1860
  });
1650
1861
  }, []);
1651
1862
  const messageLengthRef = useRef5(messages?.length ?? 0);
1652
- useEffect5(() => {
1863
+ useEffect6(() => {
1653
1864
  if (messages?.length) {
1654
1865
  messageLengthRef.current = messages?.length;
1655
1866
  }
1656
1867
  }, [messages?.length]);
1657
1868
  const renderContent = useCallback5(
1658
1869
  (message2) => {
1659
- const { content: content2, files, id } = message2;
1870
+ const { content: content2, files: files2, id } = message2;
1660
1871
  try {
1661
1872
  const json = JSON.parse(content2);
1662
1873
  if (json.action && json.message) {
1663
- return /* @__PURE__ */ jsx10(
1874
+ return /* @__PURE__ */ jsx11(
1664
1875
  MDResponse,
1665
1876
  {
1666
1877
  content: json.message,
@@ -1676,7 +1887,7 @@ ${JSON.stringify(tool_call)}
1676
1887
  \`\`\``;
1677
1888
  }) || [];
1678
1889
  const content_md = [content2, ...tool_calls_md].join("\n");
1679
- return /* @__PURE__ */ jsx10(Space6, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx10(
1890
+ return /* @__PURE__ */ jsx11(Space6, { direction: "vertical", style: { width: "100%" }, children: /* @__PURE__ */ jsx11(
1680
1891
  MDResponse,
1681
1892
  {
1682
1893
  content: content_md,
@@ -1686,12 +1897,12 @@ ${JSON.stringify(tool_call)}
1686
1897
  },
1687
1898
  [handleMDResponseEvent]
1688
1899
  );
1689
- const items = useMemo3(
1900
+ const items = useMemo4(
1690
1901
  () => messages.map((message2, index) => ({
1691
1902
  key: message2.id,
1692
1903
  role: message2.role,
1693
1904
  typing: false,
1694
- content: /* @__PURE__ */ jsx10(
1905
+ content: /* @__PURE__ */ jsx11(
1695
1906
  LazyBubble,
1696
1907
  {
1697
1908
  message: message2,
@@ -1747,7 +1958,7 @@ ${JSON.stringify(tool_call)}
1747
1958
  if (!nextContent && attachedFiles.length > 0) {
1748
1959
  nextContent = default_submit_message || "\u8BB0\u8D26";
1749
1960
  }
1750
- const files = attachedFiles.map(
1961
+ const files2 = attachedFiles.map(
1751
1962
  (file) => isArchiveFile(file) ? {
1752
1963
  name: file.response.zipFileName || file.response.rarFileName,
1753
1964
  id: file.response.zipFileId || file.response.rarFileId,
@@ -1765,14 +1976,14 @@ ${JSON.stringify(tool_call)}
1765
1976
  id: file.response.id
1766
1977
  }
1767
1978
  );
1768
- const files_md = files.length > 0 ? [
1979
+ const files_md = files2.length > 0 ? [
1769
1980
  "",
1770
1981
  "\u6211\u5DF2\u7ECF\u63D0\u4EA4\u4E86\u4EE5\u4E0B\u6587\u4EF6\uFF1A",
1771
1982
  "```attachments",
1772
- JSON.stringify(files),
1983
+ JSON.stringify(files2),
1773
1984
  "```"
1774
1985
  ].join("\n") : "";
1775
- sendMessage({ input: { message: nextContent + files_md, files } });
1986
+ sendMessage({ input: { message: nextContent + files_md, files: files2 } });
1776
1987
  setContent("");
1777
1988
  setAttachedFiles([]);
1778
1989
  setHeaderOpen(false);
@@ -1804,15 +2015,15 @@ ${JSON.stringify(tool_call)}
1804
2015
  }
1805
2016
  return true;
1806
2017
  };
1807
- const attachmentsNode = /* @__PURE__ */ jsx10(Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ jsx10(
2018
+ const attachmentsNode = /* @__PURE__ */ jsx11(Badge, { dot: attachedFiles.length > 0 && !headerOpen, children: /* @__PURE__ */ jsx11(
1808
2019
  Button3,
1809
2020
  {
1810
2021
  type: "text",
1811
- icon: /* @__PURE__ */ jsx10(PaperClipOutlined, {}),
2022
+ icon: /* @__PURE__ */ jsx11(PaperClipOutlined, {}),
1812
2023
  onClick: () => setHeaderOpen(!headerOpen)
1813
2024
  }
1814
2025
  ) });
1815
- const senderHeader = /* @__PURE__ */ jsx10(
2026
+ const senderHeader = /* @__PURE__ */ jsx11(
1816
2027
  Sender.Header,
1817
2028
  {
1818
2029
  title: "Attachments",
@@ -1824,7 +2035,7 @@ ${JSON.stringify(tool_call)}
1824
2035
  }
1825
2036
  },
1826
2037
  forceRender: true,
1827
- children: /* @__PURE__ */ jsx10(
2038
+ children: /* @__PURE__ */ jsx11(
1828
2039
  Attachments,
1829
2040
  {
1830
2041
  ref: attachmentsRef,
@@ -1846,7 +2057,7 @@ ${JSON.stringify(tool_call)}
1846
2057
  multiple: true,
1847
2058
  maxCount: 10,
1848
2059
  placeholder: (type) => ({
1849
- icon: /* @__PURE__ */ jsx10(CloudUploadOutlined, {}),
2060
+ icon: /* @__PURE__ */ jsx11(CloudUploadOutlined, {}),
1850
2061
  title: "\u4E0A\u4F20\u6587\u4EF6",
1851
2062
  description: attachment_placeholder
1852
2063
  })
@@ -1878,7 +2089,7 @@ ${JSON.stringify(tool_call)}
1878
2089
  }
1879
2090
  }
1880
2091
  };
1881
- const extraMetaComponents = useMemo3(() => {
2092
+ const extraMetaComponents = useMemo4(() => {
1882
2093
  if (extraMeta?.length > 0) {
1883
2094
  return extraMeta.map((meta) => {
1884
2095
  const Element = getElement(meta.id)?.card_view;
@@ -1887,7 +2098,7 @@ ${JSON.stringify(tool_call)}
1887
2098
  try {
1888
2099
  } catch (error2) {
1889
2100
  }
1890
- return /* @__PURE__ */ jsx10(
2101
+ return /* @__PURE__ */ jsx11(
1891
2102
  Element,
1892
2103
  {
1893
2104
  component_key: meta.id,
@@ -1903,20 +2114,63 @@ ${JSON.stringify(tool_call)}
1903
2114
  }
1904
2115
  return void 0;
1905
2116
  }, [extraMeta]);
1906
- return /* @__PURE__ */ jsxs6(Fragment, { children: [
1907
- /* @__PURE__ */ jsxs6("div", { children: [
1908
- /* @__PURE__ */ jsx10(
2117
+ return /* @__PURE__ */ jsxs7(Fragment, { children: [
2118
+ /* @__PURE__ */ jsxs7("div", { children: [
2119
+ /* @__PURE__ */ jsx11(
1909
2120
  Welcome,
1910
2121
  {
1911
2122
  style: { padding: 8 },
1912
2123
  variant: "borderless",
1913
2124
  description,
1914
- icon: /* @__PURE__ */ jsx10(Avatar, { src: avatar || "/images/avatar.jpeg", size: 48 }),
2125
+ icon: /* @__PURE__ */ jsx11(Avatar, { src: avatar || "/images/avatar.jpeg", size: 48 }),
1915
2126
  title: name || "Fina",
1916
- extra: extra || extraMetaComponents && /* @__PURE__ */ jsx10(Space6, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
2127
+ extra: /* @__PURE__ */ jsxs7(Space6, { children: [
2128
+ extra,
2129
+ todos && todos.length > 0 && /* @__PURE__ */ jsx11(
2130
+ Popover,
2131
+ {
2132
+ content: /* @__PURE__ */ jsx11("div", { style: { width: 400 }, children: /* @__PURE__ */ jsx11(
2133
+ Todo,
2134
+ {
2135
+ data: todos,
2136
+ component_key: "header_todos",
2137
+ eventHandler: handleMDResponseEvent
2138
+ }
2139
+ ) }),
2140
+ title: "Todos",
2141
+ trigger: "click",
2142
+ placement: "bottomRight",
2143
+ children: /* @__PURE__ */ jsx11(Tooltip, { title: "Todos", children: /* @__PURE__ */ jsx11(
2144
+ Badge,
2145
+ {
2146
+ count: todos.filter((item) => item.status !== "completed").length,
2147
+ size: "small",
2148
+ children: /* @__PURE__ */ jsx11(Button3, { icon: /* @__PURE__ */ jsx11(CheckSquareOutlined, {}), type: "text" })
2149
+ }
2150
+ ) })
2151
+ }
2152
+ ),
2153
+ files && Object.keys(files).length > 0 && /* @__PURE__ */ jsx11(Tooltip, { title: "File Explorer", children: /* @__PURE__ */ jsx11(
2154
+ Badge,
2155
+ {
2156
+ count: Object.keys(files).length,
2157
+ size: "small",
2158
+ color: "blue",
2159
+ children: /* @__PURE__ */ jsx11(
2160
+ Button3,
2161
+ {
2162
+ type: "text",
2163
+ icon: /* @__PURE__ */ jsx11(FileTextOutlined2, {}),
2164
+ onClick: () => setFileExplorerVisible(true)
2165
+ }
2166
+ )
2167
+ }
2168
+ ) }),
2169
+ extraMetaComponents && /* @__PURE__ */ jsx11(Space6, { align: "center", style: { marginRight: 16 }, children: extraMetaComponents })
2170
+ ] })
1917
2171
  }
1918
2172
  ),
1919
- /* @__PURE__ */ jsx10(
2173
+ /* @__PURE__ */ jsx11(
1920
2174
  "div",
1921
2175
  {
1922
2176
  style: {
@@ -1925,16 +2179,35 @@ ${JSON.stringify(tool_call)}
1925
2179
  }
1926
2180
  )
1927
2181
  ] }),
1928
- items.length > 0 ? /* @__PURE__ */ jsx10(
2182
+ /* @__PURE__ */ jsx11(
2183
+ Modal,
2184
+ {
2185
+ title: "File Explorer",
2186
+ open: fileExplorerVisible,
2187
+ onCancel: () => setFileExplorerVisible(false),
2188
+ footer: null,
2189
+ width: 1e3,
2190
+ destroyOnClose: true,
2191
+ styles: { body: { height: "70vh", padding: 0 } },
2192
+ children: /* @__PURE__ */ jsx11(
2193
+ FileExplorer,
2194
+ {
2195
+ files,
2196
+ style: { height: "100%", border: "none" }
2197
+ }
2198
+ )
2199
+ }
2200
+ ),
2201
+ items.length > 0 ? /* @__PURE__ */ jsx11(
1929
2202
  MemoizedBubbleList,
1930
2203
  {
1931
2204
  items,
1932
2205
  roles,
1933
2206
  className: styles.messages
1934
2207
  }
1935
- ) : /* @__PURE__ */ jsx10("div", { style: { flex: 1 } }),
1936
- isLoading ? /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10(Bubble, { loading: isLoading, variant: "borderless" }) }) : /* @__PURE__ */ jsx10(Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
1937
- error && /* @__PURE__ */ jsx10("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx10(
2208
+ ) : /* @__PURE__ */ jsx11("div", { style: { flex: 1 } }),
2209
+ isLoading ? /* @__PURE__ */ jsx11("div", { children: /* @__PURE__ */ jsx11(Bubble, { loading: isLoading, variant: "borderless" }) }) : /* @__PURE__ */ jsx11(Prompts, { items: senderPromptsItems, onItemClick: onPromptsItemClick }),
2210
+ error && /* @__PURE__ */ jsx11("div", { style: { padding: "0 16px 8px" }, children: /* @__PURE__ */ jsx11(
1938
2211
  Alert2,
1939
2212
  {
1940
2213
  type: "error",
@@ -1944,7 +2217,7 @@ ${JSON.stringify(tool_call)}
1944
2217
  message: `${error.message}`
1945
2218
  }
1946
2219
  ) }),
1947
- /* @__PURE__ */ jsx10(
2220
+ /* @__PURE__ */ jsx11(
1948
2221
  Sender,
1949
2222
  {
1950
2223
  allowSpeech: true,
@@ -1959,7 +2232,7 @@ ${JSON.stringify(tool_call)}
1959
2232
  className: styles.sender,
1960
2233
  actions: (ori, { components }) => {
1961
2234
  const { SendButton, LoadingButton } = components;
1962
- return /* @__PURE__ */ jsx10(Flex3, { justify: "space-between", align: "center", children: isLoading ? /* @__PURE__ */ jsx10(LoadingButton, { type: "default" }) : /* @__PURE__ */ jsx10(
2235
+ return /* @__PURE__ */ jsx11(Flex3, { justify: "space-between", align: "center", children: isLoading ? /* @__PURE__ */ jsx11(LoadingButton, { type: "default" }) : /* @__PURE__ */ jsx11(
1963
2236
  SendButton,
1964
2237
  {
1965
2238
  type: "primary",
@@ -1968,8 +2241,8 @@ ${JSON.stringify(tool_call)}
1968
2241
  }
1969
2242
  ) });
1970
2243
  },
1971
- onPasteFile: (_, files) => {
1972
- Array.from(files).forEach((file) => {
2244
+ onPasteFile: (_, files2) => {
2245
+ Array.from(files2).forEach((file) => {
1973
2246
  attachmentsRef.current?.upload(file);
1974
2247
  });
1975
2248
  setHeaderOpen(true);
@@ -1988,17 +2261,17 @@ import {
1988
2261
  import {
1989
2262
  ThoughtChain
1990
2263
  } from "@ant-design/x";
1991
- import { jsx as jsx11 } from "react/jsx-runtime";
2264
+ import { jsx as jsx12 } from "react/jsx-runtime";
1992
2265
  function getStatusIcon2(status) {
1993
2266
  switch (status) {
1994
2267
  case "success":
1995
- return /* @__PURE__ */ jsx11(CheckCircleOutlined3, {});
2268
+ return /* @__PURE__ */ jsx12(CheckCircleOutlined3, {});
1996
2269
  case "error":
1997
- return /* @__PURE__ */ jsx11(InfoCircleOutlined2, {});
2270
+ return /* @__PURE__ */ jsx12(InfoCircleOutlined2, {});
1998
2271
  case "pending":
1999
- return /* @__PURE__ */ jsx11(LoadingOutlined3, {});
2272
+ return /* @__PURE__ */ jsx12(LoadingOutlined3, {});
2000
2273
  default:
2001
- return /* @__PURE__ */ jsx11(CheckCircleOutlined3, {});
2274
+ return /* @__PURE__ */ jsx12(CheckCircleOutlined3, {});
2002
2275
  }
2003
2276
  }
2004
2277
  var ThinkingChain = ({ message: message2 }) => {
@@ -2007,12 +2280,12 @@ var ThinkingChain = ({ message: message2 }) => {
2007
2280
  {
2008
2281
  key: message2.id,
2009
2282
  title,
2010
- content: /* @__PURE__ */ jsx11(MDResponse, { content: message2.content }),
2283
+ content: /* @__PURE__ */ jsx12(MDResponse, { content: message2.content }),
2011
2284
  status: message2.status,
2012
2285
  icon: getStatusIcon2(message2.status)
2013
2286
  }
2014
2287
  ];
2015
- return /* @__PURE__ */ jsx11(
2288
+ return /* @__PURE__ */ jsx12(
2016
2289
  ThoughtChain,
2017
2290
  {
2018
2291
  items,
@@ -2026,11 +2299,11 @@ var ThinkingChainGroup = ({ message: message2 }) => {
2026
2299
  const children = message2.items?.map((item) => ({
2027
2300
  key: item.id,
2028
2301
  title: item.name || item.content.split("\n")[0],
2029
- content: /* @__PURE__ */ jsx11(MDResponse, { content: item.content }),
2302
+ content: /* @__PURE__ */ jsx12(MDResponse, { content: item.content }),
2030
2303
  status: item.status,
2031
2304
  icon: getStatusIcon2(item.status)
2032
2305
  }));
2033
- return /* @__PURE__ */ jsx11(ThoughtChain, { items: children, collapsible: true, size: "small" });
2306
+ return /* @__PURE__ */ jsx12(ThoughtChain, { items: children, collapsible: true, size: "small" });
2034
2307
  };
2035
2308
 
2036
2309
  // src/components/Chat/SideAppViewBrowser.tsx
@@ -2040,11 +2313,11 @@ import {
2040
2313
  ExpandOutlined,
2041
2314
  FullscreenOutlined
2042
2315
  } from "@ant-design/icons";
2043
- import { Button as Button4, Tabs } from "antd";
2044
- import { createStyles as createStyles5 } from "antd-style";
2045
- import { useEffect as useEffect6, useState as useState9 } from "react";
2046
- import { jsx as jsx12, jsxs as jsxs7 } from "react/jsx-runtime";
2047
- var useStyle4 = createStyles5(({ token, css }) => {
2316
+ import { Button as Button4, Tabs as Tabs2 } from "antd";
2317
+ import { createStyles as createStyles6 } from "antd-style";
2318
+ import { useEffect as useEffect7, useState as useState10 } from "react";
2319
+ import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
2320
+ var useStyle4 = createStyles6(({ token, css }) => {
2048
2321
  return {
2049
2322
  tabContainer: css`
2050
2323
  .ant-tabs-content-holder {
@@ -2063,9 +2336,9 @@ var useStyle4 = createStyles5(({ token, css }) => {
2063
2336
  };
2064
2337
  });
2065
2338
  var EmptySideAppView = ({ component_key, data }) => {
2066
- return /* @__PURE__ */ jsxs7("div", { children: [
2067
- /* @__PURE__ */ jsx12("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
2068
- /* @__PURE__ */ jsx12("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
2339
+ return /* @__PURE__ */ jsxs8("div", { children: [
2340
+ /* @__PURE__ */ jsx13("p", { children: "\u672A\u627E\u5230\u5BF9\u5E94\u7684\u7EC4\u4EF6\u89C6\u56FE" }),
2341
+ /* @__PURE__ */ jsx13("pre", { children: JSON.stringify({ component_key, data }, null, 2) })
2069
2342
  ] });
2070
2343
  };
2071
2344
  var SideAppViewBrowser = ({
@@ -2075,9 +2348,9 @@ var SideAppViewBrowser = ({
2075
2348
  onChangeSize
2076
2349
  }) => {
2077
2350
  const { styles } = useStyle4();
2078
- const [activeKey, setActiveKey] = useState9(JSON.stringify(open_uri));
2079
- const [currentSize, setCurrentSize] = useState9(open_uri.size || "large");
2080
- const [items, setItems] = useState9([]);
2351
+ const [activeKey, setActiveKey] = useState10(JSON.stringify(open_uri));
2352
+ const [currentSize, setCurrentSize] = useState10(open_uri.size || "large");
2353
+ const [items, setItems] = useState10([]);
2081
2354
  const add = (key, label, children) => {
2082
2355
  const newActiveKey = key;
2083
2356
  const newPanes = [...items];
@@ -2113,7 +2386,7 @@ var SideAppViewBrowser = ({
2113
2386
  remove(targetKey);
2114
2387
  }
2115
2388
  };
2116
- useEffect6(() => {
2389
+ useEffect7(() => {
2117
2390
  const SideAppView = getElement(open_uri.component_key).side_app_view || EmptySideAppView;
2118
2391
  const key = JSON.stringify(open_uri);
2119
2392
  if (items.find((item) => item.key === key)) {
@@ -2123,7 +2396,7 @@ var SideAppViewBrowser = ({
2123
2396
  add(
2124
2397
  key,
2125
2398
  open_uri.message || open_uri.data.message || "\u672A\u547D\u540D",
2126
- /* @__PURE__ */ jsx12(
2399
+ /* @__PURE__ */ jsx13(
2127
2400
  SideAppView,
2128
2401
  {
2129
2402
  component_key: open_uri.component_key,
@@ -2133,7 +2406,7 @@ var SideAppViewBrowser = ({
2133
2406
  )
2134
2407
  );
2135
2408
  }, [open_uri]);
2136
- useEffect6(() => {
2409
+ useEffect7(() => {
2137
2410
  if (open_uri.size && open_uri.size !== currentSize) {
2138
2411
  setCurrentSize(open_uri.size);
2139
2412
  }
@@ -2171,25 +2444,25 @@ var SideAppViewBrowser = ({
2171
2444
  const getSizeIcon = (size) => {
2172
2445
  switch (size) {
2173
2446
  case "middle":
2174
- return /* @__PURE__ */ jsx12(CompressOutlined, {});
2447
+ return /* @__PURE__ */ jsx13(CompressOutlined, {});
2175
2448
  case "large":
2176
- return /* @__PURE__ */ jsx12(ExpandOutlined, {});
2449
+ return /* @__PURE__ */ jsx13(ExpandOutlined, {});
2177
2450
  case "full":
2178
- return /* @__PURE__ */ jsx12(FullscreenOutlined, {});
2451
+ return /* @__PURE__ */ jsx13(FullscreenOutlined, {});
2179
2452
  default:
2180
- return /* @__PURE__ */ jsx12(ExpandOutlined, {});
2453
+ return /* @__PURE__ */ jsx13(ExpandOutlined, {});
2181
2454
  }
2182
2455
  };
2183
- return /* @__PURE__ */ jsx12(
2184
- Tabs,
2456
+ return /* @__PURE__ */ jsx13(
2457
+ Tabs2,
2185
2458
  {
2186
2459
  className: styles.tabContainer,
2187
2460
  type: "editable-card",
2188
2461
  style: { height: "100%" },
2189
2462
  hideAdd: true,
2190
2463
  tabBarExtraContent: {
2191
- right: /* @__PURE__ */ jsxs7("div", { style: { display: "flex", gap: "4px" }, children: [
2192
- /* @__PURE__ */ jsx12(
2464
+ right: /* @__PURE__ */ jsxs8("div", { style: { display: "flex", gap: "4px" }, children: [
2465
+ /* @__PURE__ */ jsx13(
2193
2466
  Button4,
2194
2467
  {
2195
2468
  style: { margin: "8px 0" },
@@ -2200,13 +2473,13 @@ var SideAppViewBrowser = ({
2200
2473
  title: `\u5F53\u524D\u5C3A\u5BF8: ${getSizeLabel(currentSize)}, \u70B9\u51FB\u5207\u6362`
2201
2474
  }
2202
2475
  ),
2203
- /* @__PURE__ */ jsx12(
2476
+ /* @__PURE__ */ jsx13(
2204
2477
  Button4,
2205
2478
  {
2206
2479
  style: { margin: "8px 0" },
2207
2480
  size: "large",
2208
2481
  type: "text",
2209
- icon: /* @__PURE__ */ jsx12(CloseOutlined, {}),
2482
+ icon: /* @__PURE__ */ jsx13(CloseOutlined, {}),
2210
2483
  onClick: () => {
2211
2484
  onClose();
2212
2485
  }
@@ -2231,6 +2504,7 @@ var chatContext = createContext2({
2231
2504
  export {
2232
2505
  AxiomLatticeProvider,
2233
2506
  Chating,
2507
+ FileExplorer,
2234
2508
  MDMermaid,
2235
2509
  MDResponse,
2236
2510
  MDViewFormItem,