@iota-uz/sdk 0.4.32 → 0.4.34
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 +262 -64
- package/dist/bichat/index.cjs.map +1 -1
- package/dist/bichat/index.d.cts +13 -2
- package/dist/bichat/index.d.ts +13 -2
- package/dist/bichat/index.mjs +262 -64
- package/dist/bichat/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tailwind/compiled.css +1 -1
package/dist/bichat/index.cjs
CHANGED
|
@@ -3659,16 +3659,26 @@ function hashString(str) {
|
|
|
3659
3659
|
return Math.abs(hash);
|
|
3660
3660
|
}
|
|
3661
3661
|
var colorPalette = [
|
|
3662
|
-
{ bg: "
|
|
3663
|
-
|
|
3664
|
-
{ bg: "
|
|
3665
|
-
|
|
3666
|
-
{ bg: "
|
|
3667
|
-
|
|
3668
|
-
{ bg: "
|
|
3669
|
-
|
|
3670
|
-
{ bg: "
|
|
3671
|
-
|
|
3662
|
+
{ bg: "#3b82f6", text: "#ffffff" },
|
|
3663
|
+
// blue-500
|
|
3664
|
+
{ bg: "#22c55e", text: "#111827" },
|
|
3665
|
+
// green-500 (light bg)
|
|
3666
|
+
{ bg: "#a855f7", text: "#ffffff" },
|
|
3667
|
+
// purple-500
|
|
3668
|
+
{ bg: "#ec4899", text: "#ffffff" },
|
|
3669
|
+
// pink-500
|
|
3670
|
+
{ bg: "#6366f1", text: "#ffffff" },
|
|
3671
|
+
// indigo-500
|
|
3672
|
+
{ bg: "#14b8a6", text: "#111827" },
|
|
3673
|
+
// teal-500 (light bg)
|
|
3674
|
+
{ bg: "#f97316", text: "#ffffff" },
|
|
3675
|
+
// orange-500
|
|
3676
|
+
{ bg: "#06b6d4", text: "#111827" },
|
|
3677
|
+
// cyan-500 (light bg)
|
|
3678
|
+
{ bg: "#f59e0b", text: "#111827" },
|
|
3679
|
+
// amber-500 (light bg)
|
|
3680
|
+
{ bg: "#84cc16", text: "#111827" }
|
|
3681
|
+
// lime-500 (light bg)
|
|
3672
3682
|
];
|
|
3673
3683
|
var sizeClasses = {
|
|
3674
3684
|
xs: "w-6 h-6 text-[10px]",
|
|
@@ -3698,8 +3708,6 @@ function UserAvatar({
|
|
|
3698
3708
|
{
|
|
3699
3709
|
className: `
|
|
3700
3710
|
${sizeClasses[size]}
|
|
3701
|
-
${colors.bg}
|
|
3702
|
-
${colors.text}
|
|
3703
3711
|
${className}
|
|
3704
3712
|
rounded-full
|
|
3705
3713
|
flex
|
|
@@ -3709,6 +3717,7 @@ function UserAvatar({
|
|
|
3709
3717
|
flex-shrink-0
|
|
3710
3718
|
select-none
|
|
3711
3719
|
`,
|
|
3720
|
+
style: { backgroundColor: colors.bg, color: colors.text },
|
|
3712
3721
|
"aria-label": `${firstName} ${lastName}`,
|
|
3713
3722
|
title: `${firstName} ${lastName}`,
|
|
3714
3723
|
children: initials
|
|
@@ -12657,9 +12666,11 @@ function ChatSession(props) {
|
|
|
12657
12666
|
);
|
|
12658
12667
|
}
|
|
12659
12668
|
init_IotaContext();
|
|
12669
|
+
init_useTranslation();
|
|
12660
12670
|
function ModelSelector() {
|
|
12661
12671
|
const { model, setModel } = useChatSession();
|
|
12662
12672
|
const context = useIotaContext();
|
|
12673
|
+
const { t } = useTranslation();
|
|
12663
12674
|
const models = React.useMemo(
|
|
12664
12675
|
() => context.extensions?.llm?.models ?? [],
|
|
12665
12676
|
[context.extensions?.llm?.models]
|
|
@@ -12690,9 +12701,9 @@ function ModelSelector() {
|
|
|
12690
12701
|
return null;
|
|
12691
12702
|
}
|
|
12692
12703
|
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center justify-between px-4 pt-3 pb-1", children: [
|
|
12693
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex rounded-lg bg-gray-100 p-0.5 dark:bg-gray-800", children: models.map((m) => {
|
|
12704
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "inline-flex rounded-lg bg-gray-100 p-0.5 dark:bg-gray-800", children: models.map((m, i) => {
|
|
12694
12705
|
const isActive = m.id === currentModel;
|
|
12695
|
-
const isFast =
|
|
12706
|
+
const isFast = i === 0;
|
|
12696
12707
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
12697
12708
|
"button",
|
|
12698
12709
|
{
|
|
@@ -12704,7 +12715,7 @@ function ModelSelector() {
|
|
|
12704
12715
|
`,
|
|
12705
12716
|
children: [
|
|
12706
12717
|
isFast ? /* @__PURE__ */ jsxRuntime.jsx(react.Lightning, { size: 13, weight: "fill" }) : /* @__PURE__ */ jsxRuntime.jsx(react.Brain, { size: 13, weight: "fill" }),
|
|
12707
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { children: m.label })
|
|
12718
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { children: t(m.label) })
|
|
12708
12719
|
]
|
|
12709
12720
|
},
|
|
12710
12721
|
m.id
|
|
@@ -14383,6 +14394,62 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
14383
14394
|
});
|
|
14384
14395
|
return Array.from(userMap.values());
|
|
14385
14396
|
}, [chats, users, dataSource.listUsers]);
|
|
14397
|
+
const [expandedGroups, setExpandedGroups] = React.useState(/* @__PURE__ */ new Set());
|
|
14398
|
+
const toggleGroup = React.useCallback((ownerId) => {
|
|
14399
|
+
setExpandedGroups((prev) => {
|
|
14400
|
+
const next = new Set(prev);
|
|
14401
|
+
if (next.has(ownerId)) {
|
|
14402
|
+
next.delete(ownerId);
|
|
14403
|
+
} else {
|
|
14404
|
+
next.add(ownerId);
|
|
14405
|
+
}
|
|
14406
|
+
return next;
|
|
14407
|
+
});
|
|
14408
|
+
}, []);
|
|
14409
|
+
React.useEffect(() => {
|
|
14410
|
+
if (!activeSessionId || selectedUser) {
|
|
14411
|
+
return;
|
|
14412
|
+
}
|
|
14413
|
+
const chat = chats.find((c) => c.id === activeSessionId);
|
|
14414
|
+
if (chat?.owner?.id) {
|
|
14415
|
+
setExpandedGroups((prev) => {
|
|
14416
|
+
if (prev.has(chat.owner.id)) {
|
|
14417
|
+
return prev;
|
|
14418
|
+
}
|
|
14419
|
+
return /* @__PURE__ */ new Set([...prev, chat.owner.id]);
|
|
14420
|
+
});
|
|
14421
|
+
}
|
|
14422
|
+
}, [activeSessionId, chats, selectedUser]);
|
|
14423
|
+
const groupedChats = React.useMemo(() => {
|
|
14424
|
+
if (selectedUser) {
|
|
14425
|
+
return null;
|
|
14426
|
+
}
|
|
14427
|
+
const groupMap = /* @__PURE__ */ new Map();
|
|
14428
|
+
chats.forEach((chat) => {
|
|
14429
|
+
const owner = chat.owner ?? {
|
|
14430
|
+
id: "__unknown__",
|
|
14431
|
+
firstName: t("BiChat.Common.Untitled"),
|
|
14432
|
+
lastName: "",
|
|
14433
|
+
initials: "?"
|
|
14434
|
+
};
|
|
14435
|
+
const ownerId = owner.id;
|
|
14436
|
+
if (!groupMap.has(ownerId)) {
|
|
14437
|
+
groupMap.set(ownerId, {
|
|
14438
|
+
owner,
|
|
14439
|
+
chats: [],
|
|
14440
|
+
latestUpdatedAt: chat.updatedAt
|
|
14441
|
+
});
|
|
14442
|
+
}
|
|
14443
|
+
const group = groupMap.get(ownerId);
|
|
14444
|
+
group.chats.push(chat);
|
|
14445
|
+
if (chat.updatedAt > group.latestUpdatedAt) {
|
|
14446
|
+
group.latestUpdatedAt = chat.updatedAt;
|
|
14447
|
+
}
|
|
14448
|
+
});
|
|
14449
|
+
return Array.from(groupMap.values()).sort(
|
|
14450
|
+
(a, b) => b.latestUpdatedAt.localeCompare(a.latestUpdatedAt)
|
|
14451
|
+
);
|
|
14452
|
+
}, [chats, selectedUser, t]);
|
|
14386
14453
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
14387
14454
|
"div",
|
|
14388
14455
|
{
|
|
@@ -14428,61 +14495,159 @@ function AllChatsList({ dataSource, onSessionSelect, activeSessionId }) {
|
|
|
14428
14495
|
role: "list",
|
|
14429
14496
|
"aria-label": t("BiChat.AllChats.OrganizationChatSessions"),
|
|
14430
14497
|
children: [
|
|
14431
|
-
|
|
14432
|
-
|
|
14433
|
-
|
|
14434
|
-
|
|
14435
|
-
|
|
14436
|
-
|
|
14437
|
-
|
|
14438
|
-
|
|
14439
|
-
framerMotion.motion.div,
|
|
14440
|
-
{
|
|
14441
|
-
initial: { opacity: 0, y: -10 },
|
|
14442
|
-
animate: { opacity: 1, y: 0 },
|
|
14443
|
-
exit: { opacity: 0, y: -10 },
|
|
14444
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14498
|
+
groupedChats ? (
|
|
14499
|
+
/* ── Grouped view (no user selected) ── */
|
|
14500
|
+
groupedChats.map((group) => {
|
|
14501
|
+
const ownerId = group.owner.id;
|
|
14502
|
+
const ownerName = [group.owner.firstName, group.owner.lastName].filter(Boolean).join(" ");
|
|
14503
|
+
const isCollapsed = !expandedGroups.has(ownerId);
|
|
14504
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mb-1", children: [
|
|
14505
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
14445
14506
|
"div",
|
|
14446
14507
|
{
|
|
14447
|
-
role: "
|
|
14508
|
+
role: "button",
|
|
14448
14509
|
tabIndex: 0,
|
|
14449
|
-
onClick: () =>
|
|
14510
|
+
onClick: () => toggleGroup(ownerId),
|
|
14450
14511
|
onKeyDown: (e) => {
|
|
14451
14512
|
if (e.key === "Enter" || e.key === " ") {
|
|
14452
14513
|
e.preventDefault();
|
|
14453
|
-
|
|
14514
|
+
toggleGroup(ownerId);
|
|
14454
14515
|
}
|
|
14455
14516
|
},
|
|
14456
|
-
className:
|
|
14457
|
-
|
|
14458
|
-
|
|
14459
|
-
|
|
14460
|
-
|
|
14461
|
-
|
|
14517
|
+
className: "flex items-center gap-2 px-3 py-2 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800 rounded-lg transition-smooth select-none",
|
|
14518
|
+
"aria-expanded": !isCollapsed,
|
|
14519
|
+
children: [
|
|
14520
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14521
|
+
react.CaretRight,
|
|
14522
|
+
{
|
|
14523
|
+
size: 14,
|
|
14524
|
+
weight: "bold",
|
|
14525
|
+
className: `shrink-0 text-gray-500 dark:text-gray-400 transition-transform duration-150 ${isCollapsed ? "" : "rotate-90"}`
|
|
14526
|
+
}
|
|
14527
|
+
),
|
|
14462
14528
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14463
14529
|
MemoizedUserAvatar,
|
|
14464
14530
|
{
|
|
14465
|
-
firstName: owner.firstName,
|
|
14466
|
-
lastName: owner.lastName,
|
|
14467
|
-
initials: owner.initials,
|
|
14531
|
+
firstName: group.owner.firstName,
|
|
14532
|
+
lastName: group.owner.lastName,
|
|
14533
|
+
initials: group.owner.initials,
|
|
14468
14534
|
size: "sm"
|
|
14469
14535
|
}
|
|
14470
14536
|
),
|
|
14471
|
-
/* @__PURE__ */ jsxRuntime.
|
|
14472
|
-
|
|
14473
|
-
|
|
14474
|
-
|
|
14475
|
-
|
|
14476
|
-
|
|
14537
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm font-medium text-gray-700 dark:text-gray-300 truncate flex-1 min-w-0", children: ownerName || t("BiChat.Common.Untitled") }),
|
|
14538
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 px-2 py-0.5 rounded-full flex-shrink-0", children: group.chats.length })
|
|
14539
|
+
]
|
|
14540
|
+
}
|
|
14541
|
+
),
|
|
14542
|
+
/* @__PURE__ */ jsxRuntime.jsx(framerMotion.AnimatePresence, { initial: false, children: !isCollapsed && /* @__PURE__ */ jsxRuntime.jsx(
|
|
14543
|
+
framerMotion.motion.div,
|
|
14544
|
+
{
|
|
14545
|
+
initial: { height: 0, opacity: 0 },
|
|
14546
|
+
animate: { height: "auto", opacity: 1 },
|
|
14547
|
+
exit: { height: 0, opacity: 0 },
|
|
14548
|
+
transition: { duration: 0.2, ease: [0.4, 0, 0.2, 1] },
|
|
14549
|
+
className: "overflow-hidden",
|
|
14550
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("div", { className: "space-y-0.5 pl-6", children: group.chats.map((chat) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
14551
|
+
framerMotion.motion.div,
|
|
14552
|
+
{
|
|
14553
|
+
initial: { opacity: 0, y: -10 },
|
|
14554
|
+
animate: { opacity: 1, y: 0 },
|
|
14555
|
+
exit: { opacity: 0, y: -10 },
|
|
14556
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14557
|
+
"div",
|
|
14558
|
+
{
|
|
14559
|
+
role: "link",
|
|
14560
|
+
tabIndex: 0,
|
|
14561
|
+
onClick: () => onSessionSelect(chat.id),
|
|
14562
|
+
onKeyDown: (e) => {
|
|
14563
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
14564
|
+
e.preventDefault();
|
|
14565
|
+
onSessionSelect(chat.id);
|
|
14566
|
+
}
|
|
14567
|
+
},
|
|
14568
|
+
className: `
|
|
14569
|
+
block px-3 py-2 rounded-lg transition-smooth group cursor-pointer
|
|
14570
|
+
${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"}
|
|
14571
|
+
`,
|
|
14572
|
+
"aria-current": chat.id === activeSessionId ? "page" : void 0,
|
|
14573
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-2 min-w-0", children: [
|
|
14574
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm truncate flex-1 min-w-0", children: chat.title || t("BiChat.Common.Untitled") }),
|
|
14575
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center gap-1.5 flex-shrink-0", children: [
|
|
14576
|
+
chat.isGroup && chat.memberCount && chat.memberCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-xs text-gray-400 dark:text-gray-500", children: chat.memberCount }),
|
|
14577
|
+
chat.status === "archived" && /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "inline-flex items-center gap-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: [
|
|
14578
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Archive, { size: 12, className: "w-3 h-3" }),
|
|
14579
|
+
t("BiChat.Chat.Archived")
|
|
14580
|
+
] })
|
|
14581
|
+
] })
|
|
14582
|
+
] })
|
|
14583
|
+
}
|
|
14584
|
+
)
|
|
14585
|
+
},
|
|
14586
|
+
chat.id
|
|
14587
|
+
)) })
|
|
14588
|
+
},
|
|
14589
|
+
`group-${ownerId}`
|
|
14590
|
+
) })
|
|
14591
|
+
] }, ownerId);
|
|
14592
|
+
})
|
|
14593
|
+
) : (
|
|
14594
|
+
/* ── Flat view (user selected) ── */
|
|
14595
|
+
chats.map((chat) => {
|
|
14596
|
+
const owner = chat.owner ?? {
|
|
14597
|
+
firstName: "",
|
|
14598
|
+
lastName: "",
|
|
14599
|
+
initials: "U"
|
|
14600
|
+
};
|
|
14601
|
+
const ownerName = [owner.firstName, owner.lastName].filter(Boolean).join(" ");
|
|
14602
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
14603
|
+
framerMotion.motion.div,
|
|
14604
|
+
{
|
|
14605
|
+
initial: { opacity: 0, y: -10 },
|
|
14606
|
+
animate: { opacity: 1, y: 0 },
|
|
14607
|
+
exit: { opacity: 0, y: -10 },
|
|
14608
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
14609
|
+
"div",
|
|
14610
|
+
{
|
|
14611
|
+
role: "link",
|
|
14612
|
+
tabIndex: 0,
|
|
14613
|
+
onClick: () => onSessionSelect(chat.id),
|
|
14614
|
+
onKeyDown: (e) => {
|
|
14615
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
14616
|
+
e.preventDefault();
|
|
14617
|
+
onSessionSelect(chat.id);
|
|
14618
|
+
}
|
|
14619
|
+
},
|
|
14620
|
+
className: `
|
|
14621
|
+
block px-3 py-2 rounded-lg transition-smooth group cursor-pointer
|
|
14622
|
+
${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"}
|
|
14623
|
+
`,
|
|
14624
|
+
"aria-current": chat.id === activeSessionId ? "page" : void 0,
|
|
14625
|
+
children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-start gap-2", children: [
|
|
14626
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
14627
|
+
MemoizedUserAvatar,
|
|
14628
|
+
{
|
|
14629
|
+
firstName: owner.firstName,
|
|
14630
|
+
lastName: owner.lastName,
|
|
14631
|
+
initials: owner.initials,
|
|
14632
|
+
size: "sm"
|
|
14633
|
+
}
|
|
14634
|
+
),
|
|
14635
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex-1 min-w-0", children: [
|
|
14636
|
+
/* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-sm font-medium truncate", children: chat.title || t("BiChat.Common.Untitled") }),
|
|
14637
|
+
ownerName && /* @__PURE__ */ jsxRuntime.jsx("p", { className: "text-xs text-gray-500 dark:text-gray-400 truncate", children: ownerName }),
|
|
14638
|
+
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: [
|
|
14639
|
+
/* @__PURE__ */ jsxRuntime.jsx(react.Archive, { size: 12, className: "w-3 h-3" }),
|
|
14640
|
+
t("BiChat.Chat.Archived")
|
|
14641
|
+
] })
|
|
14477
14642
|
] })
|
|
14478
14643
|
] })
|
|
14479
|
-
|
|
14480
|
-
|
|
14481
|
-
|
|
14482
|
-
|
|
14483
|
-
|
|
14484
|
-
)
|
|
14485
|
-
|
|
14644
|
+
}
|
|
14645
|
+
)
|
|
14646
|
+
},
|
|
14647
|
+
chat.id
|
|
14648
|
+
);
|
|
14649
|
+
})
|
|
14650
|
+
),
|
|
14486
14651
|
hasMore && /* @__PURE__ */ jsxRuntime.jsx("div", { ref: loadMoreRef, className: "py-4 text-center", children: fetching ? /* @__PURE__ */ jsxRuntime.jsx(SessionSkeleton, { count: 2 }) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
14487
14652
|
"button",
|
|
14488
14653
|
{
|
|
@@ -14705,7 +14870,9 @@ function Sidebar2({
|
|
|
14705
14870
|
onClose,
|
|
14706
14871
|
headerSlot,
|
|
14707
14872
|
footerSlot,
|
|
14708
|
-
className = ""
|
|
14873
|
+
className = "",
|
|
14874
|
+
activeTab: controlledActiveTab,
|
|
14875
|
+
onTabChange
|
|
14709
14876
|
}) {
|
|
14710
14877
|
const { t } = useTranslation();
|
|
14711
14878
|
const toast = useToast();
|
|
@@ -14765,7 +14932,14 @@ function Sidebar2({
|
|
|
14765
14932
|
const timer = setTimeout(() => setCollapsedOverflowVisible(true), 300);
|
|
14766
14933
|
return () => clearTimeout(timer);
|
|
14767
14934
|
}, [showCollapsed]);
|
|
14768
|
-
const [
|
|
14935
|
+
const [internalActiveTab, setInternalActiveTab] = React.useState("my-chats");
|
|
14936
|
+
const activeTab = controlledActiveTab ?? internalActiveTab;
|
|
14937
|
+
const handleTabChange = React.useCallback((tab) => {
|
|
14938
|
+
if (controlledActiveTab === void 0) {
|
|
14939
|
+
setInternalActiveTab(tab);
|
|
14940
|
+
}
|
|
14941
|
+
onTabChange?.(tab);
|
|
14942
|
+
}, [controlledActiveTab, onTabChange]);
|
|
14769
14943
|
const [searchQuery, setSearchQuery] = React.useState("");
|
|
14770
14944
|
const [sessions, setSessions] = React.useState([]);
|
|
14771
14945
|
const [loading, setLoading] = React.useState(true);
|
|
@@ -15379,7 +15553,7 @@ function Sidebar2({
|
|
|
15379
15553
|
onClick: (e) => {
|
|
15380
15554
|
e.preventDefault();
|
|
15381
15555
|
e.stopPropagation();
|
|
15382
|
-
|
|
15556
|
+
handleTabChange("all-chats");
|
|
15383
15557
|
close();
|
|
15384
15558
|
},
|
|
15385
15559
|
className: `cursor-pointer flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-gray-600 dark:text-gray-300 transition-colors ${focus ? "bg-gray-100 dark:bg-gray-800/70" : ""}`,
|
|
@@ -15396,7 +15570,7 @@ function Sidebar2({
|
|
|
15396
15570
|
onClick: (e) => {
|
|
15397
15571
|
e.preventDefault();
|
|
15398
15572
|
e.stopPropagation();
|
|
15399
|
-
|
|
15573
|
+
handleTabChange("my-chats");
|
|
15400
15574
|
close();
|
|
15401
15575
|
},
|
|
15402
15576
|
className: `cursor-pointer flex w-full items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] text-gray-600 dark:text-gray-300 transition-colors ${focus ? "bg-gray-100 dark:bg-gray-800/70" : ""}`,
|
|
@@ -17503,42 +17677,66 @@ function useBichatRouter({
|
|
|
17503
17677
|
pathname,
|
|
17504
17678
|
onNavigate
|
|
17505
17679
|
}) {
|
|
17680
|
+
const isAllChats = pathname.startsWith("/all-chats");
|
|
17506
17681
|
const activeSessionId = React.useMemo(
|
|
17507
17682
|
() => pathname.match(SESSION_PATH_REGEX)?.[1],
|
|
17508
17683
|
[pathname]
|
|
17509
17684
|
);
|
|
17685
|
+
const sidebarTab = React.useMemo(
|
|
17686
|
+
() => isAllChats ? "all-chats" : "my-chats",
|
|
17687
|
+
[isAllChats]
|
|
17688
|
+
);
|
|
17510
17689
|
const maybeClose = React.useCallback(() => {
|
|
17511
17690
|
onNavigate?.();
|
|
17512
17691
|
}, [onNavigate]);
|
|
17513
17692
|
const onSessionSelect = React.useCallback(
|
|
17514
17693
|
(sessionId) => {
|
|
17515
17694
|
if (sessionId) {
|
|
17516
|
-
|
|
17695
|
+
const prefix = isAllChats ? "/all-chats" : "";
|
|
17696
|
+
navigate(`${prefix}/session/${sessionId}`);
|
|
17517
17697
|
} else {
|
|
17518
|
-
navigate("/");
|
|
17698
|
+
navigate(isAllChats ? "/all-chats" : "/");
|
|
17519
17699
|
}
|
|
17520
17700
|
maybeClose();
|
|
17521
17701
|
},
|
|
17522
|
-
[navigate, maybeClose]
|
|
17702
|
+
[navigate, maybeClose, isAllChats]
|
|
17523
17703
|
);
|
|
17524
17704
|
const onNewChat = React.useCallback(() => {
|
|
17525
|
-
navigate("/");
|
|
17705
|
+
navigate(isAllChats ? "/all-chats" : "/");
|
|
17526
17706
|
maybeClose();
|
|
17527
|
-
}, [navigate, maybeClose]);
|
|
17707
|
+
}, [navigate, maybeClose, isAllChats]);
|
|
17528
17708
|
const onArchivedView = React.useCallback(() => {
|
|
17529
17709
|
navigate("/archived");
|
|
17530
17710
|
maybeClose();
|
|
17531
17711
|
}, [navigate, maybeClose]);
|
|
17712
|
+
const onAllChatsView = React.useCallback(() => {
|
|
17713
|
+
navigate("/all-chats");
|
|
17714
|
+
maybeClose();
|
|
17715
|
+
}, [navigate, maybeClose]);
|
|
17532
17716
|
const onBack = React.useCallback(() => {
|
|
17533
17717
|
navigate("/");
|
|
17534
17718
|
maybeClose();
|
|
17535
17719
|
}, [navigate, maybeClose]);
|
|
17720
|
+
const onSidebarTabChange = React.useCallback(
|
|
17721
|
+
(tab) => {
|
|
17722
|
+
if (tab === "all-chats") {
|
|
17723
|
+
navigate("/all-chats");
|
|
17724
|
+
} else {
|
|
17725
|
+
navigate("/");
|
|
17726
|
+
}
|
|
17727
|
+
maybeClose();
|
|
17728
|
+
},
|
|
17729
|
+
[navigate, maybeClose]
|
|
17730
|
+
);
|
|
17536
17731
|
return {
|
|
17537
17732
|
activeSessionId,
|
|
17538
17733
|
onSessionSelect,
|
|
17539
17734
|
onNewChat,
|
|
17540
17735
|
onArchivedView,
|
|
17541
|
-
onBack
|
|
17736
|
+
onBack,
|
|
17737
|
+
onAllChatsView,
|
|
17738
|
+
sidebarTab,
|
|
17739
|
+
onSidebarTabChange
|
|
17542
17740
|
};
|
|
17543
17741
|
}
|
|
17544
17742
|
|