reachat 1.0.7 → 1.1.0
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/Chat.d.ts +7 -4
- package/dist/ChatContext.d.ts +2 -0
- package/dist/docs.json +2 -2
- package/dist/index.js +11 -9
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +11 -9
- package/dist/index.umd.cjs.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.cjs
CHANGED
|
@@ -146,9 +146,9 @@
|
|
|
146
146
|
};
|
|
147
147
|
const SvgBack = (props) => /* @__PURE__ */ React__namespace.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-chevron-left", ...props }, /* @__PURE__ */ React__namespace.createElement("path", { d: "m15 18-6-6 6-6" }));
|
|
148
148
|
const SessionMessagePanel = ({ children }) => {
|
|
149
|
-
const { activeSessionId, theme, isCompact, selectSession } = React.useContext(ChatContext);
|
|
150
|
-
const isVisible = isCompact && activeSessionId;
|
|
151
|
-
return
|
|
149
|
+
const { activeSessionId, theme, isCompact, selectSession, viewType } = React.useContext(ChatContext);
|
|
150
|
+
const isVisible = isCompact && activeSessionId || viewType === "chat" || !isCompact;
|
|
151
|
+
return isVisible && /* @__PURE__ */ jsxRuntime.jsx(
|
|
152
152
|
framerMotion.motion.div,
|
|
153
153
|
{
|
|
154
154
|
initial: { translateX: "200%" },
|
|
@@ -167,7 +167,7 @@
|
|
|
167
167
|
[theme.messages.console]: !isCompact
|
|
168
168
|
}),
|
|
169
169
|
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: reablocks.cn(theme.messages.inner), children: [
|
|
170
|
-
isCompact && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
170
|
+
isCompact && viewType !== "chat" && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
171
171
|
reablocks.Button,
|
|
172
172
|
{
|
|
173
173
|
variant: "text",
|
|
@@ -1525,7 +1525,7 @@ ${response}`),
|
|
|
1525
1525
|
}
|
|
1526
1526
|
}, [activeSession, isAnimating]);
|
|
1527
1527
|
function handleShowMore() {
|
|
1528
|
-
showNext(
|
|
1528
|
+
showNext(limit);
|
|
1529
1529
|
requestAnimationFrame(() => contentRef.current.scrollTop = 0);
|
|
1530
1530
|
}
|
|
1531
1531
|
const reversedConvos = React.useMemo(
|
|
@@ -1534,7 +1534,7 @@ ${response}`),
|
|
|
1534
1534
|
);
|
|
1535
1535
|
const { data, hasMore, showNext } = reablocks.useInfinityList({
|
|
1536
1536
|
items: reversedConvos,
|
|
1537
|
-
limit
|
|
1537
|
+
size: limit
|
|
1538
1538
|
});
|
|
1539
1539
|
const reReversedConvo = React.useMemo(() => [...data].reverse(), [data]);
|
|
1540
1540
|
const convosToRender = limit ? reReversedConvo : activeSession == null ? void 0 : activeSession.conversations;
|
|
@@ -1559,7 +1559,7 @@ ${response}`),
|
|
|
1559
1559
|
initial: "hidden",
|
|
1560
1560
|
animate: "visible",
|
|
1561
1561
|
onAnimationComplete: () => {
|
|
1562
|
-
setIsAnimating(false);
|
|
1562
|
+
requestAnimationFrame(() => setIsAnimating(false));
|
|
1563
1563
|
},
|
|
1564
1564
|
children: children(convosToRender)
|
|
1565
1565
|
},
|
|
@@ -1569,7 +1569,7 @@ ${response}`),
|
|
|
1569
1569
|
};
|
|
1570
1570
|
const chatTheme = {
|
|
1571
1571
|
base: "dark:text-white text-gray-500",
|
|
1572
|
-
console: "flex w-full gap-
|
|
1572
|
+
console: "flex w-full gap-4 h-full",
|
|
1573
1573
|
companion: "w-full h-full overflow-hidden",
|
|
1574
1574
|
empty: "text-center flex-1",
|
|
1575
1575
|
sessions: {
|
|
@@ -1593,7 +1593,7 @@ ${response}`),
|
|
|
1593
1593
|
},
|
|
1594
1594
|
messages: {
|
|
1595
1595
|
base: "",
|
|
1596
|
-
console: "flex flex-col
|
|
1596
|
+
console: "flex flex-col mx-5 flex-1 overflow-hidden",
|
|
1597
1597
|
companion: "flex w-full h-full",
|
|
1598
1598
|
back: "self-start p-0 my-2",
|
|
1599
1599
|
inner: "flex-1 h-full flex flex-col",
|
|
@@ -1767,6 +1767,7 @@ ${response}`),
|
|
|
1767
1767
|
disabled,
|
|
1768
1768
|
isLoading,
|
|
1769
1769
|
isCompact,
|
|
1770
|
+
viewType,
|
|
1770
1771
|
activeSessionId: internalActiveSessionID,
|
|
1771
1772
|
selectSession: handleSelectSession,
|
|
1772
1773
|
deleteSession: handleDeleteSession,
|
|
@@ -1778,6 +1779,7 @@ ${response}`),
|
|
|
1778
1779
|
[
|
|
1779
1780
|
isLoading,
|
|
1780
1781
|
isCompact,
|
|
1782
|
+
viewType,
|
|
1781
1783
|
disabled,
|
|
1782
1784
|
theme,
|
|
1783
1785
|
remarkPlugins,
|