reachat 1.0.2 → 1.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/SessionsList/SessionGroups.d.ts +1 -1
- package/dist/SessionsList/SessionListItem.d.ts +4 -0
- package/dist/docs.json +21 -0
- package/dist/index.js +115 -82
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +116 -82
- package/dist/index.umd.cjs.map +1 -1
- package/dist/theme.d.ts +5 -2
- package/dist/{utils.d.ts → utils/grouping.d.ts} +1 -1
- package/dist/utils/useDimensions.d.ts +4 -0
- package/package.json +1 -2
- /package/dist/{utils.spec.d.ts → utils/grouping.spec.d.ts} +0 -0
package/dist/docs.json
CHANGED
|
@@ -825,6 +825,27 @@
|
|
|
825
825
|
"name": "ReactElement<any, string | JSXElementConstructor<any>>"
|
|
826
826
|
}
|
|
827
827
|
},
|
|
828
|
+
"chatIcon": {
|
|
829
|
+
"defaultValue": {
|
|
830
|
+
"value": "<ChatIcon className=\"mr-2\" />"
|
|
831
|
+
},
|
|
832
|
+
"description": "Icon to show for chat.",
|
|
833
|
+
"name": "chatIcon",
|
|
834
|
+
"parent": {
|
|
835
|
+
"fileName": "src/SessionsList/SessionListItem.tsx",
|
|
836
|
+
"name": "SessionListItemProps"
|
|
837
|
+
},
|
|
838
|
+
"declarations": [
|
|
839
|
+
{
|
|
840
|
+
"fileName": "src/SessionsList/SessionListItem.tsx",
|
|
841
|
+
"name": "SessionListItemProps"
|
|
842
|
+
}
|
|
843
|
+
],
|
|
844
|
+
"required": false,
|
|
845
|
+
"type": {
|
|
846
|
+
"name": "ReactElement<any, string | JSXElementConstructor<any>>"
|
|
847
|
+
}
|
|
848
|
+
},
|
|
828
849
|
"limit": {
|
|
829
850
|
"defaultValue": {
|
|
830
851
|
"value": "100"
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { createContext, useContext, useState, useRef, useEffect, useMemo, useCallback } from "react";
|
|
4
|
-
import { cn, Textarea, Button, Ellipsis, DateFormat, IconButton, Card, useInfinityList, useComponentTheme, List, ListItem } from "reablocks";
|
|
4
|
+
import { cn, Textarea, Button, Ellipsis, DateFormat, IconButton, Card, Divider, useInfinityList, useComponentTheme, List, ListItem } from "reablocks";
|
|
5
5
|
import { Slot } from "@radix-ui/react-slot";
|
|
6
6
|
import { motion, AnimatePresence } from "framer-motion";
|
|
7
7
|
import ReactMarkdown from "react-markdown";
|
|
@@ -10,9 +10,8 @@ import { Prism } from "react-syntax-highlighter";
|
|
|
10
10
|
import { findAndReplace } from "mdast-util-find-and-replace";
|
|
11
11
|
import remarkYoutube from "remark-youtube";
|
|
12
12
|
import { useHotkeys } from "reakeys";
|
|
13
|
-
import useDimensions from "react-cool-dimensions";
|
|
14
13
|
import { isToday, isYesterday, isThisWeek, isThisMonth, isThisYear, format } from "date-fns";
|
|
15
|
-
const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", {
|
|
14
|
+
const SvgSend = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "send" }, /* @__PURE__ */ React.createElement("path", { id: "Vector", d: "M14.6111 2.33327C14.5349 2.3339 14.4598 2.35194 14.3917 2.386L2.39168 8.386C2.31456 8.42456 2.24872 8.4824 2.20055 8.55391C2.15238 8.62543 2.12352 8.70818 2.11677 8.79414C2.11002 8.88009 2.12561 8.96634 2.16203 9.04449C2.19845 9.12264 2.25446 9.19005 2.32462 9.24017L4.52514 10.8124L5.47371 13.6581C5.50257 13.7447 5.55457 13.8217 5.62406 13.8808C5.69355 13.9399 5.7779 13.9789 5.86796 13.9935C5.95802 14.0082 6.05036 13.9979 6.13499 13.9638C6.21962 13.9297 6.2933 13.873 6.34806 13.8001L7.05249 12.8606L10.3207 15.2376C10.3843 15.2839 10.4579 15.3146 10.5355 15.3271C10.6132 15.3396 10.6927 15.3336 10.7676 15.3097C10.8425 15.2857 10.9107 15.2444 10.9667 15.1891C11.0226 15.1338 11.0647 15.0661 11.0896 14.9915L15.0896 2.99147C15.1148 2.91597 15.1216 2.83555 15.1094 2.7569C15.0972 2.67825 15.0665 2.60363 15.0197 2.53926C14.9729 2.47488 14.9114 2.42261 14.8403 2.38678C14.7693 2.35096 14.6907 2.33261 14.6111 2.33327ZM13.2478 5.35345L10.3565 14.0266L7.67293 12.0755L13.2478 5.35345ZM10.684 5.35801L4.934 9.87559L3.58113 8.90879L10.684 5.35801ZM11.2784 6.16205L6.56746 11.843C6.56681 11.8437 6.56616 11.8443 6.56551 11.845L6.56355 11.8476C6.55841 11.8538 6.55342 11.8601 6.54858 11.8665C6.54319 11.8733 6.53798 11.8802 6.53295 11.8873L6.12085 12.4361L5.53426 10.6751L11.2784 6.16205Z", fill: "currentColor" })));
|
|
16
15
|
const SvgStop = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-octagon-x", ...props }, /* @__PURE__ */ React.createElement("path", { d: "m15 9-6 6" }), /* @__PURE__ */ React.createElement("path", { d: "M2.586 16.726A2 2 0 0 1 2 15.312V8.688a2 2 0 0 1 .586-1.414l4.688-4.688A2 2 0 0 1 8.688 2h6.624a2 2 0 0 1 1.414.586l4.688 4.688A2 2 0 0 1 22 8.688v6.624a2 2 0 0 1-.586 1.414l-4.688 4.688a2 2 0 0 1-1.414.586H8.688a2 2 0 0 1-1.414-.586z" }), /* @__PURE__ */ React.createElement("path", { d: "m9 9 6 6" }));
|
|
17
16
|
const SvgPaperclip = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-paperclip", ...props }, /* @__PURE__ */ React.createElement("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }));
|
|
18
17
|
const ChatContext = createContext({
|
|
@@ -64,51 +63,54 @@ const ChatInput = ({
|
|
|
64
63
|
disabled: isLoading || disabled
|
|
65
64
|
}
|
|
66
65
|
),
|
|
67
|
-
|
|
68
|
-
/* @__PURE__ */
|
|
69
|
-
|
|
66
|
+
/* @__PURE__ */ jsxs("div", { className: cn(theme.input.actions.base), children: [
|
|
67
|
+
(allowedFiles == null ? void 0 : allowedFiles.length) > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
68
|
+
/* @__PURE__ */ jsx(
|
|
69
|
+
"input",
|
|
70
|
+
{
|
|
71
|
+
type: "file",
|
|
72
|
+
ref: fileInputRef,
|
|
73
|
+
className: "hidden",
|
|
74
|
+
accept: allowedFiles.join(","),
|
|
75
|
+
onChange: handleFileUpload
|
|
76
|
+
}
|
|
77
|
+
),
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
Button,
|
|
80
|
+
{
|
|
81
|
+
title: "Upload",
|
|
82
|
+
variant: "text",
|
|
83
|
+
disabled: isLoading || disabled,
|
|
84
|
+
className: cn(theme.input.upload),
|
|
85
|
+
onClick: () => {
|
|
86
|
+
var _a;
|
|
87
|
+
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
88
|
+
},
|
|
89
|
+
children: attachIcon
|
|
90
|
+
}
|
|
91
|
+
)
|
|
92
|
+
] }),
|
|
93
|
+
isLoading && /* @__PURE__ */ jsx(
|
|
94
|
+
Button,
|
|
70
95
|
{
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
96
|
+
title: "Stop",
|
|
97
|
+
className: cn(theme.input.actions.stop),
|
|
98
|
+
onClick: stopMessage,
|
|
99
|
+
disabled,
|
|
100
|
+
children: stopIcon
|
|
76
101
|
}
|
|
77
102
|
),
|
|
78
103
|
/* @__PURE__ */ jsx(
|
|
79
104
|
Button,
|
|
80
105
|
{
|
|
81
|
-
title: "
|
|
106
|
+
title: "Send",
|
|
107
|
+
className: cn(theme.input.actions.send),
|
|
108
|
+
onClick: handleSendMessage,
|
|
82
109
|
disabled: isLoading || disabled,
|
|
83
|
-
|
|
84
|
-
onClick: () => {
|
|
85
|
-
var _a;
|
|
86
|
-
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
87
|
-
},
|
|
88
|
-
children: attachIcon
|
|
110
|
+
children: sendIcon
|
|
89
111
|
}
|
|
90
112
|
)
|
|
91
|
-
] })
|
|
92
|
-
isLoading && /* @__PURE__ */ jsx(
|
|
93
|
-
Button,
|
|
94
|
-
{
|
|
95
|
-
title: "Stop",
|
|
96
|
-
className: cn(theme.input.stop),
|
|
97
|
-
onClick: stopMessage,
|
|
98
|
-
disabled,
|
|
99
|
-
children: stopIcon
|
|
100
|
-
}
|
|
101
|
-
),
|
|
102
|
-
/* @__PURE__ */ jsx(
|
|
103
|
-
Button,
|
|
104
|
-
{
|
|
105
|
-
title: "Send",
|
|
106
|
-
className: cn(theme.input.send),
|
|
107
|
-
onClick: handleSendMessage,
|
|
108
|
-
disabled: isLoading || disabled,
|
|
109
|
-
children: sendIcon
|
|
110
|
-
}
|
|
111
|
-
)
|
|
113
|
+
] })
|
|
112
114
|
] });
|
|
113
115
|
};
|
|
114
116
|
const SessionEmpty = ({
|
|
@@ -1460,29 +1462,32 @@ const SessionMessage = ({
|
|
|
1460
1462
|
children
|
|
1461
1463
|
}) => {
|
|
1462
1464
|
const { theme, isLoading } = useContext(ChatContext);
|
|
1463
|
-
return /* @__PURE__ */
|
|
1464
|
-
/* @__PURE__ */ jsx(
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1465
|
+
return /* @__PURE__ */ jsxs(motion.div, { variants: messageVariants, children: [
|
|
1466
|
+
/* @__PURE__ */ jsx(Card, { className: cn(theme.messages.message.base), children: children || /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1467
|
+
/* @__PURE__ */ jsx(MessageFiles, { files: conversation.files }),
|
|
1468
|
+
/* @__PURE__ */ jsx(MessageQuestion, { question: conversation.question }),
|
|
1469
|
+
/* @__PURE__ */ jsx(
|
|
1470
|
+
MessageResponse,
|
|
1471
|
+
{
|
|
1472
|
+
response: conversation.response,
|
|
1473
|
+
isLoading: isLast && isLoading
|
|
1474
|
+
}
|
|
1475
|
+
),
|
|
1476
|
+
/* @__PURE__ */ jsx(MessageSources, { sources: conversation.sources }),
|
|
1477
|
+
/* @__PURE__ */ jsx(
|
|
1478
|
+
MessageActions,
|
|
1479
|
+
{
|
|
1480
|
+
question: conversation.question,
|
|
1481
|
+
response: conversation.response,
|
|
1482
|
+
copyIcon: /* @__PURE__ */ jsx(SvgCopy, {}),
|
|
1483
|
+
thumbsUpIcon: /* @__PURE__ */ jsx(SvgThumbsUp, {}),
|
|
1484
|
+
thumbsDownIcon: /* @__PURE__ */ jsx(SvgThumbsDown, {}),
|
|
1485
|
+
refreshIcon: /* @__PURE__ */ jsx(SvgRefresh, {})
|
|
1486
|
+
}
|
|
1487
|
+
)
|
|
1488
|
+
] }) }),
|
|
1489
|
+
!isLast && /* @__PURE__ */ jsx(Divider, {})
|
|
1490
|
+
] }, conversation.id);
|
|
1486
1491
|
};
|
|
1487
1492
|
const containerVariants = {
|
|
1488
1493
|
hidden: {},
|
|
@@ -1559,13 +1564,13 @@ const chatTheme = {
|
|
|
1559
1564
|
empty: "text-center flex-1",
|
|
1560
1565
|
sessions: {
|
|
1561
1566
|
base: "overflow-auto",
|
|
1562
|
-
console: "min-w-[150px] w-[30%] max-w-[300px] bg-[#11111F] p-5 rounded",
|
|
1567
|
+
console: "min-w-[150px] w-[30%] max-w-[300px] bg-[#11111F] p-5 rounded-3xl",
|
|
1563
1568
|
companion: "w-full h-full",
|
|
1564
|
-
group: "text-xs text-gray-400 mt-4",
|
|
1565
|
-
create: "mb-4",
|
|
1569
|
+
group: "text-xs text-gray-400 mt-4 hover:bg-transparent mb-1",
|
|
1570
|
+
create: "relative mb-4 rounded-[10px]",
|
|
1566
1571
|
session: {
|
|
1567
|
-
base: "",
|
|
1568
|
-
active: " text-
|
|
1572
|
+
base: "my-1 rounded-[10px] p-2 text-typography hover:bg-gray-800/50 border border-transparent hover:border-gray-700/50",
|
|
1573
|
+
active: "bg-gray-800/70 border border-gray-700/70 hover:bg-gray-800/50 border-gray-700/50 text-white",
|
|
1569
1574
|
delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-50"
|
|
1570
1575
|
}
|
|
1571
1576
|
},
|
|
@@ -1581,8 +1586,8 @@ const chatTheme = {
|
|
|
1581
1586
|
header: "flex justify-between items-start gap-2",
|
|
1582
1587
|
showMore: "mb-4",
|
|
1583
1588
|
message: {
|
|
1584
|
-
base: "mb-
|
|
1585
|
-
question: "font-semibold text-gray-400 mb-1",
|
|
1589
|
+
base: "mt-4 mb-4 flex flex-col p-0 rounded border-none",
|
|
1590
|
+
question: "font-semibold text-gray-400 mb-4 px-4 py-3 pb-1 rounded-3xl rounded-br-none text-typography bg-gray-900/60 border border-gray-700/50",
|
|
1586
1591
|
response: "",
|
|
1587
1592
|
cursor: "inline-block w-1 h-4 bg-current",
|
|
1588
1593
|
files: {
|
|
@@ -1614,22 +1619,45 @@ const chatTheme = {
|
|
|
1614
1619
|
ol: "mb-4 list-decimal"
|
|
1615
1620
|
},
|
|
1616
1621
|
footer: {
|
|
1617
|
-
base: "mt-3 flex gap-
|
|
1618
|
-
copy: "[&>svg]:w-4 [&>svg]:h-4 opacity-50",
|
|
1619
|
-
upvote: "[&>svg]:w-4 [&>svg]:h-4 opacity-50",
|
|
1620
|
-
downvote: "[&>svg]:w-4 [&>svg]:h-4 opacity-50",
|
|
1621
|
-
refresh: "[&>svg]:w-4 [&>svg]:h-4 opacity-50"
|
|
1622
|
+
base: "mt-3 flex gap-1.5",
|
|
1623
|
+
copy: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white",
|
|
1624
|
+
upvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white",
|
|
1625
|
+
downvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white",
|
|
1626
|
+
refresh: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white"
|
|
1622
1627
|
}
|
|
1623
1628
|
}
|
|
1624
1629
|
},
|
|
1625
1630
|
input: {
|
|
1626
|
-
base: "flex mt-4",
|
|
1627
|
-
upload: "px-
|
|
1628
|
-
input: "w-full",
|
|
1629
|
-
|
|
1630
|
-
|
|
1631
|
+
base: "flex mt-4 relative",
|
|
1632
|
+
upload: "px-5 py-2 text-white size-10",
|
|
1633
|
+
input: "w-full text-typography border border-gray-700/70 rounded-3xl px-3 py-2 pr-16 after:!mx-10 [&>textarea]:w-full",
|
|
1634
|
+
actions: {
|
|
1635
|
+
base: "absolute flex gap-2 items-center right-5 top-[50%] -translate-y-1/2 z-10",
|
|
1636
|
+
send: "px-3 py-3 text-white bg-gray-800 hover:bg-primary-hover rounded-full ",
|
|
1637
|
+
stop: "px-2 py-2 bg-red-500 text-white rounded-full hover:bg-red-700 "
|
|
1638
|
+
}
|
|
1631
1639
|
}
|
|
1632
1640
|
};
|
|
1641
|
+
const useDimensions = () => {
|
|
1642
|
+
const [ref, setRef] = useState(null);
|
|
1643
|
+
const [width, setWidth] = useState(void 0);
|
|
1644
|
+
const observe = useCallback((element) => {
|
|
1645
|
+
if (element) setRef(element);
|
|
1646
|
+
}, []);
|
|
1647
|
+
useEffect(() => {
|
|
1648
|
+
if (!ref) return;
|
|
1649
|
+
const resizeObserver = new ResizeObserver((entries) => {
|
|
1650
|
+
for (let entry of entries) {
|
|
1651
|
+
setWidth(entry.contentRect.width);
|
|
1652
|
+
}
|
|
1653
|
+
});
|
|
1654
|
+
resizeObserver.observe(ref);
|
|
1655
|
+
return () => {
|
|
1656
|
+
resizeObserver.disconnect();
|
|
1657
|
+
};
|
|
1658
|
+
}, [ref]);
|
|
1659
|
+
return { width, observe };
|
|
1660
|
+
};
|
|
1633
1661
|
const Chat = ({
|
|
1634
1662
|
children,
|
|
1635
1663
|
viewType = "console",
|
|
@@ -1761,12 +1789,14 @@ const SessionsList = ({ children }) => {
|
|
|
1761
1789
|
);
|
|
1762
1790
|
};
|
|
1763
1791
|
const SvgTrash = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 1, strokeLinecap: "round", strokeLinejoin: "round", className: "lucide lucide-trash-2", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M3 6h18" }), /* @__PURE__ */ React.createElement("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }), /* @__PURE__ */ React.createElement("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }), /* @__PURE__ */ React.createElement("line", { x1: 10, x2: 10, y1: 11, y2: 17 }), /* @__PURE__ */ React.createElement("line", { x1: 14, x2: 14, y1: 11, y2: 17 }));
|
|
1792
|
+
const SvgChat = (props) => /* @__PURE__ */ React.createElement("svg", { width: 16, height: 17, viewBox: "0 0 16 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M8 3C4.55375 3 1.75 5.23753 1.75 7.98828C1.75 9.70653 2.83659 11.2762 4.62109 12.188C4.11184 13.0465 3.62587 13.7378 3.62012 13.7461C3.50687 13.9071 3.49862 14.1196 3.59912 14.2891C3.69012 14.4418 3.8543 14.5342 4.0293 14.5342C4.0483 14.5342 4.06743 14.533 4.08643 14.5308C4.15168 14.5233 5.66214 14.3364 7.50439 12.9604C7.67239 12.9712 7.8385 12.9766 8 12.9766C11.4462 12.9766 14.25 10.739 14.25 7.98828C14.25 5.23753 11.4462 3 8 3ZM8 4C10.8948 4 13.25 5.78903 13.25 7.98828C13.25 10.1875 10.8948 11.9766 8 11.9766C7.8055 11.9766 7.60225 11.968 7.396 11.9497C7.271 11.9382 7.1454 11.9752 7.0459 12.0527C6.3589 12.5855 5.72033 12.9308 5.20508 13.1528C5.38383 12.8648 5.57691 12.5418 5.76416 12.2061C5.83416 12.0813 5.84705 11.9324 5.7998 11.7974C5.75255 11.6624 5.64983 11.5542 5.51758 11.5C3.81033 10.7993 2.75 9.45328 2.75 7.98828C2.75 5.78903 5.10525 4 8 4ZM5.5 7.25C5.08575 7.25 4.75 7.58575 4.75 8C4.75 8.41425 5.08575 8.75 5.5 8.75C5.91425 8.75 6.25 8.41425 6.25 8C6.25 7.58575 5.91425 7.25 5.5 7.25ZM8 7.25C7.58575 7.25 7.25 7.58575 7.25 8C7.25 8.41425 7.58575 8.75 8 8.75C8.41425 8.75 8.75 8.41425 8.75 8C8.75 7.58575 8.41425 7.25 8 7.25ZM10.5 7.25C10.0857 7.25 9.75 7.58575 9.75 8C9.75 8.41425 10.0857 8.75 10.5 8.75C10.9143 8.75 11.25 8.41425 11.25 8C11.25 7.58575 10.9143 7.25 10.5 7.25Z", fill: "currentColor" }));
|
|
1764
1793
|
const SessionListItem = ({
|
|
1765
1794
|
children,
|
|
1766
1795
|
session,
|
|
1767
1796
|
deletable = true,
|
|
1768
1797
|
limit = 100,
|
|
1769
|
-
deleteIcon = /* @__PURE__ */ jsx(SvgTrash, {})
|
|
1798
|
+
deleteIcon = /* @__PURE__ */ jsx(SvgTrash, {}),
|
|
1799
|
+
chatIcon = /* @__PURE__ */ jsx(SvgChat, { className: "mr-2" })
|
|
1770
1800
|
}) => {
|
|
1771
1801
|
const { activeSessionId, selectSession, deleteSession, theme } = useContext(ChatContext);
|
|
1772
1802
|
const Comp = children ? Slot : ListItem;
|
|
@@ -1780,6 +1810,7 @@ const SessionListItem = ({
|
|
|
1780
1810
|
[theme.sessions.session.active]: session.id === activeSessionId
|
|
1781
1811
|
}),
|
|
1782
1812
|
onClick: () => selectSession == null ? void 0 : selectSession(session.id),
|
|
1813
|
+
start: chatIcon,
|
|
1783
1814
|
end: /* @__PURE__ */ jsx(Fragment, { children: deletable && /* @__PURE__ */ jsx(
|
|
1784
1815
|
IconButton,
|
|
1785
1816
|
{
|
|
@@ -1797,24 +1828,26 @@ const SessionListItem = ({
|
|
|
1797
1828
|
}
|
|
1798
1829
|
);
|
|
1799
1830
|
};
|
|
1831
|
+
const SvgPlus = (props) => /* @__PURE__ */ React.createElement("svg", { width: 17, height: 17, viewBox: "0 0 17 17", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, /* @__PURE__ */ React.createElement("g", { id: "add" }, /* @__PURE__ */ React.createElement("path", { id: "Vector", d: "M13.1667 9.16658H9.16671V13.1666H7.83337V9.16658H3.83337V7.83325H7.83337V3.83325H9.16671V7.83325H13.1667V9.16658Z", fill: "currentColor" })));
|
|
1800
1832
|
const NewSessionButton = ({
|
|
1801
1833
|
children,
|
|
1802
1834
|
newSessionText = "New Session"
|
|
1803
1835
|
}) => {
|
|
1804
1836
|
const { theme, createSession, disabled } = useContext(ChatContext);
|
|
1805
1837
|
const Comp = children ? Slot : Button;
|
|
1806
|
-
return /* @__PURE__ */ jsx(
|
|
1838
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1807
1839
|
Comp,
|
|
1808
1840
|
{
|
|
1809
1841
|
fullWidth: true,
|
|
1810
1842
|
disableMargins: true,
|
|
1811
1843
|
color: "primary",
|
|
1844
|
+
startAdornment: /* @__PURE__ */ jsx(SvgPlus, {}),
|
|
1812
1845
|
className: cn(theme.sessions.create),
|
|
1813
1846
|
disabled,
|
|
1814
1847
|
onClick: createSession,
|
|
1815
1848
|
children: children || newSessionText
|
|
1816
1849
|
}
|
|
1817
|
-
);
|
|
1850
|
+
) });
|
|
1818
1851
|
};
|
|
1819
1852
|
const sortOrder = [
|
|
1820
1853
|
"Today",
|