@iota-uz/sdk 0.4.14 → 0.4.16
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/bichat/index.cjs +156 -114
- package/dist/bichat/index.cjs.map +1 -1
- package/dist/bichat/index.d.cts +3 -1
- package/dist/bichat/index.d.ts +3 -1
- package/dist/bichat/index.mjs +156 -114
- package/dist/bichat/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/compiled.css +1 -1
- package/tailwind/iota.css +22 -0
package/dist/bichat/index.cjs
CHANGED
|
@@ -2194,11 +2194,12 @@ function ChatHeader({ session, onBack, readOnly, logoSlot, actionsSlot }) {
|
|
|
2194
2194
|
actionsSlot && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: actionsSlot })
|
|
2195
2195
|
] }) });
|
|
2196
2196
|
}
|
|
2197
|
+
const resolvedSessionTitle = session.title?.trim() || t("BiChat.Chat.NewChat");
|
|
2197
2198
|
return /* @__PURE__ */ jsxRuntime.jsx("header", { className: "bichat-header border-b border-gray-200 dark:border-gray-700 px-4 py-3", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between", children: [
|
|
2198
2199
|
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-3", children: [
|
|
2199
2200
|
BackButton,
|
|
2200
2201
|
Logo,
|
|
2201
|
-
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-lg font-semibold text-[var(--bichat-text)]", children:
|
|
2202
|
+
/* @__PURE__ */ jsxRuntime.jsx("h1", { className: "text-lg font-semibold text-[var(--bichat-text)]", children: resolvedSessionTitle }),
|
|
2202
2203
|
session.pinned && /* @__PURE__ */ jsxRuntime.jsx(
|
|
2203
2204
|
"svg",
|
|
2204
2205
|
{
|
|
@@ -4240,7 +4241,8 @@ function AssistantTurnView({
|
|
|
4240
4241
|
classNames,
|
|
4241
4242
|
hideAvatar,
|
|
4242
4243
|
hideActions,
|
|
4243
|
-
hideTimestamp
|
|
4244
|
+
hideTimestamp,
|
|
4245
|
+
allowRegenerate = true
|
|
4244
4246
|
}) {
|
|
4245
4247
|
const { debugMode } = useChatSession();
|
|
4246
4248
|
const { handleCopy, handleRegenerate, pendingQuestion, sendMessage, loading } = useChatMessaging();
|
|
@@ -4269,7 +4271,7 @@ function AssistantTurnView({
|
|
|
4269
4271
|
slots,
|
|
4270
4272
|
classNames,
|
|
4271
4273
|
onCopy: handleCopy,
|
|
4272
|
-
onRegenerate: handleRegenerate,
|
|
4274
|
+
onRegenerate: allowRegenerate ? handleRegenerate : void 0,
|
|
4273
4275
|
onSendMessage: sendMessage,
|
|
4274
4276
|
sendDisabled: loading || isStreaming,
|
|
4275
4277
|
hideAvatar,
|
|
@@ -4785,8 +4787,8 @@ function MessageList({ renderUserTurn, renderAssistantTurn, thinkingVerbs, readO
|
|
|
4785
4787
|
isLastTurn: index === turns.length - 1,
|
|
4786
4788
|
renderUserTurn,
|
|
4787
4789
|
renderAssistantTurn,
|
|
4788
|
-
userTurnProps: readOnly ? {
|
|
4789
|
-
assistantTurnProps: readOnly ? {
|
|
4790
|
+
userTurnProps: readOnly ? { allowEdit: false } : { allowEdit: index === turns.length - 1 },
|
|
4791
|
+
assistantTurnProps: readOnly ? { allowRegenerate: false } : void 0
|
|
4790
4792
|
},
|
|
4791
4793
|
turn.id
|
|
4792
4794
|
)),
|
|
@@ -6928,11 +6930,15 @@ function ChatSessionCore({
|
|
|
6928
6930
|
setRestoring(true);
|
|
6929
6931
|
try {
|
|
6930
6932
|
await dataSource.unarchiveSession(session.id);
|
|
6933
|
+
retryFetchSession();
|
|
6934
|
+
window.dispatchEvent(new CustomEvent("bichat:sessions-updated", {
|
|
6935
|
+
detail: { reason: "restored", sessionId: session.id }
|
|
6936
|
+
}));
|
|
6931
6937
|
onSessionRestored?.(session.id);
|
|
6932
6938
|
} finally {
|
|
6933
6939
|
setRestoring(false);
|
|
6934
6940
|
}
|
|
6935
|
-
}, [dataSource, session?.id
|
|
6941
|
+
}, [dataSource, onSessionRestored, retryFetchSession, session?.id]);
|
|
6936
6942
|
const [artifactsPanelExpanded, setArtifactsPanelExpanded] = React.useState(
|
|
6937
6943
|
artifactsPanelDefaultExpanded
|
|
6938
6944
|
);
|
|
@@ -7430,7 +7436,11 @@ var EditableText = React.forwardRef(
|
|
|
7430
7436
|
"div",
|
|
7431
7437
|
{
|
|
7432
7438
|
className: "flex items-center gap-2 flex-1",
|
|
7433
|
-
onClick: (e) =>
|
|
7439
|
+
onClick: (e) => {
|
|
7440
|
+
e.preventDefault();
|
|
7441
|
+
e.stopPropagation();
|
|
7442
|
+
},
|
|
7443
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
7434
7444
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
7435
7445
|
"input",
|
|
7436
7446
|
{
|
|
@@ -7442,6 +7452,8 @@ var EditableText = React.forwardRef(
|
|
|
7442
7452
|
onBlur: handleBlur,
|
|
7443
7453
|
maxLength,
|
|
7444
7454
|
placeholder: resolvedPlaceholder,
|
|
7455
|
+
onClick: (e) => e.stopPropagation(),
|
|
7456
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
7445
7457
|
className: `flex-1 px-2 py-1 ${sizeClass} bg-white dark:bg-gray-700 border border-primary-500 dark:border-primary-600 rounded-lg focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-primary-500/50 dark:focus-visible:ring-primary-600/30 text-gray-900 dark:text-white ${inputClassName}`,
|
|
7446
7458
|
"aria-label": t("BiChat.EditableText.AriaLabel")
|
|
7447
7459
|
}
|
|
@@ -7902,8 +7914,8 @@ function ConfirmModalBase({
|
|
|
7902
7914
|
isDanger = false
|
|
7903
7915
|
}) {
|
|
7904
7916
|
const { t } = useTranslation();
|
|
7905
|
-
const resolvedConfirmText = confirmText
|
|
7906
|
-
const resolvedCancelText = cancelText
|
|
7917
|
+
const resolvedConfirmText = confirmText?.trim() ? confirmText : t("BiChat.Common.Confirm");
|
|
7918
|
+
const resolvedCancelText = cancelText?.trim() ? cancelText : t("BiChat.Common.Cancel");
|
|
7907
7919
|
return /* @__PURE__ */ jsxRuntime.jsxs(react$1.Dialog, { open: isOpen, onClose: onCancel, className: "relative z-40", children: [
|
|
7908
7920
|
/* @__PURE__ */ jsxRuntime.jsx(react$1.DialogBackdrop, { className: "fixed inset-0 bg-black/40 dark:bg-black/60 backdrop-blur-sm transition-opacity duration-200" }),
|
|
7909
7921
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 flex items-center justify-center z-50 p-4", children: /* @__PURE__ */ jsxRuntime.jsxs(react$1.DialogPanel, { className: "bg-white dark:bg-gray-800 rounded-2xl shadow-xl dark:shadow-2xl dark:shadow-black/30 max-w-sm w-full overflow-hidden", children: [
|
|
@@ -8365,7 +8377,7 @@ var SessionItem = React.memo(
|
|
|
8365
8377
|
React.useEffect(() => {
|
|
8366
8378
|
setIsTouch("ontouchend" in document);
|
|
8367
8379
|
}, []);
|
|
8368
|
-
const isTitleGenerating = !session.title
|
|
8380
|
+
const isTitleGenerating = !session.title?.trim();
|
|
8369
8381
|
const displayTitle = isTitleGenerating ? t("BiChat.Common.Generating") : session.title ?? t("BiChat.Common.Untitled");
|
|
8370
8382
|
const { handlers: longPressHandlers } = useLongPress({
|
|
8371
8383
|
delay: 500,
|
|
@@ -8877,116 +8889,124 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
8877
8889
|
});
|
|
8878
8890
|
return Array.from(userMap.values());
|
|
8879
8891
|
}, [chats, users, dataSource.listUsers]);
|
|
8880
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8881
|
-
|
|
8882
|
-
|
|
8883
|
-
|
|
8884
|
-
|
|
8885
|
-
|
|
8886
|
-
|
|
8887
|
-
|
|
8888
|
-
|
|
8889
|
-
|
|
8890
|
-
|
|
8891
|
-
|
|
8892
|
-
|
|
8893
|
-
|
|
8894
|
-
|
|
8895
|
-
|
|
8896
|
-
|
|
8897
|
-
|
|
8898
|
-
|
|
8899
|
-
|
|
8900
|
-
),
|
|
8901
|
-
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-700 dark:text-gray-300 flex items-center gap-1.5", children: [
|
|
8902
|
-
/* @__PURE__ */ jsxRuntime.jsx(react.Archive, { size: 16, className: "w-4 h-4" }),
|
|
8903
|
-
t("BiChat.AllChats.IncludeArchived")
|
|
8904
|
-
] })
|
|
8905
|
-
] }),
|
|
8906
|
-
totalCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: totalCount === 1 ? t("BiChat.AllChats.ChatFound", { count: totalCount }) : t("BiChat.AllChats.ChatsFound", { count: totalCount }) })
|
|
8907
|
-
] }),
|
|
8908
|
-
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar", "aria-label": t("BiChat.AllChats.OrganizationChats"), children: [
|
|
8909
|
-
fetching && chats.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(SessionSkeleton, { count: 5 }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: chats.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8910
|
-
framerMotion.motion.div,
|
|
8911
|
-
{
|
|
8912
|
-
className: "space-y-1 mt-2",
|
|
8913
|
-
variants: staggerContainerVariants,
|
|
8914
|
-
initial: "hidden",
|
|
8915
|
-
animate: "visible",
|
|
8916
|
-
role: "list",
|
|
8917
|
-
"aria-label": t("BiChat.AllChats.OrganizationChatSessions"),
|
|
8918
|
-
children: [
|
|
8919
|
-
chats.map((chat) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8920
|
-
framerMotion.motion.div,
|
|
8892
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8893
|
+
"div",
|
|
8894
|
+
{
|
|
8895
|
+
className: "flex flex-col h-full overflow-hidden",
|
|
8896
|
+
onClick: (e) => e.stopPropagation(),
|
|
8897
|
+
onPointerDown: (e) => e.stopPropagation(),
|
|
8898
|
+
children: [
|
|
8899
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "px-4 py-3 space-y-3 border-b border-gray-200 dark:border-gray-700 flex-shrink-0", children: [
|
|
8900
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8901
|
+
MemoizedUserFilter,
|
|
8902
|
+
{
|
|
8903
|
+
users: derivedUsers,
|
|
8904
|
+
selectedUser,
|
|
8905
|
+
onUserChange: setSelectedUser,
|
|
8906
|
+
loading: usersLoading || fetching && chats.length === 0
|
|
8907
|
+
}
|
|
8908
|
+
),
|
|
8909
|
+
/* @__PURE__ */ jsxRuntime.jsxs("label", { className: "flex items-center gap-2 cursor-pointer select-none", children: [
|
|
8910
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8911
|
+
"input",
|
|
8921
8912
|
{
|
|
8922
|
-
|
|
8923
|
-
|
|
8924
|
-
|
|
8925
|
-
|
|
8926
|
-
|
|
8913
|
+
type: "checkbox",
|
|
8914
|
+
checked: includeArchived,
|
|
8915
|
+
onChange: (e) => setIncludeArchived(e.target.checked),
|
|
8916
|
+
className: "\n w-4 h-4 rounded border-gray-300 dark:border-gray-600\n text-primary-600 focus:ring-primary-500 focus:ring-offset-0\n bg-white dark:bg-gray-800\n cursor-pointer\n "
|
|
8917
|
+
}
|
|
8918
|
+
),
|
|
8919
|
+
/* @__PURE__ */ jsxRuntime.jsxs("span", { className: "text-sm text-gray-700 dark:text-gray-300 flex items-center gap-1.5", children: [
|
|
8920
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Archive, { size: 16, className: "w-4 h-4" }),
|
|
8921
|
+
t("BiChat.AllChats.IncludeArchived")
|
|
8922
|
+
] })
|
|
8923
|
+
] }),
|
|
8924
|
+
totalCount > 0 && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400", children: totalCount === 1 ? t("BiChat.AllChats.ChatFound", { count: totalCount }) : t("BiChat.AllChats.ChatsFound", { count: totalCount }) })
|
|
8925
|
+
] }),
|
|
8926
|
+
/* @__PURE__ */ jsxRuntime.jsxs("nav", { className: "flex-1 overflow-y-auto px-2 pb-4 hide-scrollbar", "aria-label": t("BiChat.AllChats.OrganizationChats"), children: [
|
|
8927
|
+
fetching && chats.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(SessionSkeleton, { count: 5 }) : /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: chats.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
|
|
8928
|
+
framerMotion.motion.div,
|
|
8929
|
+
{
|
|
8930
|
+
className: "space-y-1 mt-2",
|
|
8931
|
+
variants: staggerContainerVariants,
|
|
8932
|
+
initial: "hidden",
|
|
8933
|
+
animate: "visible",
|
|
8934
|
+
role: "list",
|
|
8935
|
+
"aria-label": t("BiChat.AllChats.OrganizationChatSessions"),
|
|
8936
|
+
children: [
|
|
8937
|
+
chats.map((chat) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
8938
|
+
framerMotion.motion.div,
|
|
8927
8939
|
{
|
|
8928
|
-
|
|
8929
|
-
|
|
8930
|
-
|
|
8931
|
-
|
|
8932
|
-
|
|
8933
|
-
|
|
8934
|
-
|
|
8935
|
-
|
|
8936
|
-
|
|
8937
|
-
|
|
8940
|
+
initial: { opacity: 0, y: -10 },
|
|
8941
|
+
animate: { opacity: 1, y: 0 },
|
|
8942
|
+
exit: { opacity: 0, y: -10 },
|
|
8943
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
8944
|
+
"div",
|
|
8945
|
+
{
|
|
8946
|
+
role: "link",
|
|
8947
|
+
tabIndex: 0,
|
|
8948
|
+
onClick: () => onSessionSelect(chat.id),
|
|
8949
|
+
onKeyDown: (e) => {
|
|
8950
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
8951
|
+
e.preventDefault();
|
|
8952
|
+
onSessionSelect(chat.id);
|
|
8953
|
+
}
|
|
8954
|
+
},
|
|
8955
|
+
className: `
|
|
8938
8956
|
block px-3 py-2 rounded-lg transition-smooth group cursor-pointer
|
|
8939
8957
|
${chat.id === activeSessionId ? "bg-primary-50/50 dark:bg-primary-900/30 text-primary-700 dark:text-primary-400 border-l-4 border-primary-400 dark:border-primary-600" : "text-gray-700 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-800 border-l-4 border-transparent"}
|
|
8940
8958
|
`,
|
|
8941
|
-
|
|
8942
|
-
|
|
8943
|
-
|
|
8944
|
-
|
|
8945
|
-
|
|
8946
|
-
|
|
8947
|
-
|
|
8948
|
-
|
|
8949
|
-
|
|
8950
|
-
|
|
8951
|
-
|
|
8952
|
-
|
|
8953
|
-
|
|
8954
|
-
|
|
8955
|
-
|
|
8956
|
-
|
|
8957
|
-
|
|
8958
|
-
|
|
8959
|
-
|
|
8960
|
-
|
|
8961
|
-
|
|
8959
|
+
"aria-current": chat.id === activeSessionId ? "page" : void 0,
|
|
8960
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
8961
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
8962
|
+
MemoizedUserAvatar,
|
|
8963
|
+
{
|
|
8964
|
+
firstName: chat.owner.firstName,
|
|
8965
|
+
lastName: chat.owner.lastName,
|
|
8966
|
+
initials: chat.owner.initials,
|
|
8967
|
+
size: "sm"
|
|
8968
|
+
}
|
|
8969
|
+
),
|
|
8970
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
8971
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: chat.title || t("BiChat.Common.Untitled") }),
|
|
8972
|
+
/* @__PURE__ */ jsxRuntime.jsxs("p", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: [
|
|
8973
|
+
chat.owner.firstName,
|
|
8974
|
+
" ",
|
|
8975
|
+
chat.owner.lastName
|
|
8976
|
+
] }),
|
|
8977
|
+
chat.status === "archived" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-1 mt-1 px-2 py-0.5 bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 rounded-full text-xs", children: [
|
|
8978
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Archive, { size: 12, className: "w-3 h-3" }),
|
|
8979
|
+
t("BiChat.Chat.Archived")
|
|
8980
|
+
] })
|
|
8981
|
+
] })
|
|
8962
8982
|
] })
|
|
8963
|
-
|
|
8964
|
-
|
|
8983
|
+
}
|
|
8984
|
+
)
|
|
8985
|
+
},
|
|
8986
|
+
chat.id
|
|
8987
|
+
)),
|
|
8988
|
+
hasMore && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: loadMoreRef, className: "py-4 text-center", children: fetching ? /* @__PURE__ */ jsxRuntime.jsx(SessionSkeleton, { count: 2 }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8989
|
+
"button",
|
|
8990
|
+
{
|
|
8991
|
+
onClick: handleLoadMore,
|
|
8992
|
+
className: "text-sm text-primary-600 dark:text-primary-400 hover:underline",
|
|
8993
|
+
children: t("BiChat.AllChats.LoadMore")
|
|
8965
8994
|
}
|
|
8966
|
-
)
|
|
8967
|
-
|
|
8968
|
-
|
|
8969
|
-
|
|
8970
|
-
|
|
8971
|
-
|
|
8972
|
-
|
|
8973
|
-
|
|
8974
|
-
|
|
8975
|
-
|
|
8976
|
-
|
|
8977
|
-
|
|
8978
|
-
|
|
8979
|
-
|
|
8980
|
-
|
|
8981
|
-
MemoizedEmptyState,
|
|
8982
|
-
{
|
|
8983
|
-
title: t("BiChat.AllChats.NoChatsFound"),
|
|
8984
|
-
description: selectedUser ? t("BiChat.AllChats.NoChatsFromUser", { firstName: selectedUser.firstName, lastName: selectedUser.lastName }) : includeArchived ? t("BiChat.AllChats.NoChatsInOrg") : t("BiChat.AllChats.NoActiveChatsInOrg")
|
|
8985
|
-
}
|
|
8986
|
-
) }),
|
|
8987
|
-
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-2 mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-600 dark:text-red-400", children: error }) })
|
|
8988
|
-
] })
|
|
8989
|
-
] });
|
|
8995
|
+
) })
|
|
8996
|
+
]
|
|
8997
|
+
}
|
|
8998
|
+
) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
8999
|
+
MemoizedEmptyState,
|
|
9000
|
+
{
|
|
9001
|
+
title: t("BiChat.AllChats.NoChatsFound"),
|
|
9002
|
+
description: selectedUser ? t("BiChat.AllChats.NoChatsFromUser", { firstName: selectedUser.firstName, lastName: selectedUser.lastName }) : includeArchived ? t("BiChat.AllChats.NoChatsInOrg") : t("BiChat.AllChats.NoActiveChatsInOrg")
|
|
9003
|
+
}
|
|
9004
|
+
) }),
|
|
9005
|
+
error && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "mx-2 mt-4 p-3 bg-red-50 dark:bg-red-900/20 border border-red-200 dark:border-red-800 rounded-lg", children: /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-red-600 dark:text-red-400", children: error }) })
|
|
9006
|
+
] })
|
|
9007
|
+
]
|
|
9008
|
+
}
|
|
9009
|
+
);
|
|
8990
9010
|
}
|
|
8991
9011
|
|
|
8992
9012
|
// ui/src/bichat/components/Sidebar.tsx
|
|
@@ -9170,12 +9190,13 @@ function Sidebar2({
|
|
|
9170
9190
|
const shouldReduceMotion = framerMotion.useReducedMotion();
|
|
9171
9191
|
const sessionListRef = React.useRef(null);
|
|
9172
9192
|
const searchContainerRef = React.useRef(null);
|
|
9193
|
+
const refreshForActiveSessionRef = React.useRef(null);
|
|
9173
9194
|
const { isCollapsed, toggle, collapse } = useSidebarCollapse();
|
|
9174
9195
|
const collapsible = !onClose;
|
|
9175
9196
|
const handleSidebarClick = React.useCallback(
|
|
9176
9197
|
(e) => {
|
|
9177
9198
|
if (!collapsible) return;
|
|
9178
|
-
const interactive = 'a, button, input, summary, [role="button"]';
|
|
9199
|
+
const interactive = 'a, button, input, textarea, select, summary, label, [role="button"], [role="link"], [contenteditable="true"], [data-no-sidebar-toggle]';
|
|
9179
9200
|
if (e.target.closest(interactive)) return;
|
|
9180
9201
|
toggle();
|
|
9181
9202
|
},
|
|
@@ -9232,6 +9253,24 @@ function Sidebar2({
|
|
|
9232
9253
|
React.useEffect(() => {
|
|
9233
9254
|
fetchSessions();
|
|
9234
9255
|
}, [fetchSessions, refreshKey]);
|
|
9256
|
+
React.useEffect(() => {
|
|
9257
|
+
if (!activeSessionId) {
|
|
9258
|
+
refreshForActiveSessionRef.current = null;
|
|
9259
|
+
return;
|
|
9260
|
+
}
|
|
9261
|
+
if (loading) return;
|
|
9262
|
+
const hasActiveSession = sessions.some((session) => session.id === activeSessionId);
|
|
9263
|
+
if (hasActiveSession) {
|
|
9264
|
+
if (refreshForActiveSessionRef.current === activeSessionId) {
|
|
9265
|
+
refreshForActiveSessionRef.current = null;
|
|
9266
|
+
}
|
|
9267
|
+
return;
|
|
9268
|
+
}
|
|
9269
|
+
if (refreshForActiveSessionRef.current !== activeSessionId) {
|
|
9270
|
+
refreshForActiveSessionRef.current = activeSessionId;
|
|
9271
|
+
setRefreshKey((k) => k + 1);
|
|
9272
|
+
}
|
|
9273
|
+
}, [activeSessionId, loading, sessions]);
|
|
9235
9274
|
const hasPlaceholderTitles = React.useMemo(() => {
|
|
9236
9275
|
const newChatLabel = t("BiChat.Chat.NewChat");
|
|
9237
9276
|
return Array.isArray(sessions) && sessions.some((s) => s && (!s.title || s.title === newChatLabel));
|
|
@@ -9264,6 +9303,9 @@ function Sidebar2({
|
|
|
9264
9303
|
try {
|
|
9265
9304
|
await dataSource.archiveSession(sessionToArchive);
|
|
9266
9305
|
setRefreshKey((k) => k + 1);
|
|
9306
|
+
window.dispatchEvent(new CustomEvent("bichat:sessions-updated", {
|
|
9307
|
+
detail: { reason: "archived", sessionId: sessionToArchive }
|
|
9308
|
+
}));
|
|
9267
9309
|
if (wasCurrentSession) {
|
|
9268
9310
|
onSessionSelect("");
|
|
9269
9311
|
}
|