reachat 1.0.3 → 1.0.5
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/SessionListItem.d.ts +4 -0
- package/dist/docs.json +21 -0
- package/dist/index.js +94 -84
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +93 -83
- package/dist/index.umd.cjs.map +1 -1
- package/dist/theme.d.ts +5 -2
- package/package.json +1 -1
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";
|
|
@@ -11,7 +11,7 @@ import { findAndReplace } from "mdast-util-find-and-replace";
|
|
|
11
11
|
import remarkYoutube from "remark-youtube";
|
|
12
12
|
import { useHotkeys } from "reakeys";
|
|
13
13
|
import { isToday, isYesterday, isThisWeek, isThisMonth, isThisYear, format } from "date-fns";
|
|
14
|
-
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" })));
|
|
15
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" }));
|
|
16
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" }));
|
|
17
17
|
const ChatContext = createContext({
|
|
@@ -63,51 +63,54 @@ const ChatInput = ({
|
|
|
63
63
|
disabled: isLoading || disabled
|
|
64
64
|
}
|
|
65
65
|
),
|
|
66
|
-
|
|
67
|
-
/* @__PURE__ */
|
|
68
|
-
|
|
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,
|
|
69
95
|
{
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
96
|
+
title: "Stop",
|
|
97
|
+
className: cn(theme.input.actions.stop),
|
|
98
|
+
onClick: stopMessage,
|
|
99
|
+
disabled,
|
|
100
|
+
children: stopIcon
|
|
75
101
|
}
|
|
76
102
|
),
|
|
77
103
|
/* @__PURE__ */ jsx(
|
|
78
104
|
Button,
|
|
79
105
|
{
|
|
80
|
-
title: "
|
|
106
|
+
title: "Send",
|
|
107
|
+
className: cn(theme.input.actions.send),
|
|
108
|
+
onClick: handleSendMessage,
|
|
81
109
|
disabled: isLoading || disabled,
|
|
82
|
-
|
|
83
|
-
onClick: () => {
|
|
84
|
-
var _a;
|
|
85
|
-
return (_a = fileInputRef.current) == null ? void 0 : _a.click();
|
|
86
|
-
},
|
|
87
|
-
children: attachIcon
|
|
110
|
+
children: sendIcon
|
|
88
111
|
}
|
|
89
112
|
)
|
|
90
|
-
] })
|
|
91
|
-
isLoading && /* @__PURE__ */ jsx(
|
|
92
|
-
Button,
|
|
93
|
-
{
|
|
94
|
-
title: "Stop",
|
|
95
|
-
className: cn(theme.input.stop),
|
|
96
|
-
onClick: stopMessage,
|
|
97
|
-
disabled,
|
|
98
|
-
children: stopIcon
|
|
99
|
-
}
|
|
100
|
-
),
|
|
101
|
-
/* @__PURE__ */ jsx(
|
|
102
|
-
Button,
|
|
103
|
-
{
|
|
104
|
-
title: "Send",
|
|
105
|
-
className: cn(theme.input.send),
|
|
106
|
-
onClick: handleSendMessage,
|
|
107
|
-
disabled: isLoading || disabled,
|
|
108
|
-
children: sendIcon
|
|
109
|
-
}
|
|
110
|
-
)
|
|
113
|
+
] })
|
|
111
114
|
] });
|
|
112
115
|
};
|
|
113
116
|
const SessionEmpty = ({
|
|
@@ -175,9 +178,6 @@ const SessionMessagePanel = ({ children }) => {
|
|
|
175
178
|
);
|
|
176
179
|
};
|
|
177
180
|
const SvgCopy = (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-copy", ...props }, /* @__PURE__ */ React.createElement("rect", { width: 14, height: 14, x: 8, y: 8, rx: 2, ry: 2 }), /* @__PURE__ */ React.createElement("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" }));
|
|
178
|
-
const SvgThumbsDown = (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-thumbs-down", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M17 14V2" }), /* @__PURE__ */ React.createElement("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }));
|
|
179
|
-
const SvgThumbsUp = (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-thumbs-up", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M7 10v12" }), /* @__PURE__ */ React.createElement("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }));
|
|
180
|
-
const SvgRefresh = (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-refresh-ccw", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ React.createElement("path", { d: "M3 3v5h5" }), /* @__PURE__ */ React.createElement("path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" }), /* @__PURE__ */ React.createElement("path", { d: "M16 16h5v5" }));
|
|
181
181
|
const dark = {
|
|
182
182
|
'code[class*="language-"]': {
|
|
183
183
|
"background": "#11111f",
|
|
@@ -1367,6 +1367,9 @@ const MessageSources = ({
|
|
|
1367
1367
|
}
|
|
1368
1368
|
return sources && sources.length > 0 && /* @__PURE__ */ jsx("div", { className: cn(theme.messages.message.sources.base), children: sources.map((source, index) => /* @__PURE__ */ jsx(Comp, { ...source, children }, index)) });
|
|
1369
1369
|
};
|
|
1370
|
+
const SvgThumbsDown = (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-thumbs-down", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M17 14V2" }), /* @__PURE__ */ React.createElement("path", { d: "M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z" }));
|
|
1371
|
+
const SvgThumbsUp = (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-thumbs-up", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M7 10v12" }), /* @__PURE__ */ React.createElement("path", { d: "M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z" }));
|
|
1372
|
+
const SvgRefresh = (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-refresh-ccw", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8" }), /* @__PURE__ */ React.createElement("path", { d: "M3 3v5h5" }), /* @__PURE__ */ React.createElement("path", { d: "M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16" }), /* @__PURE__ */ React.createElement("path", { d: "M16 16h5v5" }));
|
|
1370
1373
|
const MessageActions = ({
|
|
1371
1374
|
children,
|
|
1372
1375
|
...props
|
|
@@ -1459,29 +1462,28 @@ const SessionMessage = ({
|
|
|
1459
1462
|
children
|
|
1460
1463
|
}) => {
|
|
1461
1464
|
const { theme, isLoading } = useContext(ChatContext);
|
|
1462
|
-
return /* @__PURE__ */
|
|
1463
|
-
/* @__PURE__ */ jsx(
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
] }) }) }, conversation.id);
|
|
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
|
+
}
|
|
1483
|
+
)
|
|
1484
|
+
] }) }),
|
|
1485
|
+
!isLast && /* @__PURE__ */ jsx(Divider, {})
|
|
1486
|
+
] }, conversation.id);
|
|
1485
1487
|
};
|
|
1486
1488
|
const containerVariants = {
|
|
1487
1489
|
hidden: {},
|
|
@@ -1558,13 +1560,13 @@ const chatTheme = {
|
|
|
1558
1560
|
empty: "text-center flex-1",
|
|
1559
1561
|
sessions: {
|
|
1560
1562
|
base: "overflow-auto",
|
|
1561
|
-
console: "min-w-[150px] w-[30%] max-w-[300px] bg-[#11111F] p-5 rounded",
|
|
1563
|
+
console: "min-w-[150px] w-[30%] max-w-[300px] bg-[#11111F] p-5 rounded-3xl",
|
|
1562
1564
|
companion: "w-full h-full",
|
|
1563
|
-
group: "text-xs text-gray-400 mt-4",
|
|
1564
|
-
create: "mb-4",
|
|
1565
|
+
group: "text-xs text-gray-400 mt-4 hover:bg-transparent mb-1",
|
|
1566
|
+
create: "relative mb-4 rounded-[10px]",
|
|
1565
1567
|
session: {
|
|
1566
|
-
base: "",
|
|
1567
|
-
active: " text-
|
|
1568
|
+
base: "my-1 rounded-[10px] p-2 text-typography hover:bg-gray-800/50 border border-transparent hover:border-gray-700/50",
|
|
1569
|
+
active: "bg-gray-800/70 border border-gray-700/70 hover:bg-gray-800/50 border-gray-700/50 text-white",
|
|
1568
1570
|
delete: "[&>svg]:w-4 [&>svg]:h-4 opacity-50"
|
|
1569
1571
|
}
|
|
1570
1572
|
},
|
|
@@ -1580,8 +1582,8 @@ const chatTheme = {
|
|
|
1580
1582
|
header: "flex justify-between items-start gap-2",
|
|
1581
1583
|
showMore: "mb-4",
|
|
1582
1584
|
message: {
|
|
1583
|
-
base: "mb-
|
|
1584
|
-
question: "font-semibold text-gray-400 mb-1",
|
|
1585
|
+
base: "mt-4 mb-4 flex flex-col p-0 rounded border-none",
|
|
1586
|
+
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",
|
|
1585
1587
|
response: "",
|
|
1586
1588
|
cursor: "inline-block w-1 h-4 bg-current",
|
|
1587
1589
|
files: {
|
|
@@ -1613,20 +1615,23 @@ const chatTheme = {
|
|
|
1613
1615
|
ol: "mb-4 list-decimal"
|
|
1614
1616
|
},
|
|
1615
1617
|
footer: {
|
|
1616
|
-
base: "mt-3 flex gap-
|
|
1617
|
-
copy: "[&>svg]:w-4 [&>svg]:h-4 opacity-50",
|
|
1618
|
-
upvote: "[&>svg]:w-4 [&>svg]:h-4 opacity-50",
|
|
1619
|
-
downvote: "[&>svg]:w-4 [&>svg]:h-4 opacity-50",
|
|
1620
|
-
refresh: "[&>svg]:w-4 [&>svg]:h-4 opacity-50"
|
|
1618
|
+
base: "mt-3 flex gap-1.5",
|
|
1619
|
+
copy: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white",
|
|
1620
|
+
upvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white",
|
|
1621
|
+
downvote: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white",
|
|
1622
|
+
refresh: "p-3 rounded-[10px] [&>svg]:w-4 [&>svg]:h-4 opacity-50 hover:!opacity-100 hover:bg-gray-700/40 hover:text-white"
|
|
1621
1623
|
}
|
|
1622
1624
|
}
|
|
1623
1625
|
},
|
|
1624
1626
|
input: {
|
|
1625
|
-
base: "flex mt-4",
|
|
1626
|
-
upload: "px-
|
|
1627
|
-
input: "w-full",
|
|
1628
|
-
|
|
1629
|
-
|
|
1627
|
+
base: "flex mt-4 relative",
|
|
1628
|
+
upload: "px-5 py-2 text-white size-10",
|
|
1629
|
+
input: "w-full text-typography border border-gray-700/70 rounded-3xl px-3 py-2 pr-16 after:!mx-10 [&>textarea]:w-full [&>textarea]:flex-none",
|
|
1630
|
+
actions: {
|
|
1631
|
+
base: "absolute flex gap-2 items-center right-5 inset-y-1/2 -translate-y-1/2 z-10",
|
|
1632
|
+
send: "px-3 py-3 text-white bg-gray-800 hover:bg-primary-hover rounded-full ",
|
|
1633
|
+
stop: "px-2 py-2 bg-red-500 text-white rounded-full hover:bg-red-700 "
|
|
1634
|
+
}
|
|
1630
1635
|
}
|
|
1631
1636
|
};
|
|
1632
1637
|
const useDimensions = () => {
|
|
@@ -1780,12 +1785,14 @@ const SessionsList = ({ children }) => {
|
|
|
1780
1785
|
);
|
|
1781
1786
|
};
|
|
1782
1787
|
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 }));
|
|
1788
|
+
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" }));
|
|
1783
1789
|
const SessionListItem = ({
|
|
1784
1790
|
children,
|
|
1785
1791
|
session,
|
|
1786
1792
|
deletable = true,
|
|
1787
1793
|
limit = 100,
|
|
1788
|
-
deleteIcon = /* @__PURE__ */ jsx(SvgTrash, {})
|
|
1794
|
+
deleteIcon = /* @__PURE__ */ jsx(SvgTrash, {}),
|
|
1795
|
+
chatIcon = /* @__PURE__ */ jsx(SvgChat, { className: "mr-2" })
|
|
1789
1796
|
}) => {
|
|
1790
1797
|
const { activeSessionId, selectSession, deleteSession, theme } = useContext(ChatContext);
|
|
1791
1798
|
const Comp = children ? Slot : ListItem;
|
|
@@ -1799,6 +1806,7 @@ const SessionListItem = ({
|
|
|
1799
1806
|
[theme.sessions.session.active]: session.id === activeSessionId
|
|
1800
1807
|
}),
|
|
1801
1808
|
onClick: () => selectSession == null ? void 0 : selectSession(session.id),
|
|
1809
|
+
start: chatIcon,
|
|
1802
1810
|
end: /* @__PURE__ */ jsx(Fragment, { children: deletable && /* @__PURE__ */ jsx(
|
|
1803
1811
|
IconButton,
|
|
1804
1812
|
{
|
|
@@ -1816,24 +1824,26 @@ const SessionListItem = ({
|
|
|
1816
1824
|
}
|
|
1817
1825
|
);
|
|
1818
1826
|
};
|
|
1827
|
+
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" })));
|
|
1819
1828
|
const NewSessionButton = ({
|
|
1820
1829
|
children,
|
|
1821
1830
|
newSessionText = "New Session"
|
|
1822
1831
|
}) => {
|
|
1823
1832
|
const { theme, createSession, disabled } = useContext(ChatContext);
|
|
1824
1833
|
const Comp = children ? Slot : Button;
|
|
1825
|
-
return /* @__PURE__ */ jsx(
|
|
1834
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
|
1826
1835
|
Comp,
|
|
1827
1836
|
{
|
|
1828
1837
|
fullWidth: true,
|
|
1829
1838
|
disableMargins: true,
|
|
1830
1839
|
color: "primary",
|
|
1840
|
+
startAdornment: /* @__PURE__ */ jsx(SvgPlus, {}),
|
|
1831
1841
|
className: cn(theme.sessions.create),
|
|
1832
1842
|
disabled,
|
|
1833
1843
|
onClick: createSession,
|
|
1834
1844
|
children: children || newSessionText
|
|
1835
1845
|
}
|
|
1836
|
-
);
|
|
1846
|
+
) });
|
|
1837
1847
|
};
|
|
1838
1848
|
const sortOrder = [
|
|
1839
1849
|
"Today",
|