@copilotz/chat-ui 0.6.6 → 0.6.7
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/index.cjs +496 -373
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +40 -24
- package/dist/index.d.ts +40 -24
- package/dist/index.js +408 -271
- package/dist/index.js.map +1 -1
- package/dist/styles.css +6 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
// src/components/chat/ChatUI.tsx
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
useCallback as useCallback4,
|
|
4
|
+
useEffect as useEffect11,
|
|
5
|
+
useMemo as useMemo6,
|
|
6
|
+
useRef as useRef6,
|
|
7
|
+
useState as useState9
|
|
8
|
+
} from "react";
|
|
3
9
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4
10
|
|
|
5
11
|
// src/config/chatConfig.ts
|
|
@@ -1130,7 +1136,7 @@ var Message = memo2(({
|
|
|
1130
1136
|
}, arePropsEqual);
|
|
1131
1137
|
|
|
1132
1138
|
// src/components/chat/Sidebar.tsx
|
|
1133
|
-
import {
|
|
1139
|
+
import { useEffect as useEffect8, useRef as useRef4, useState as useState5 } from "react";
|
|
1134
1140
|
|
|
1135
1141
|
// src/components/ui/input.tsx
|
|
1136
1142
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -2157,25 +2163,27 @@ function DropdownMenuSeparator({
|
|
|
2157
2163
|
|
|
2158
2164
|
// src/components/chat/Sidebar.tsx
|
|
2159
2165
|
import {
|
|
2160
|
-
Plus,
|
|
2161
|
-
MoreHorizontal,
|
|
2162
|
-
Edit2,
|
|
2163
|
-
Trash2,
|
|
2164
2166
|
Archive,
|
|
2165
|
-
|
|
2167
|
+
Bot,
|
|
2168
|
+
Edit2,
|
|
2166
2169
|
Filter,
|
|
2167
|
-
|
|
2170
|
+
MoreHorizontal,
|
|
2171
|
+
Plus,
|
|
2172
|
+
Search,
|
|
2173
|
+
Trash2
|
|
2168
2174
|
} from "lucide-react";
|
|
2169
2175
|
|
|
2170
2176
|
// src/components/chat/UserMenu.tsx
|
|
2177
|
+
import React8 from "react";
|
|
2171
2178
|
import {
|
|
2172
|
-
|
|
2173
|
-
Settings,
|
|
2174
|
-
LogOut,
|
|
2179
|
+
Check as Check2,
|
|
2175
2180
|
ChevronsUpDown,
|
|
2181
|
+
LogOut,
|
|
2176
2182
|
Moon,
|
|
2183
|
+
Palette,
|
|
2184
|
+
Settings,
|
|
2177
2185
|
Sun,
|
|
2178
|
-
|
|
2186
|
+
User
|
|
2179
2187
|
} from "lucide-react";
|
|
2180
2188
|
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2181
2189
|
var getInitials = (name, email) => {
|
|
@@ -2197,6 +2205,7 @@ var UserMenu = ({
|
|
|
2197
2205
|
callbacks,
|
|
2198
2206
|
currentTheme = "system",
|
|
2199
2207
|
showThemeOptions = true,
|
|
2208
|
+
sections = [],
|
|
2200
2209
|
additionalItems
|
|
2201
2210
|
}) => {
|
|
2202
2211
|
const { isMobile } = useSidebar();
|
|
@@ -2260,6 +2269,27 @@ var UserMenu = ({
|
|
|
2260
2269
|
/* @__PURE__ */ jsx17("span", { children: labels.settings })
|
|
2261
2270
|
] }),
|
|
2262
2271
|
additionalItems,
|
|
2272
|
+
sections.map((section) => /* @__PURE__ */ jsxs9(React8.Fragment, { children: [
|
|
2273
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2274
|
+
section.label && /* @__PURE__ */ jsx17(DropdownMenuLabel, { className: "px-2 py-2", children: section.label }),
|
|
2275
|
+
section.items.map((item) => /* @__PURE__ */ jsxs9(
|
|
2276
|
+
DropdownMenuItem,
|
|
2277
|
+
{
|
|
2278
|
+
onClick: item.onSelect,
|
|
2279
|
+
disabled: item.disabled,
|
|
2280
|
+
className: [
|
|
2281
|
+
item.checked ? "bg-accent/60" : "",
|
|
2282
|
+
item.variant === "destructive" ? "text-destructive focus:text-destructive focus:bg-destructive/10" : ""
|
|
2283
|
+
].filter(Boolean).join(" "),
|
|
2284
|
+
children: [
|
|
2285
|
+
item.icon && /* @__PURE__ */ jsx17("span", { className: "mr-2 h-4 w-4 shrink-0", children: item.icon }),
|
|
2286
|
+
/* @__PURE__ */ jsx17("span", { className: "flex-1", children: item.label }),
|
|
2287
|
+
item.checked && /* @__PURE__ */ jsx17(Check2, { className: "ml-2 h-4 w-4 text-primary" })
|
|
2288
|
+
]
|
|
2289
|
+
},
|
|
2290
|
+
item.id
|
|
2291
|
+
))
|
|
2292
|
+
] }, section.id)),
|
|
2263
2293
|
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2264
2294
|
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2265
2295
|
/* @__PURE__ */ jsxs9(
|
|
@@ -2371,6 +2401,7 @@ var Sidebar2 = ({
|
|
|
2371
2401
|
userMenuCallbacks,
|
|
2372
2402
|
currentTheme,
|
|
2373
2403
|
showThemeOptions = true,
|
|
2404
|
+
userMenuSections,
|
|
2374
2405
|
userMenuAdditionalItems,
|
|
2375
2406
|
...props
|
|
2376
2407
|
}) => {
|
|
@@ -2389,7 +2420,9 @@ var Sidebar2 = ({
|
|
|
2389
2420
|
}, [editingThreadId]);
|
|
2390
2421
|
const filteredThreads = threads.filter((thread) => {
|
|
2391
2422
|
const title = (thread.title ?? "").toString();
|
|
2392
|
-
const matchesSearch = title.toLowerCase().includes(
|
|
2423
|
+
const matchesSearch = title.toLowerCase().includes(
|
|
2424
|
+
searchQuery.toLowerCase()
|
|
2425
|
+
);
|
|
2393
2426
|
const matchesArchiveFilter = showArchived || !thread.isArchived;
|
|
2394
2427
|
return matchesSearch && matchesArchiveFilter;
|
|
2395
2428
|
});
|
|
@@ -2513,8 +2546,12 @@ var Sidebar2 = ({
|
|
|
2513
2546
|
value: editTitle,
|
|
2514
2547
|
onChange: (e) => setEditTitle(e.target.value),
|
|
2515
2548
|
onKeyDown: (e) => {
|
|
2516
|
-
if (e.key === "Enter")
|
|
2517
|
-
|
|
2549
|
+
if (e.key === "Enter") {
|
|
2550
|
+
saveEdit();
|
|
2551
|
+
}
|
|
2552
|
+
if (e.key === "Escape") {
|
|
2553
|
+
cancelEdit();
|
|
2554
|
+
}
|
|
2518
2555
|
},
|
|
2519
2556
|
onBlur: saveEdit,
|
|
2520
2557
|
className: "h-7 text-sm"
|
|
@@ -2537,28 +2574,48 @@ var Sidebar2 = ({
|
|
|
2537
2574
|
/* @__PURE__ */ jsx18(MoreHorizontal, {}),
|
|
2538
2575
|
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: "More" })
|
|
2539
2576
|
] }) }),
|
|
2540
|
-
/* @__PURE__ */ jsxs10(
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2577
|
+
/* @__PURE__ */ jsxs10(
|
|
2578
|
+
DropdownMenuContent,
|
|
2579
|
+
{
|
|
2580
|
+
className: "w-48",
|
|
2581
|
+
side: "right",
|
|
2582
|
+
align: "start",
|
|
2583
|
+
children: [
|
|
2584
|
+
/* @__PURE__ */ jsxs10(
|
|
2585
|
+
DropdownMenuItem,
|
|
2586
|
+
{
|
|
2587
|
+
onClick: () => startEditing(thread),
|
|
2588
|
+
children: [
|
|
2589
|
+
/* @__PURE__ */ jsx18(Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2590
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.renameThread || "Rename" })
|
|
2591
|
+
]
|
|
2592
|
+
}
|
|
2593
|
+
),
|
|
2594
|
+
/* @__PURE__ */ jsxs10(
|
|
2595
|
+
DropdownMenuItem,
|
|
2596
|
+
{
|
|
2597
|
+
onClick: () => onArchiveThread?.(thread.id),
|
|
2598
|
+
children: [
|
|
2599
|
+
/* @__PURE__ */ jsx18(Archive, { className: "mr-2 h-4 w-4" }),
|
|
2600
|
+
/* @__PURE__ */ jsx18("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2601
|
+
]
|
|
2602
|
+
}
|
|
2603
|
+
),
|
|
2604
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2605
|
+
/* @__PURE__ */ jsxs10(
|
|
2606
|
+
DropdownMenuItem,
|
|
2607
|
+
{
|
|
2608
|
+
onClick: () => setDeleteThreadId(thread.id),
|
|
2609
|
+
className: "text-destructive focus:text-destructive",
|
|
2610
|
+
children: [
|
|
2611
|
+
/* @__PURE__ */ jsx18(Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2612
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2613
|
+
]
|
|
2614
|
+
}
|
|
2615
|
+
)
|
|
2616
|
+
]
|
|
2617
|
+
}
|
|
2618
|
+
)
|
|
2562
2619
|
] })
|
|
2563
2620
|
] }, thread.id)) }) })
|
|
2564
2621
|
] }, group))
|
|
@@ -2571,32 +2628,40 @@ var Sidebar2 = ({
|
|
|
2571
2628
|
callbacks: userMenuCallbacks,
|
|
2572
2629
|
currentTheme,
|
|
2573
2630
|
showThemeOptions,
|
|
2631
|
+
sections: userMenuSections,
|
|
2574
2632
|
additionalItems: userMenuAdditionalItems
|
|
2575
2633
|
}
|
|
2576
2634
|
) }),
|
|
2577
2635
|
/* @__PURE__ */ jsx18(SidebarRail, {}),
|
|
2578
|
-
deleteThreadId && /* @__PURE__ */ jsx18(
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2636
|
+
deleteThreadId && /* @__PURE__ */ jsx18(
|
|
2637
|
+
AlertDialog,
|
|
2638
|
+
{
|
|
2639
|
+
open: !!deleteThreadId,
|
|
2640
|
+
onOpenChange: () => setDeleteThreadId(null),
|
|
2641
|
+
children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2642
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2643
|
+
/* @__PURE__ */ jsx18(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2644
|
+
/* @__PURE__ */ jsx18(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2645
|
+
] }),
|
|
2646
|
+
/* @__PURE__ */ jsxs10(AlertDialogFooter, { children: [
|
|
2647
|
+
/* @__PURE__ */ jsx18(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2648
|
+
/* @__PURE__ */ jsx18(
|
|
2649
|
+
AlertDialogAction,
|
|
2650
|
+
{
|
|
2651
|
+
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
2652
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2653
|
+
children: config.labels?.deleteThread || "Delete"
|
|
2654
|
+
}
|
|
2655
|
+
)
|
|
2656
|
+
] })
|
|
2657
|
+
] })
|
|
2658
|
+
}
|
|
2659
|
+
)
|
|
2595
2660
|
] });
|
|
2596
2661
|
};
|
|
2597
2662
|
|
|
2598
2663
|
// src/components/chat/ChatHeader.tsx
|
|
2599
|
-
import
|
|
2664
|
+
import React11 from "react";
|
|
2600
2665
|
import {
|
|
2601
2666
|
Bot as Bot2,
|
|
2602
2667
|
MoreVertical,
|
|
@@ -2608,12 +2673,12 @@ import {
|
|
|
2608
2673
|
Moon as Moon2,
|
|
2609
2674
|
Sun as Sun2,
|
|
2610
2675
|
ChevronDown as ChevronDown3,
|
|
2611
|
-
Check as
|
|
2676
|
+
Check as Check4
|
|
2612
2677
|
} from "lucide-react";
|
|
2613
2678
|
|
|
2614
2679
|
// src/components/chat/AgentSelectors.tsx
|
|
2615
2680
|
import { memo as memo3, useMemo as useMemo4 } from "react";
|
|
2616
|
-
import { Check as
|
|
2681
|
+
import { Check as Check3, ChevronDown as ChevronDown2, Users, AtSign, X as X2 } from "lucide-react";
|
|
2617
2682
|
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2618
2683
|
var ParticipantsSelector = memo3(({
|
|
2619
2684
|
agents,
|
|
@@ -2703,7 +2768,7 @@ var ParticipantsSelector = memo3(({
|
|
|
2703
2768
|
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2704
2769
|
agent.description && /* @__PURE__ */ jsx19("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2705
2770
|
] }),
|
|
2706
|
-
isSelected && /* @__PURE__ */ jsx19(
|
|
2771
|
+
isSelected && /* @__PURE__ */ jsx19(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2707
2772
|
]
|
|
2708
2773
|
},
|
|
2709
2774
|
agent.id
|
|
@@ -2778,7 +2843,7 @@ var TargetAgentSelector = memo3(({
|
|
|
2778
2843
|
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2779
2844
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2780
2845
|
/* @__PURE__ */ jsx19("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2781
|
-
isSelected && /* @__PURE__ */ jsx19(
|
|
2846
|
+
isSelected && /* @__PURE__ */ jsx19(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2782
2847
|
] }),
|
|
2783
2848
|
agent.description && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2784
2849
|
] })
|
|
@@ -2860,11 +2925,11 @@ var ChatHeader = ({
|
|
|
2860
2925
|
onParticipantsChange,
|
|
2861
2926
|
className = ""
|
|
2862
2927
|
}) => {
|
|
2863
|
-
const [isDarkMode, setIsDarkMode] =
|
|
2928
|
+
const [isDarkMode, setIsDarkMode] = React11.useState(() => {
|
|
2864
2929
|
if (typeof window === "undefined") return false;
|
|
2865
2930
|
return document.documentElement.classList.contains("dark");
|
|
2866
2931
|
});
|
|
2867
|
-
|
|
2932
|
+
React11.useEffect(() => {
|
|
2868
2933
|
const observer = new MutationObserver(() => {
|
|
2869
2934
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
2870
2935
|
});
|
|
@@ -2961,7 +3026,7 @@ var ChatHeader = ({
|
|
|
2961
3026
|
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2962
3027
|
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2963
3028
|
/* @__PURE__ */ jsx20("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2964
|
-
isSelected && /* @__PURE__ */ jsx20(
|
|
3029
|
+
isSelected && /* @__PURE__ */ jsx20(Check4, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2965
3030
|
] }),
|
|
2966
3031
|
agent.description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2967
3032
|
] })
|
|
@@ -3038,7 +3103,7 @@ var ChatHeader = ({
|
|
|
3038
3103
|
};
|
|
3039
3104
|
|
|
3040
3105
|
// src/components/chat/ChatInput.tsx
|
|
3041
|
-
import
|
|
3106
|
+
import React13, { useState as useState7, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect10, memo as memo4 } from "react";
|
|
3042
3107
|
|
|
3043
3108
|
// src/components/chat/UserContext.tsx
|
|
3044
3109
|
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect9, useMemo as useMemo5, useState as useState6 } from "react";
|
|
@@ -3905,7 +3970,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
3905
3970
|
const voiceDraftRef = useRef5(null);
|
|
3906
3971
|
const voiceAppendBaseRef = useRef5(null);
|
|
3907
3972
|
const voiceAppendBaseDurationRef = useRef5(0);
|
|
3908
|
-
const filteredMentionAgents =
|
|
3973
|
+
const filteredMentionAgents = React13.useMemo(() => {
|
|
3909
3974
|
if (!activeMention || mentionAgents.length === 0) return [];
|
|
3910
3975
|
const query = activeMention.query.trim().toLowerCase();
|
|
3911
3976
|
const rank = (agent) => {
|
|
@@ -4605,10 +4670,10 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4605
4670
|
import { useState as useState8 } from "react";
|
|
4606
4671
|
|
|
4607
4672
|
// src/components/ui/scroll-area.tsx
|
|
4608
|
-
import * as
|
|
4673
|
+
import * as React14 from "react";
|
|
4609
4674
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4610
4675
|
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4611
|
-
var ScrollArea =
|
|
4676
|
+
var ScrollArea = React14.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4612
4677
|
return /* @__PURE__ */ jsxs15(
|
|
4613
4678
|
ScrollAreaPrimitive.Root,
|
|
4614
4679
|
{
|
|
@@ -4690,7 +4755,7 @@ import {
|
|
|
4690
4755
|
Heart,
|
|
4691
4756
|
Bot as Bot3,
|
|
4692
4757
|
Pencil,
|
|
4693
|
-
Check as
|
|
4758
|
+
Check as Check5,
|
|
4694
4759
|
X as X5
|
|
4695
4760
|
} from "lucide-react";
|
|
4696
4761
|
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -5004,7 +5069,7 @@ var UserProfile = ({
|
|
|
5004
5069
|
onClick: handleSaveEdit,
|
|
5005
5070
|
disabled: !editingMemoryContent.trim(),
|
|
5006
5071
|
children: [
|
|
5007
|
-
/* @__PURE__ */ jsx26(
|
|
5072
|
+
/* @__PURE__ */ jsx26(Check5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
5008
5073
|
"Salvar"
|
|
5009
5074
|
]
|
|
5010
5075
|
}
|
|
@@ -5067,7 +5132,14 @@ var UserProfile = ({
|
|
|
5067
5132
|
};
|
|
5068
5133
|
|
|
5069
5134
|
// src/components/chat/ChatUI.tsx
|
|
5070
|
-
import {
|
|
5135
|
+
import {
|
|
5136
|
+
ArrowRight,
|
|
5137
|
+
HelpCircle,
|
|
5138
|
+
Lightbulb as Lightbulb2,
|
|
5139
|
+
MessageSquare,
|
|
5140
|
+
Sparkles as Sparkles2,
|
|
5141
|
+
Zap
|
|
5142
|
+
} from "lucide-react";
|
|
5071
5143
|
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5072
5144
|
function getMessageSpeakerKey(message) {
|
|
5073
5145
|
if (!message) return null;
|
|
@@ -5081,7 +5153,9 @@ function getMessageSpeakerKey(message) {
|
|
|
5081
5153
|
}
|
|
5082
5154
|
function getAssistantSpeakerTokens(message) {
|
|
5083
5155
|
if (!message || message.role !== "assistant") return [];
|
|
5084
|
-
const rawTokens = [message.senderAgentId, message.senderName].filter(
|
|
5156
|
+
const rawTokens = [message.senderAgentId, message.senderName].filter(
|
|
5157
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
5158
|
+
).map((value) => value.trim().toLowerCase());
|
|
5085
5159
|
if (rawTokens.length > 0) {
|
|
5086
5160
|
return Array.from(new Set(rawTokens));
|
|
5087
5161
|
}
|
|
@@ -5115,7 +5189,9 @@ var mergeReasoning = (activities) => {
|
|
|
5115
5189
|
return segments.filter((segment, index) => index === 0 || segment !== segments[index - 1]).join("\n\n");
|
|
5116
5190
|
};
|
|
5117
5191
|
var mergeGroupActivity = (messages) => {
|
|
5118
|
-
const activities = messages.map((message) => message.activity).filter(
|
|
5192
|
+
const activities = messages.map((message) => message.activity).filter(
|
|
5193
|
+
(activity) => Boolean(activity)
|
|
5194
|
+
);
|
|
5119
5195
|
if (activities.length === 0) return void 0;
|
|
5120
5196
|
const lastActivity = activities[activities.length - 1];
|
|
5121
5197
|
const mergedReasoning = mergeReasoning(activities);
|
|
@@ -5179,6 +5255,7 @@ var ChatUI = ({
|
|
|
5179
5255
|
currentThreadId = null,
|
|
5180
5256
|
config: userConfig,
|
|
5181
5257
|
sidebar: _sidebar,
|
|
5258
|
+
userMenuSections,
|
|
5182
5259
|
userMenuAdditionalItems,
|
|
5183
5260
|
isGenerating = false,
|
|
5184
5261
|
isMessagesLoading = false,
|
|
@@ -5267,7 +5344,9 @@ var ChatUI = ({
|
|
|
5267
5344
|
}, [attachments]);
|
|
5268
5345
|
const [isCustomMounted, setIsCustomMounted] = useState9(false);
|
|
5269
5346
|
const [isCustomVisible, setIsCustomVisible] = useState9(false);
|
|
5270
|
-
const groupedMessages = useMemo6(() => groupMessagesForRender(messages), [
|
|
5347
|
+
const groupedMessages = useMemo6(() => groupMessagesForRender(messages), [
|
|
5348
|
+
messages
|
|
5349
|
+
]);
|
|
5271
5350
|
const virtualizer = useVirtualizer({
|
|
5272
5351
|
count: groupedMessages.length,
|
|
5273
5352
|
getScrollElement: () => scrollAreaRef.current,
|
|
@@ -5320,7 +5399,9 @@ var ChatUI = ({
|
|
|
5320
5399
|
if (wasEmpty) {
|
|
5321
5400
|
requestAnimationFrame(() => {
|
|
5322
5401
|
requestAnimationFrame(() => {
|
|
5323
|
-
virtualizer.scrollToIndex(groupedMessages.length - 1, {
|
|
5402
|
+
virtualizer.scrollToIndex(groupedMessages.length - 1, {
|
|
5403
|
+
align: "end"
|
|
5404
|
+
});
|
|
5324
5405
|
});
|
|
5325
5406
|
});
|
|
5326
5407
|
return;
|
|
@@ -5378,12 +5459,19 @@ var ChatUI = ({
|
|
|
5378
5459
|
messageCount: groupedMessages.length
|
|
5379
5460
|
} : null;
|
|
5380
5461
|
onLoadOlderMessages();
|
|
5381
|
-
}, [
|
|
5462
|
+
}, [
|
|
5463
|
+
groupedMessages,
|
|
5464
|
+
hasMoreMessagesBefore,
|
|
5465
|
+
isLoadingOlderMessages,
|
|
5466
|
+
onLoadOlderMessages
|
|
5467
|
+
]);
|
|
5382
5468
|
useEffect11(() => {
|
|
5383
5469
|
const validMessageIds = new Set(groupedMessages.map((group) => group.id));
|
|
5384
5470
|
setExpandedMessageIds((prev) => {
|
|
5385
5471
|
const activeIds = Object.keys(prev);
|
|
5386
|
-
const staleIds = activeIds.filter(
|
|
5472
|
+
const staleIds = activeIds.filter(
|
|
5473
|
+
(messageId) => !validMessageIds.has(messageId)
|
|
5474
|
+
);
|
|
5387
5475
|
if (staleIds.length === 0) {
|
|
5388
5476
|
return prev;
|
|
5389
5477
|
}
|
|
@@ -5408,7 +5496,11 @@ var ChatUI = ({
|
|
|
5408
5496
|
}, [hasMoreMessagesBefore, isLoadingOlderMessages, requestOlderMessages]);
|
|
5409
5497
|
const handleSendMessage = useCallback4((content, messageAttachments = []) => {
|
|
5410
5498
|
if (!content.trim() && messageAttachments.length === 0) return;
|
|
5411
|
-
callbacks.onSendMessage?.(
|
|
5499
|
+
callbacks.onSendMessage?.(
|
|
5500
|
+
content,
|
|
5501
|
+
messageAttachments,
|
|
5502
|
+
createStateCallback()
|
|
5503
|
+
);
|
|
5412
5504
|
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5413
5505
|
initialInputConsumedRef.current = true;
|
|
5414
5506
|
onInitialInputConsumed?.();
|
|
@@ -5420,7 +5512,11 @@ var ChatUI = ({
|
|
|
5420
5512
|
const { action, messageId, content } = event;
|
|
5421
5513
|
switch (action) {
|
|
5422
5514
|
case "copy":
|
|
5423
|
-
callbacks.onCopyMessage?.(
|
|
5515
|
+
callbacks.onCopyMessage?.(
|
|
5516
|
+
messageId,
|
|
5517
|
+
content || "",
|
|
5518
|
+
createStateCallback()
|
|
5519
|
+
);
|
|
5424
5520
|
break;
|
|
5425
5521
|
case "edit":
|
|
5426
5522
|
if (content) {
|
|
@@ -5454,9 +5550,12 @@ var ChatUI = ({
|
|
|
5454
5550
|
const handleSelectThread = useCallback4((threadId) => {
|
|
5455
5551
|
callbacks.onSelectThread?.(threadId, createStateCallback());
|
|
5456
5552
|
}, [callbacks, createStateCallback]);
|
|
5457
|
-
const handleRenameThread = useCallback4(
|
|
5458
|
-
|
|
5459
|
-
|
|
5553
|
+
const handleRenameThread = useCallback4(
|
|
5554
|
+
(threadId, newTitle) => {
|
|
5555
|
+
callbacks.onRenameThread?.(threadId, newTitle, createStateCallback());
|
|
5556
|
+
},
|
|
5557
|
+
[callbacks, createStateCallback]
|
|
5558
|
+
);
|
|
5460
5559
|
const handleDeleteThread = useCallback4((threadId) => {
|
|
5461
5560
|
callbacks.onDeleteThread?.(threadId, createStateCallback());
|
|
5462
5561
|
}, [callbacks, createStateCallback]);
|
|
@@ -5484,7 +5583,12 @@ var ChatUI = ({
|
|
|
5484
5583
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5485
5584
|
onThemeChange: callbacks.onThemeChange,
|
|
5486
5585
|
onLogout: callbacks.onLogout
|
|
5487
|
-
}), [
|
|
5586
|
+
}), [
|
|
5587
|
+
handleViewProfile,
|
|
5588
|
+
callbacks.onOpenSettings,
|
|
5589
|
+
callbacks.onThemeChange,
|
|
5590
|
+
callbacks.onLogout
|
|
5591
|
+
]);
|
|
5488
5592
|
const renderCustomComponent = useCallback4(() => {
|
|
5489
5593
|
const component = config?.customComponent?.component;
|
|
5490
5594
|
if (!component) return null;
|
|
@@ -5525,19 +5629,25 @@ var ChatUI = ({
|
|
|
5525
5629
|
const items = messageSuggestions?.[messageId];
|
|
5526
5630
|
if (!items || items.length === 0) return null;
|
|
5527
5631
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5528
|
-
return /* @__PURE__ */ jsx27(
|
|
5529
|
-
"
|
|
5632
|
+
return /* @__PURE__ */ jsx27(
|
|
5633
|
+
"div",
|
|
5530
5634
|
{
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5635
|
+
className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`,
|
|
5636
|
+
children: items.map((suggestion, index) => /* @__PURE__ */ jsxs17(
|
|
5637
|
+
"button",
|
|
5638
|
+
{
|
|
5639
|
+
type: "button",
|
|
5640
|
+
onClick: () => handleSendMessage(suggestion),
|
|
5641
|
+
className: "group inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-full border border-border bg-background hover:bg-accent hover:border-accent-foreground/20 transition-all duration-150 text-foreground/80 hover:text-foreground",
|
|
5642
|
+
children: [
|
|
5643
|
+
/* @__PURE__ */ jsx27(Sparkles2, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5644
|
+
/* @__PURE__ */ jsx27("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5645
|
+
]
|
|
5646
|
+
},
|
|
5647
|
+
`${messageId}-suggestion-${index}`
|
|
5648
|
+
))
|
|
5649
|
+
}
|
|
5650
|
+
);
|
|
5541
5651
|
};
|
|
5542
5652
|
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx27("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5543
5653
|
const isUserRow = index % 2 === 1;
|
|
@@ -5612,202 +5722,229 @@ var ChatUI = ({
|
|
|
5612
5722
|
const shouldShowAgentSelector = Boolean(
|
|
5613
5723
|
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5614
5724
|
);
|
|
5615
|
-
return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsx27(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs17(
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
{
|
|
5619
|
-
|
|
5620
|
-
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
|
|
5626
|
-
|
|
5627
|
-
|
|
5628
|
-
|
|
5629
|
-
|
|
5630
|
-
|
|
5631
|
-
|
|
5632
|
-
|
|
5633
|
-
|
|
5634
|
-
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
isMobile,
|
|
5641
|
-
onCustomComponentToggle: handleCustomComponentToggle,
|
|
5642
|
-
onNewThread: handleCreateThread,
|
|
5643
|
-
showCustomComponentButton: !!config?.customComponent?.component,
|
|
5644
|
-
showAgentSelector: shouldShowAgentSelector,
|
|
5645
|
-
isMultiAgentMode,
|
|
5646
|
-
agentOptions,
|
|
5647
|
-
selectedAgentId,
|
|
5648
|
-
onSelectAgent,
|
|
5649
|
-
participantIds,
|
|
5650
|
-
onParticipantsChange
|
|
5651
|
-
}
|
|
5652
|
-
),
|
|
5653
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5654
|
-
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5725
|
+
return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsx27(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs17(
|
|
5726
|
+
"div",
|
|
5727
|
+
{
|
|
5728
|
+
className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`,
|
|
5729
|
+
children: [
|
|
5730
|
+
/* @__PURE__ */ jsx27(
|
|
5731
|
+
Sidebar2,
|
|
5732
|
+
{
|
|
5733
|
+
threads,
|
|
5734
|
+
currentThreadId: state.selectedThreadId,
|
|
5735
|
+
config,
|
|
5736
|
+
onCreateThread: handleCreateThread,
|
|
5737
|
+
onSelectThread: handleSelectThread,
|
|
5738
|
+
onRenameThread: handleRenameThread,
|
|
5739
|
+
onDeleteThread: handleDeleteThread,
|
|
5740
|
+
onArchiveThread: handleArchiveThread,
|
|
5741
|
+
user: sidebarUser,
|
|
5742
|
+
userMenuCallbacks: sidebarUserMenuCallbacks,
|
|
5743
|
+
currentTheme: config.ui.theme === "auto" ? "system" : config.ui.theme,
|
|
5744
|
+
showThemeOptions: !!callbacks.onThemeChange,
|
|
5745
|
+
userMenuSections,
|
|
5746
|
+
userMenuAdditionalItems
|
|
5747
|
+
}
|
|
5748
|
+
),
|
|
5749
|
+
/* @__PURE__ */ jsx27(SidebarInset, { children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5655
5750
|
/* @__PURE__ */ jsx27(
|
|
5656
|
-
|
|
5751
|
+
ChatHeader,
|
|
5657
5752
|
{
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5753
|
+
config,
|
|
5754
|
+
currentThreadTitle: threads.find(
|
|
5755
|
+
(t) => t.id === state.selectedThreadId
|
|
5756
|
+
)?.title,
|
|
5757
|
+
isMobile,
|
|
5758
|
+
onCustomComponentToggle: handleCustomComponentToggle,
|
|
5759
|
+
onNewThread: handleCreateThread,
|
|
5760
|
+
showCustomComponentButton: !!config?.customComponent?.component,
|
|
5761
|
+
showAgentSelector: shouldShowAgentSelector,
|
|
5762
|
+
isMultiAgentMode,
|
|
5763
|
+
agentOptions,
|
|
5764
|
+
selectedAgentId,
|
|
5765
|
+
onSelectAgent,
|
|
5766
|
+
participantIds,
|
|
5767
|
+
onParticipantsChange
|
|
5768
|
+
}
|
|
5769
|
+
),
|
|
5770
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5771
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5772
|
+
/* @__PURE__ */ jsx27(
|
|
5773
|
+
ScrollArea,
|
|
5774
|
+
{
|
|
5775
|
+
ref: scrollAreaRef,
|
|
5776
|
+
className: "flex-1 min-h-0",
|
|
5777
|
+
viewportClassName: "p-4 overscroll-contain",
|
|
5778
|
+
onScrollCapture: handleScroll,
|
|
5779
|
+
style: { contain: "strict" },
|
|
5780
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "max-w-4xl mx-auto pb-4", children: [
|
|
5781
|
+
groupedMessages.length > 0 && /* @__PURE__ */ jsx27("div", { className: "flex justify-center py-2", children: isLoadingOlderMessages ? /* @__PURE__ */ jsx27("span", { className: "text-xs text-muted-foreground", children: config.labels.loadingOlderMessages }) : hasMoreMessagesBefore ? /* @__PURE__ */ jsx27(
|
|
5782
|
+
"button",
|
|
5783
|
+
{
|
|
5784
|
+
type: "button",
|
|
5785
|
+
onClick: requestOlderMessages,
|
|
5786
|
+
className: "text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
5787
|
+
children: config.labels.loadOlderMessages
|
|
5788
|
+
}
|
|
5789
|
+
) : null }),
|
|
5790
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : groupedMessages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx27(
|
|
5791
|
+
"div",
|
|
5792
|
+
{
|
|
5793
|
+
style: {
|
|
5794
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
5795
|
+
width: "100%",
|
|
5796
|
+
position: "relative"
|
|
5797
|
+
},
|
|
5798
|
+
children: virtualizer.getVirtualItems().map((virtualRow) => {
|
|
5799
|
+
const group = groupedMessages[virtualRow.index];
|
|
5800
|
+
const message = group.message;
|
|
5801
|
+
return /* @__PURE__ */ jsx27(
|
|
5802
|
+
"div",
|
|
5803
|
+
{
|
|
5804
|
+
"data-index": virtualRow.index,
|
|
5805
|
+
ref: virtualizer.measureElement,
|
|
5806
|
+
style: {
|
|
5807
|
+
position: "absolute",
|
|
5808
|
+
top: 0,
|
|
5809
|
+
left: 0,
|
|
5810
|
+
width: "100%",
|
|
5811
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
5812
|
+
},
|
|
5813
|
+
children: /* @__PURE__ */ jsxs17(
|
|
5814
|
+
"div",
|
|
5815
|
+
{
|
|
5816
|
+
className: virtualRow.index === 0 ? "" : "pt-4",
|
|
5817
|
+
children: [
|
|
5818
|
+
/* @__PURE__ */ jsx27(
|
|
5819
|
+
Message,
|
|
5820
|
+
{
|
|
5821
|
+
message,
|
|
5822
|
+
...messageProps,
|
|
5823
|
+
isExpanded: Boolean(
|
|
5824
|
+
expandedMessageIds[message.id]
|
|
5825
|
+
)
|
|
5826
|
+
}
|
|
5827
|
+
),
|
|
5828
|
+
message.role === "assistant" && renderInlineSuggestions(
|
|
5829
|
+
group.suggestionMessageId
|
|
5830
|
+
)
|
|
5831
|
+
]
|
|
5832
|
+
}
|
|
5833
|
+
)
|
|
5834
|
+
},
|
|
5835
|
+
group.id
|
|
5836
|
+
);
|
|
5837
|
+
})
|
|
5838
|
+
}
|
|
5839
|
+
)
|
|
5840
|
+
] })
|
|
5841
|
+
}
|
|
5842
|
+
),
|
|
5843
|
+
/* @__PURE__ */ jsxs17("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5844
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx27("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx27(
|
|
5845
|
+
TargetAgentSelector,
|
|
5666
5846
|
{
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5847
|
+
agents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
5848
|
+
(a) => participantIds.includes(a.id)
|
|
5849
|
+
) : agentOptions,
|
|
5850
|
+
targetAgentId,
|
|
5851
|
+
onTargetChange: onTargetAgentChange,
|
|
5852
|
+
placeholder: config.agentSelector?.label || "Select agent",
|
|
5853
|
+
disabled: isGenerating
|
|
5671
5854
|
}
|
|
5672
|
-
)
|
|
5673
|
-
|
|
5674
|
-
|
|
5855
|
+
) }),
|
|
5856
|
+
/* @__PURE__ */ jsx27(
|
|
5857
|
+
ChatInput,
|
|
5675
5858
|
{
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5859
|
+
value: inputValue,
|
|
5860
|
+
onChange: (value) => {
|
|
5861
|
+
setInputValue(value);
|
|
5862
|
+
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5863
|
+
initialInputConsumedRef.current = true;
|
|
5864
|
+
onInitialInputConsumed?.();
|
|
5865
|
+
}
|
|
5680
5866
|
},
|
|
5681
|
-
|
|
5682
|
-
|
|
5683
|
-
|
|
5684
|
-
|
|
5685
|
-
|
|
5686
|
-
|
|
5687
|
-
|
|
5688
|
-
|
|
5689
|
-
|
|
5690
|
-
|
|
5691
|
-
|
|
5692
|
-
|
|
5693
|
-
|
|
5694
|
-
|
|
5695
|
-
|
|
5696
|
-
|
|
5697
|
-
/* @__PURE__ */ jsx27(
|
|
5698
|
-
Message,
|
|
5699
|
-
{
|
|
5700
|
-
message,
|
|
5701
|
-
...messageProps,
|
|
5702
|
-
isExpanded: Boolean(expandedMessageIds[message.id])
|
|
5703
|
-
}
|
|
5704
|
-
),
|
|
5705
|
-
message.role === "assistant" && renderInlineSuggestions(group.suggestionMessageId)
|
|
5706
|
-
] })
|
|
5707
|
-
},
|
|
5708
|
-
group.id
|
|
5709
|
-
);
|
|
5710
|
-
})
|
|
5867
|
+
onSubmit: handleSendMessage,
|
|
5868
|
+
attachments,
|
|
5869
|
+
onAttachmentsChange: setAttachments,
|
|
5870
|
+
placeholder: config.labels.inputPlaceholder,
|
|
5871
|
+
disabled: false,
|
|
5872
|
+
isGenerating,
|
|
5873
|
+
onStopGeneration: callbacks.onStopGeneration,
|
|
5874
|
+
enableFileUpload: config.features.enableFileUpload,
|
|
5875
|
+
enableAudioRecording: config.features.enableAudioRecording,
|
|
5876
|
+
maxAttachments: config.features.maxAttachments,
|
|
5877
|
+
maxFileSize: config.features.maxFileSize,
|
|
5878
|
+
config,
|
|
5879
|
+
mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
5880
|
+
(a) => participantIds.includes(a.id)
|
|
5881
|
+
) : agentOptions,
|
|
5882
|
+
onTargetAgentChange
|
|
5711
5883
|
}
|
|
5712
5884
|
)
|
|
5713
5885
|
] })
|
|
5714
|
-
}
|
|
5715
|
-
|
|
5716
|
-
|
|
5717
|
-
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx27("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx27(
|
|
5718
|
-
TargetAgentSelector,
|
|
5719
|
-
{
|
|
5720
|
-
agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
|
|
5721
|
-
targetAgentId,
|
|
5722
|
-
onTargetChange: onTargetAgentChange,
|
|
5723
|
-
placeholder: config.agentSelector?.label || "Select agent",
|
|
5724
|
-
disabled: isGenerating
|
|
5725
|
-
}
|
|
5726
|
-
) }),
|
|
5727
|
-
/* @__PURE__ */ jsx27(
|
|
5728
|
-
ChatInput,
|
|
5886
|
+
] }),
|
|
5887
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx27(
|
|
5888
|
+
"div",
|
|
5729
5889
|
{
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5734
|
-
initialInputConsumedRef.current = true;
|
|
5735
|
-
onInitialInputConsumed?.();
|
|
5736
|
-
}
|
|
5890
|
+
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5891
|
+
style: {
|
|
5892
|
+
width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0
|
|
5737
5893
|
},
|
|
5738
|
-
|
|
5739
|
-
|
|
5740
|
-
|
|
5741
|
-
|
|
5742
|
-
|
|
5743
|
-
|
|
5744
|
-
|
|
5745
|
-
|
|
5746
|
-
|
|
5747
|
-
|
|
5748
|
-
maxFileSize: config.features.maxFileSize,
|
|
5749
|
-
config,
|
|
5750
|
-
mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
|
|
5751
|
-
onTargetAgentChange
|
|
5894
|
+
children: state.showSidebar && /* @__PURE__ */ jsx27(
|
|
5895
|
+
"div",
|
|
5896
|
+
{
|
|
5897
|
+
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
5898
|
+
style: {
|
|
5899
|
+
width: config.customComponent.panelWidth ?? 320
|
|
5900
|
+
},
|
|
5901
|
+
children: renderCustomComponent()
|
|
5902
|
+
}
|
|
5903
|
+
)
|
|
5752
5904
|
}
|
|
5753
5905
|
)
|
|
5754
5906
|
] })
|
|
5907
|
+
] }) }),
|
|
5908
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs17("div", { className: "fixed inset-0 z-50", children: [
|
|
5909
|
+
/* @__PURE__ */ jsx27(
|
|
5910
|
+
"div",
|
|
5911
|
+
{
|
|
5912
|
+
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
5913
|
+
style: { willChange: "opacity" },
|
|
5914
|
+
onClick: closeSidebar
|
|
5915
|
+
}
|
|
5916
|
+
),
|
|
5917
|
+
/* @__PURE__ */ jsx27(
|
|
5918
|
+
"div",
|
|
5919
|
+
{
|
|
5920
|
+
className: `absolute top-0 right-0 h-full w-full bg-background transform-gpu transition-transform duration-200 ease-out ${isCustomVisible ? "translate-x-0" : "translate-x-full"}`,
|
|
5921
|
+
style: { willChange: "transform" },
|
|
5922
|
+
children: /* @__PURE__ */ jsx27("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5923
|
+
}
|
|
5924
|
+
)
|
|
5755
5925
|
] }),
|
|
5756
|
-
|
|
5757
|
-
|
|
5926
|
+
isUserProfileOpen && /* @__PURE__ */ jsx27(
|
|
5927
|
+
UserProfile,
|
|
5758
5928
|
{
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5929
|
+
isOpen: isUserProfileOpen,
|
|
5930
|
+
onClose: () => setIsUserProfileOpen(false),
|
|
5931
|
+
user: user ? {
|
|
5932
|
+
id: user.id,
|
|
5933
|
+
name: user.name,
|
|
5934
|
+
email: user.email,
|
|
5935
|
+
avatar: user.avatar
|
|
5936
|
+
} : null,
|
|
5937
|
+
customFields: userContext?.customFields,
|
|
5938
|
+
memories: userContext?.memories?.items,
|
|
5939
|
+
onLogout: callbacks.onLogout,
|
|
5940
|
+
onAddMemory,
|
|
5941
|
+
onUpdateMemory,
|
|
5942
|
+
onDeleteMemory
|
|
5769
5943
|
}
|
|
5770
5944
|
)
|
|
5771
|
-
]
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
/* @__PURE__ */ jsx27(
|
|
5775
|
-
"div",
|
|
5776
|
-
{
|
|
5777
|
-
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
5778
|
-
style: { willChange: "opacity" },
|
|
5779
|
-
onClick: closeSidebar
|
|
5780
|
-
}
|
|
5781
|
-
),
|
|
5782
|
-
/* @__PURE__ */ jsx27(
|
|
5783
|
-
"div",
|
|
5784
|
-
{
|
|
5785
|
-
className: `absolute top-0 right-0 h-full w-full bg-background transform-gpu transition-transform duration-200 ease-out ${isCustomVisible ? "translate-x-0" : "translate-x-full"}`,
|
|
5786
|
-
style: { willChange: "transform" },
|
|
5787
|
-
children: /* @__PURE__ */ jsx27("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5788
|
-
}
|
|
5789
|
-
)
|
|
5790
|
-
] }),
|
|
5791
|
-
isUserProfileOpen && /* @__PURE__ */ jsx27(
|
|
5792
|
-
UserProfile,
|
|
5793
|
-
{
|
|
5794
|
-
isOpen: isUserProfileOpen,
|
|
5795
|
-
onClose: () => setIsUserProfileOpen(false),
|
|
5796
|
-
user: user ? {
|
|
5797
|
-
id: user.id,
|
|
5798
|
-
name: user.name,
|
|
5799
|
-
email: user.email,
|
|
5800
|
-
avatar: user.avatar
|
|
5801
|
-
} : null,
|
|
5802
|
-
customFields: userContext?.customFields,
|
|
5803
|
-
memories: userContext?.memories?.items,
|
|
5804
|
-
onLogout: callbacks.onLogout,
|
|
5805
|
-
onAddMemory,
|
|
5806
|
-
onUpdateMemory,
|
|
5807
|
-
onDeleteMemory
|
|
5808
|
-
}
|
|
5809
|
-
)
|
|
5810
|
-
] }) }) });
|
|
5945
|
+
]
|
|
5946
|
+
}
|
|
5947
|
+
) }) });
|
|
5811
5948
|
};
|
|
5812
5949
|
export {
|
|
5813
5950
|
AssistantActivity,
|