@axiom-lattice/react-sdk 2.1.19 → 2.1.21

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 CHANGED
@@ -430,6 +430,7 @@ type AgentChatProps = {
430
430
  thread_id?: string;
431
431
  assistant_id: string;
432
432
  menu?: React__default.ReactNode;
433
+ header?: React__default.ReactNode;
433
434
  } & ChatingProps;
434
435
  declare const LatticeChat: React__default.FC<AgentChatProps>;
435
436
 
package/dist/index.d.ts CHANGED
@@ -430,6 +430,7 @@ type AgentChatProps = {
430
430
  thread_id?: string;
431
431
  assistant_id: string;
432
432
  menu?: React__default.ReactNode;
433
+ header?: React__default.ReactNode;
433
434
  } & ChatingProps;
434
435
  declare const LatticeChat: React__default.FC<AgentChatProps>;
435
436
 
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: 16px;
1028
- gap: 16px;
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: -16px;
1049
+ margin-left: -8px;
1050
1050
  height: 100%;
1051
1051
  }
1052
1052
 
1053
1053
  &.collapsed {
1054
- width: 16px;
1054
+ width: 8px;
1055
1055
  height: 100%;
1056
- margin-right: -16px;
1056
+ margin-right: -8px;
1057
1057
  .ant-conversations {
1058
1058
  width: 64px;
1059
1059
  }
@@ -3802,7 +3802,17 @@ var AgentHeader = (props) => {
3802
3802
  style: { padding: 8 },
3803
3803
  variant: "borderless",
3804
3804
  description: description ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(Text10, { ellipsis: { tooltip: description }, children: description }) : void 0,
3805
- icon: 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() }),
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
+ ),
3806
3816
  title: name ? name : void 0,
3807
3817
  extra: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_antd18.Space, { children: [
3808
3818
  extra,
@@ -4494,7 +4504,7 @@ var SideAppViewBrowser = () => {
4494
4504
  // src/components/Chat/LatticeChat.tsx
4495
4505
  var import_jsx_runtime34 = require("react/jsx-runtime");
4496
4506
  var LatticeChat = (props) => {
4497
- const { assistant_id, thread_id = "", menu, ...chatingProps } = props;
4507
+ const { assistant_id, thread_id = "", menu, header, ...chatingProps } = props;
4498
4508
  return /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4499
4509
  AgentThreadProvider,
4500
4510
  {
@@ -4505,12 +4515,26 @@ var LatticeChat = (props) => {
4505
4515
  enableReturnStateWhenStreamCompleted: true,
4506
4516
  enableResumeStream: true
4507
4517
  },
4508
- children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
4509
- ColumnLayout,
4518
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(ChatUIContextProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
4519
+ "div",
4510
4520
  {
4511
- menu,
4512
- 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" }),
4513
- right: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(SideAppViewBrowser, {})
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
+ ]
4514
4538
  }
4515
4539
  ) })
4516
4540
  }
@@ -5302,6 +5326,11 @@ var useStyles3 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
5302
5326
  background: transparent;
5303
5327
  border-radius: ${token.borderRadiusLG}px;
5304
5328
  overflow: visible;
5329
+
5330
+ &.firstTimeHighlight {
5331
+ border: 2px dashed ${token.colorPrimary};
5332
+ background: ${token.colorPrimaryBg};
5333
+ }
5305
5334
  `,
5306
5335
  content: css`
5307
5336
  flex: 1;
@@ -5460,8 +5489,34 @@ var useStyles3 = (0, import_antd_style11.createStyles)(({ token, css }) => ({
5460
5489
  divider: css`
5461
5490
  margin: ${token.marginMD}px 0;
5462
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
+ }
5463
5517
  `
5464
5518
  }));
5519
+ var FIRST_COLLAPSE_KEY = "chat-sidebar-first-collapse-seen";
5465
5520
  var ChatSidebar = ({
5466
5521
  onSettingsClick,
5467
5522
  defaultCollapsed = false
@@ -5470,6 +5525,8 @@ var ChatSidebar = ({
5470
5525
  const { setMenuCollapsed, menuCollapsed, sideAppVisible } = useChatUIContext();
5471
5526
  const { setSettingsModalOpen } = useLatticeChatShellContext();
5472
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);
5473
5530
  const handleToggleCollapse = () => {
5474
5531
  setMenuCollapsed(!menuCollapsed);
5475
5532
  };
@@ -5478,56 +5535,88 @@ var ChatSidebar = ({
5478
5535
  onSettingsClick?.();
5479
5536
  };
5480
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]);
5481
5555
  const handleMouseEnter = () => {
5482
5556
  if (isCollapsed) {
5483
5557
  setIsHovered(true);
5558
+ if (isFirstCollapse) {
5559
+ localStorage.setItem(FIRST_COLLAPSE_KEY, "true");
5560
+ setIsFirstCollapse(false);
5561
+ }
5484
5562
  }
5485
5563
  };
5486
5564
  const handleMouseLeave = () => {
5487
5565
  setIsHovered(false);
5488
5566
  };
5489
5567
  return /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
5490
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5568
+ /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(
5491
5569
  "div",
5492
5570
  {
5493
- className: styles.sidebar,
5571
+ className: `${styles.sidebar} ${isFirstCollapse ? "firstTimeHighlight" : ""}`,
5494
5572
  onMouseEnter: handleMouseEnter,
5495
5573
  onMouseLeave: handleMouseLeave,
5496
- children: !isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(import_jsx_runtime40.Fragment, { children: [
5497
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.content, children: [
5498
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
5499
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Assistants" }),
5500
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AssistantList, {})
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
+ ] })
5501
5595
  ] }),
5502
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_antd25.Divider, { className: styles.divider }),
5503
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.section, children: [
5504
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)("div", { className: styles.sectionTitle, children: "Threads" }),
5505
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(AgentConversations, {})
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
+ )
5506
5617
  ] })
5507
- ] }),
5508
- /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)("div", { className: styles.footer, children: [
5509
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5510
- "button",
5511
- {
5512
- className: styles.actionButton,
5513
- onClick: handleToggleCollapse,
5514
- title: isCollapsed ? "Expand sidebar" : "Collapse sidebar",
5515
- "aria-label": isCollapsed ? "Expand sidebar" : "Collapse sidebar",
5516
- children: isCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuUnfoldOutlined, {}) : /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.MenuFoldOutlined, {})
5517
- }
5518
- ),
5519
- /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(
5520
- "button",
5521
- {
5522
- className: styles.actionButton,
5523
- onClick: handleSettingsClick,
5524
- title: "Settings",
5525
- "aria-label": "Settings",
5526
- children: /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(import_icons14.SettingOutlined, {})
5527
- }
5528
- )
5529
5618
  ] })
5530
- ] })
5619
+ ]
5531
5620
  }
5532
5621
  ),
5533
5622
  isCollapsed && /* @__PURE__ */ (0, import_jsx_runtime40.jsxs)(