@axiom-lattice/react-sdk 2.1.18 → 2.1.20
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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +138 -47
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +210 -119
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -1024,8 +1024,8 @@ var useStyle = (0, import_antd_style.createStyles)(({ token, css }) => {
|
|
|
1024
1024
|
font-family: ${token.fontFamily}, sans-serif;
|
|
1025
1025
|
position: relative;
|
|
1026
1026
|
overflow: hidden;
|
|
1027
|
-
padding:
|
|
1028
|
-
gap:
|
|
1027
|
+
padding: 8px;
|
|
1028
|
+
gap: 8px;
|
|
1029
1029
|
|
|
1030
1030
|
.ant-prompts {
|
|
1031
1031
|
color: ${token.colorText};
|
|
@@ -1046,14 +1046,14 @@ var useStyle = (0, import_antd_style.createStyles)(({ token, css }) => {
|
|
|
1046
1046
|
&.open {
|
|
1047
1047
|
background: transparent;
|
|
1048
1048
|
box-shadow: none;
|
|
1049
|
-
margin-left: -
|
|
1049
|
+
margin-left: -8px;
|
|
1050
1050
|
height: 100%;
|
|
1051
1051
|
}
|
|
1052
1052
|
|
|
1053
1053
|
&.collapsed {
|
|
1054
|
-
width:
|
|
1054
|
+
width: 8px;
|
|
1055
1055
|
height: 100%;
|
|
1056
|
-
margin-right: -
|
|
1056
|
+
margin-right: -8px;
|
|
1057
1057
|
.ant-conversations {
|
|
1058
1058
|
width: 64px;
|
|
1059
1059
|
}
|
|
@@ -1568,6 +1568,7 @@ var mdComponents = {
|
|
|
1568
1568
|
|
|
1569
1569
|
// src/components/GenUI/MDResponse.tsx
|
|
1570
1570
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1571
|
+
var memoizedMdComponents = mdComponents;
|
|
1571
1572
|
var useStyles = (0, import_antd_style2.createStyles)(({ token, css }) => ({
|
|
1572
1573
|
markdownTableContainer: css`
|
|
1573
1574
|
overflow-x: auto;
|
|
@@ -1657,10 +1658,11 @@ var MDResponse = ({
|
|
|
1657
1658
|
noGenUI
|
|
1658
1659
|
}) => {
|
|
1659
1660
|
const { styles } = useStyles();
|
|
1661
|
+
const stableComponents = (0, import_react9.useMemo)(() => memoizedMdComponents, []);
|
|
1660
1662
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: styles.markdownContainer, children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1661
1663
|
import_x_markdown.default,
|
|
1662
1664
|
{
|
|
1663
|
-
components:
|
|
1665
|
+
components: stableComponents,
|
|
1664
1666
|
content,
|
|
1665
1667
|
paragraphTag: "div"
|
|
1666
1668
|
}
|
|
@@ -3800,7 +3802,17 @@ var AgentHeader = (props) => {
|
|
|
3800
3802
|
style: { padding: 8 },
|
|
3801
3803
|
variant: "borderless",
|
|
3802
3804
|
description: description ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text10, { ellipsis: { tooltip: description }, children: description }) : void 0,
|
|
3803
|
-
icon:
|
|
3805
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
|
|
3806
|
+
"div",
|
|
3807
|
+
{
|
|
3808
|
+
style: {
|
|
3809
|
+
display: "flex",
|
|
3810
|
+
alignItems: "center",
|
|
3811
|
+
justifyContent: "center"
|
|
3812
|
+
},
|
|
3813
|
+
children: avatar ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Avatar, { src: avatar, size: 48 }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_antd18.Avatar, { size: 48, children: name?.charAt(0).toUpperCase() })
|
|
3814
|
+
}
|
|
3815
|
+
),
|
|
3804
3816
|
title: name ? name : void 0,
|
|
3805
3817
|
extra: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_antd18.Space, { children: [
|
|
3806
3818
|
extra,
|
|
@@ -4492,7 +4504,7 @@ var SideAppViewBrowser = () => {
|
|
|
4492
4504
|
// src/components/Chat/LatticeChat.tsx
|
|
4493
4505
|
var import_jsx_runtime34 = require("react/jsx-runtime");
|
|
4494
4506
|
var LatticeChat = (props) => {
|
|
4495
|
-
const { assistant_id, thread_id = "", menu, ...chatingProps } = props;
|
|
4507
|
+
const { assistant_id, thread_id = "", menu, header, ...chatingProps } = props;
|
|
4496
4508
|
return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4497
4509
|
AgentThreadProvider,
|
|
4498
4510
|
{
|
|
@@ -4503,12 +4515,26 @@ var LatticeChat = (props) => {
|
|
|
4503
4515
|
enableReturnStateWhenStreamCompleted: true,
|
|
4504
4516
|
enableResumeStream: true
|
|
4505
4517
|
},
|
|
4506
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.
|
|
4507
|
-
|
|
4518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
|
|
4519
|
+
"div",
|
|
4508
4520
|
{
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4521
|
+
style: {
|
|
4522
|
+
display: "flex",
|
|
4523
|
+
flexDirection: "column",
|
|
4524
|
+
width: "100%",
|
|
4525
|
+
height: "100%"
|
|
4526
|
+
},
|
|
4527
|
+
children: [
|
|
4528
|
+
header,
|
|
4529
|
+
/* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
|
|
4530
|
+
ColumnLayout,
|
|
4531
|
+
{
|
|
4532
|
+
menu,
|
|
4533
|
+
left: thread_id ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(Chating, { ...chatingProps }) : /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("div", { children: "\u9700\u8981\u5148\u521B\u5EFA\u4F1A\u8BDD" }),
|
|
4534
|
+
right: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SideAppViewBrowser, {})
|
|
4535
|
+
}
|
|
4536
|
+
)
|
|
4537
|
+
]
|
|
4512
4538
|
}
|
|
4513
4539
|
) })
|
|
4514
4540
|
}
|
|
@@ -5300,6 +5326,11 @@ var useStyles3 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
|
|
|
5300
5326
|
background: transparent;
|
|
5301
5327
|
border-radius: ${token.borderRadiusLG}px;
|
|
5302
5328
|
overflow: visible;
|
|
5329
|
+
|
|
5330
|
+
&.firstTimeHighlight {
|
|
5331
|
+
border: 2px dashed ${token.colorPrimary};
|
|
5332
|
+
background: ${token.colorPrimaryBg};
|
|
5333
|
+
}
|
|
5303
5334
|
`,
|
|
5304
5335
|
content: css`
|
|
5305
5336
|
flex: 1;
|
|
@@ -5458,8 +5489,34 @@ var useStyles3 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
|
|
|
5458
5489
|
divider: css`
|
|
5459
5490
|
margin: ${token.marginMD}px 0;
|
|
5460
5491
|
border-color: ${token.colorBorderSecondary};
|
|
5492
|
+
`,
|
|
5493
|
+
hintTooltip: css`
|
|
5494
|
+
position: absolute;
|
|
5495
|
+
top: ${token.paddingMD}px;
|
|
5496
|
+
left: ${token.paddingMD}px;
|
|
5497
|
+
right: ${token.paddingMD}px;
|
|
5498
|
+
padding: ${token.paddingSM}px ${token.paddingMD}px;
|
|
5499
|
+
background: ${token.colorPrimary};
|
|
5500
|
+
color: ${token.colorTextLightSolid};
|
|
5501
|
+
border-radius: ${token.borderRadius}px;
|
|
5502
|
+
font-size: ${token.fontSizeSM}px;
|
|
5503
|
+
z-index: 1001;
|
|
5504
|
+
animation: slideIn 0.3s ease-out;
|
|
5505
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
5506
|
+
|
|
5507
|
+
@keyframes slideIn {
|
|
5508
|
+
from {
|
|
5509
|
+
opacity: 0;
|
|
5510
|
+
transform: translateY(-10px);
|
|
5511
|
+
}
|
|
5512
|
+
to {
|
|
5513
|
+
opacity: 1;
|
|
5514
|
+
transform: translateY(0);
|
|
5515
|
+
}
|
|
5516
|
+
}
|
|
5461
5517
|
`
|
|
5462
5518
|
}));
|
|
5519
|
+
var FIRST_COLLAPSE_KEY = "chat-sidebar-first-collapse-seen";
|
|
5463
5520
|
var ChatSidebar = ({
|
|
5464
5521
|
onSettingsClick,
|
|
5465
5522
|
defaultCollapsed = false
|
|
@@ -5468,6 +5525,8 @@ var ChatSidebar = ({
|
|
|
5468
5525
|
const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
|
|
5469
5526
|
const { setSettingsModalOpen } = useLatticeChatShellContext();
|
|
5470
5527
|
const [isHovered, setIsHovered] = (0, import_react24.useState)(false);
|
|
5528
|
+
const [isFirstCollapse, setIsFirstCollapse] = (0, import_react24.useState)(false);
|
|
5529
|
+
const prevIsCollapsedRef = (0, import_react24.useRef)(false);
|
|
5471
5530
|
const handleToggleCollapse = () => {
|
|
5472
5531
|
setMenuCollapsed(!menuCollapsed);
|
|
5473
5532
|
};
|
|
@@ -5476,56 +5535,88 @@ var ChatSidebar = ({
|
|
|
5476
5535
|
onSettingsClick?.();
|
|
5477
5536
|
};
|
|
5478
5537
|
const isCollapsed = menuCollapsed || sideAppVisible;
|
|
5538
|
+
(0, import_react24.useEffect)(() => {
|
|
5539
|
+
const prevIsCollapsed = prevIsCollapsedRef.current;
|
|
5540
|
+
if (isCollapsed) {
|
|
5541
|
+
const hasSeenFirstCollapse = localStorage.getItem(FIRST_COLLAPSE_KEY);
|
|
5542
|
+
if (!hasSeenFirstCollapse) {
|
|
5543
|
+
setIsFirstCollapse(true);
|
|
5544
|
+
}
|
|
5545
|
+
} else if (prevIsCollapsed && !isCollapsed) {
|
|
5546
|
+
setIsFirstCollapse((prev) => {
|
|
5547
|
+
if (prev) {
|
|
5548
|
+
return false;
|
|
5549
|
+
}
|
|
5550
|
+
return prev;
|
|
5551
|
+
});
|
|
5552
|
+
}
|
|
5553
|
+
prevIsCollapsedRef.current = isCollapsed;
|
|
5554
|
+
}, [isCollapsed]);
|
|
5479
5555
|
const handleMouseEnter = () => {
|
|
5480
5556
|
if (isCollapsed) {
|
|
5481
5557
|
setIsHovered(true);
|
|
5558
|
+
if (isFirstCollapse) {
|
|
5559
|
+
localStorage.setItem(FIRST_COLLAPSE_KEY, "true");
|
|
5560
|
+
setIsFirstCollapse(false);
|
|
5561
|
+
}
|
|
5482
5562
|
}
|
|
5483
5563
|
};
|
|
5484
5564
|
const handleMouseLeave = () => {
|
|
5485
5565
|
setIsHovered(false);
|
|
5486
5566
|
};
|
|
5487
5567
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
5488
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.
|
|
5568
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|
|
5489
5569
|
"div",
|
|
5490
5570
|
{
|
|
5491
|
-
className: styles.sidebar
|
|
5571
|
+
className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
|
|
5492
5572
|
onMouseEnter: handleMouseEnter,
|
|
5493
5573
|
onMouseLeave: handleMouseLeave,
|
|
5494
|
-
children:
|
|
5495
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.
|
|
5496
|
-
|
|
5497
|
-
|
|
5498
|
-
|
|
5574
|
+
children: [
|
|
5575
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5576
|
+
import_antd25.Tooltip,
|
|
5577
|
+
{
|
|
5578
|
+
title: "Move the mouse over the collapsed sidebar to see the assistants and threads",
|
|
5579
|
+
open: isFirstCollapse,
|
|
5580
|
+
placement: "right",
|
|
5581
|
+
children: isFirstCollapse && /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { style: { marginTop: "400px" } })
|
|
5582
|
+
}
|
|
5583
|
+
),
|
|
5584
|
+
!isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
|
|
5585
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.content, children: [
|
|
5586
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5587
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
|
|
5588
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantList, {})
|
|
5589
|
+
] }),
|
|
5590
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_antd25.Divider, { className: styles.divider }),
|
|
5591
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
|
|
5592
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
|
|
5593
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AgentConversations, {})
|
|
5594
|
+
] })
|
|
5499
5595
|
] }),
|
|
5500
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.
|
|
5501
|
-
|
|
5502
|
-
|
|
5503
|
-
|
|
5596
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
|
|
5597
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5598
|
+
"button",
|
|
5599
|
+
{
|
|
5600
|
+
className: styles.actionButton,
|
|
5601
|
+
onClick: handleToggleCollapse,
|
|
5602
|
+
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5603
|
+
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5604
|
+
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
|
|
5605
|
+
}
|
|
5606
|
+
),
|
|
5607
|
+
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5608
|
+
"button",
|
|
5609
|
+
{
|
|
5610
|
+
className: styles.actionButton,
|
|
5611
|
+
onClick: handleSettingsClick,
|
|
5612
|
+
title: "Settings",
|
|
5613
|
+
"aria-label": "Settings",
|
|
5614
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
|
|
5615
|
+
}
|
|
5616
|
+
)
|
|
5504
5617
|
] })
|
|
5505
|
-
] }),
|
|
5506
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
|
|
5507
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5508
|
-
"button",
|
|
5509
|
-
{
|
|
5510
|
-
className: styles.actionButton,
|
|
5511
|
-
onClick: handleToggleCollapse,
|
|
5512
|
-
title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5513
|
-
"aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
|
|
5514
|
-
children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
|
|
5515
|
-
}
|
|
5516
|
-
),
|
|
5517
|
-
/* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
|
|
5518
|
-
"button",
|
|
5519
|
-
{
|
|
5520
|
-
className: styles.actionButton,
|
|
5521
|
-
onClick: handleSettingsClick,
|
|
5522
|
-
title: "Settings",
|
|
5523
|
-
"aria-label": "Settings",
|
|
5524
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
|
|
5525
|
-
}
|
|
5526
|
-
)
|
|
5527
5618
|
] })
|
|
5528
|
-
]
|
|
5619
|
+
]
|
|
5529
5620
|
}
|
|
5530
5621
|
),
|
|
5531
5622
|
isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
|