@copilotz/chat-ui 0.6.6 → 0.6.8
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 +523 -387
- 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 +435 -285
- package/dist/index.js.map +1 -1
- package/dist/styles.css +24 -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
|
|
@@ -751,8 +757,7 @@ var StreamingText = memo2(function StreamingText2({
|
|
|
751
757
|
className = "",
|
|
752
758
|
renderMarkdown = true,
|
|
753
759
|
markdown,
|
|
754
|
-
plainTextChunkChars = 12e3
|
|
755
|
-
contentStyle
|
|
760
|
+
plainTextChunkChars = 12e3
|
|
756
761
|
}) {
|
|
757
762
|
const hasContent = content.trim().length > 0;
|
|
758
763
|
const enableSyntaxHighlight = renderMarkdown && !isStreaming && hasCodeBlocks(content);
|
|
@@ -782,7 +787,6 @@ var StreamingText = memo2(function StreamingText2({
|
|
|
782
787
|
LongContentShell,
|
|
783
788
|
{
|
|
784
789
|
className: `prose prose-sm max-w-none dark:prose-invert break-words ${className}`.trim(),
|
|
785
|
-
style: contentStyle,
|
|
786
790
|
children: /* @__PURE__ */ jsx8(
|
|
787
791
|
ReactMarkdown,
|
|
788
792
|
{
|
|
@@ -798,8 +802,7 @@ var StreamingText = memo2(function StreamingText2({
|
|
|
798
802
|
{
|
|
799
803
|
content,
|
|
800
804
|
className,
|
|
801
|
-
chunkSize: plainTextChunkChars
|
|
802
|
-
style: contentStyle
|
|
805
|
+
chunkSize: plainTextChunkChars
|
|
803
806
|
}
|
|
804
807
|
) : null,
|
|
805
808
|
isStreaming && hasContent && /* @__PURE__ */ jsx8("span", { className: "inline-block w-2 h-4 bg-primary animate-pulse ml-1" })
|
|
@@ -949,11 +952,6 @@ var Message = memo2(({
|
|
|
949
952
|
const isCollapsed = canCollapseMessage && !isExpanded;
|
|
950
953
|
const contentToRender = isCollapsed ? getCollapsedPreview(message.content, normalizedPreviewChars, previewOverride) : message.content;
|
|
951
954
|
const shouldRenderMarkdown = !isCollapsed && (!messageIsUser || renderUserMarkdown);
|
|
952
|
-
const shouldApplyLargeContentContainment = !isCollapsed && message.content.length > normalizedChunkChars;
|
|
953
|
-
const contentStyle = shouldApplyLargeContentContainment ? {
|
|
954
|
-
contentVisibility: "auto",
|
|
955
|
-
containIntrinsicSize: "1px 400px"
|
|
956
|
-
} : void 0;
|
|
957
955
|
const horizontalOffsetClass = showAvatar ? messageIsUser ? compactMode ? "mr-9" : "mr-11" : compactMode ? "ml-9" : "ml-11" : "";
|
|
958
956
|
const handleCopy = async () => {
|
|
959
957
|
try {
|
|
@@ -1064,8 +1062,7 @@ var Message = memo2(({
|
|
|
1064
1062
|
isStreaming: message.isStreaming,
|
|
1065
1063
|
renderMarkdown: shouldRenderMarkdown,
|
|
1066
1064
|
markdown,
|
|
1067
|
-
plainTextChunkChars: normalizedChunkChars
|
|
1068
|
-
contentStyle
|
|
1065
|
+
plainTextChunkChars: normalizedChunkChars
|
|
1069
1066
|
}
|
|
1070
1067
|
),
|
|
1071
1068
|
canCollapseMessage && /* @__PURE__ */ jsx8("div", { className: "mt-3", children: /* @__PURE__ */ jsx8(
|
|
@@ -1130,7 +1127,7 @@ var Message = memo2(({
|
|
|
1130
1127
|
}, arePropsEqual);
|
|
1131
1128
|
|
|
1132
1129
|
// src/components/chat/Sidebar.tsx
|
|
1133
|
-
import {
|
|
1130
|
+
import { useEffect as useEffect8, useRef as useRef4, useState as useState5 } from "react";
|
|
1134
1131
|
|
|
1135
1132
|
// src/components/ui/input.tsx
|
|
1136
1133
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -2157,25 +2154,27 @@ function DropdownMenuSeparator({
|
|
|
2157
2154
|
|
|
2158
2155
|
// src/components/chat/Sidebar.tsx
|
|
2159
2156
|
import {
|
|
2160
|
-
Plus,
|
|
2161
|
-
MoreHorizontal,
|
|
2162
|
-
Edit2,
|
|
2163
|
-
Trash2,
|
|
2164
2157
|
Archive,
|
|
2165
|
-
|
|
2158
|
+
Bot,
|
|
2159
|
+
Edit2,
|
|
2166
2160
|
Filter,
|
|
2167
|
-
|
|
2161
|
+
MoreHorizontal,
|
|
2162
|
+
Plus,
|
|
2163
|
+
Search,
|
|
2164
|
+
Trash2
|
|
2168
2165
|
} from "lucide-react";
|
|
2169
2166
|
|
|
2170
2167
|
// src/components/chat/UserMenu.tsx
|
|
2168
|
+
import React8 from "react";
|
|
2171
2169
|
import {
|
|
2172
|
-
|
|
2173
|
-
Settings,
|
|
2174
|
-
LogOut,
|
|
2170
|
+
Check as Check2,
|
|
2175
2171
|
ChevronsUpDown,
|
|
2172
|
+
LogOut,
|
|
2176
2173
|
Moon,
|
|
2174
|
+
Palette,
|
|
2175
|
+
Settings,
|
|
2177
2176
|
Sun,
|
|
2178
|
-
|
|
2177
|
+
User
|
|
2179
2178
|
} from "lucide-react";
|
|
2180
2179
|
import { Fragment as Fragment2, jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2181
2180
|
var getInitials = (name, email) => {
|
|
@@ -2197,6 +2196,7 @@ var UserMenu = ({
|
|
|
2197
2196
|
callbacks,
|
|
2198
2197
|
currentTheme = "system",
|
|
2199
2198
|
showThemeOptions = true,
|
|
2199
|
+
sections = [],
|
|
2200
2200
|
additionalItems
|
|
2201
2201
|
}) => {
|
|
2202
2202
|
const { isMobile } = useSidebar();
|
|
@@ -2260,6 +2260,27 @@ var UserMenu = ({
|
|
|
2260
2260
|
/* @__PURE__ */ jsx17("span", { children: labels.settings })
|
|
2261
2261
|
] }),
|
|
2262
2262
|
additionalItems,
|
|
2263
|
+
sections.map((section) => /* @__PURE__ */ jsxs9(React8.Fragment, { children: [
|
|
2264
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2265
|
+
section.label && /* @__PURE__ */ jsx17(DropdownMenuLabel, { className: "px-2 py-2", children: section.label }),
|
|
2266
|
+
section.items.map((item) => /* @__PURE__ */ jsxs9(
|
|
2267
|
+
DropdownMenuItem,
|
|
2268
|
+
{
|
|
2269
|
+
onClick: item.onSelect,
|
|
2270
|
+
disabled: item.disabled,
|
|
2271
|
+
className: [
|
|
2272
|
+
item.checked ? "bg-accent/60" : "",
|
|
2273
|
+
item.variant === "destructive" ? "text-destructive focus:text-destructive focus:bg-destructive/10" : ""
|
|
2274
|
+
].filter(Boolean).join(" "),
|
|
2275
|
+
children: [
|
|
2276
|
+
item.icon && /* @__PURE__ */ jsx17("span", { className: "mr-2 h-4 w-4 shrink-0", children: item.icon }),
|
|
2277
|
+
/* @__PURE__ */ jsx17("span", { className: "flex-1", children: item.label }),
|
|
2278
|
+
item.checked && /* @__PURE__ */ jsx17(Check2, { className: "ml-2 h-4 w-4 text-primary" })
|
|
2279
|
+
]
|
|
2280
|
+
},
|
|
2281
|
+
item.id
|
|
2282
|
+
))
|
|
2283
|
+
] }, section.id)),
|
|
2263
2284
|
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs9(Fragment2, { children: [
|
|
2264
2285
|
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2265
2286
|
/* @__PURE__ */ jsxs9(
|
|
@@ -2371,6 +2392,7 @@ var Sidebar2 = ({
|
|
|
2371
2392
|
userMenuCallbacks,
|
|
2372
2393
|
currentTheme,
|
|
2373
2394
|
showThemeOptions = true,
|
|
2395
|
+
userMenuSections,
|
|
2374
2396
|
userMenuAdditionalItems,
|
|
2375
2397
|
...props
|
|
2376
2398
|
}) => {
|
|
@@ -2389,7 +2411,9 @@ var Sidebar2 = ({
|
|
|
2389
2411
|
}, [editingThreadId]);
|
|
2390
2412
|
const filteredThreads = threads.filter((thread) => {
|
|
2391
2413
|
const title = (thread.title ?? "").toString();
|
|
2392
|
-
const matchesSearch = title.toLowerCase().includes(
|
|
2414
|
+
const matchesSearch = title.toLowerCase().includes(
|
|
2415
|
+
searchQuery.toLowerCase()
|
|
2416
|
+
);
|
|
2393
2417
|
const matchesArchiveFilter = showArchived || !thread.isArchived;
|
|
2394
2418
|
return matchesSearch && matchesArchiveFilter;
|
|
2395
2419
|
});
|
|
@@ -2513,8 +2537,12 @@ var Sidebar2 = ({
|
|
|
2513
2537
|
value: editTitle,
|
|
2514
2538
|
onChange: (e) => setEditTitle(e.target.value),
|
|
2515
2539
|
onKeyDown: (e) => {
|
|
2516
|
-
if (e.key === "Enter")
|
|
2517
|
-
|
|
2540
|
+
if (e.key === "Enter") {
|
|
2541
|
+
saveEdit();
|
|
2542
|
+
}
|
|
2543
|
+
if (e.key === "Escape") {
|
|
2544
|
+
cancelEdit();
|
|
2545
|
+
}
|
|
2518
2546
|
},
|
|
2519
2547
|
onBlur: saveEdit,
|
|
2520
2548
|
className: "h-7 text-sm"
|
|
@@ -2537,28 +2565,48 @@ var Sidebar2 = ({
|
|
|
2537
2565
|
/* @__PURE__ */ jsx18(MoreHorizontal, {}),
|
|
2538
2566
|
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: "More" })
|
|
2539
2567
|
] }) }),
|
|
2540
|
-
/* @__PURE__ */ jsxs10(
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2568
|
+
/* @__PURE__ */ jsxs10(
|
|
2569
|
+
DropdownMenuContent,
|
|
2570
|
+
{
|
|
2571
|
+
className: "w-48",
|
|
2572
|
+
side: "right",
|
|
2573
|
+
align: "start",
|
|
2574
|
+
children: [
|
|
2575
|
+
/* @__PURE__ */ jsxs10(
|
|
2576
|
+
DropdownMenuItem,
|
|
2577
|
+
{
|
|
2578
|
+
onClick: () => startEditing(thread),
|
|
2579
|
+
children: [
|
|
2580
|
+
/* @__PURE__ */ jsx18(Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2581
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.renameThread || "Rename" })
|
|
2582
|
+
]
|
|
2583
|
+
}
|
|
2584
|
+
),
|
|
2585
|
+
/* @__PURE__ */ jsxs10(
|
|
2586
|
+
DropdownMenuItem,
|
|
2587
|
+
{
|
|
2588
|
+
onClick: () => onArchiveThread?.(thread.id),
|
|
2589
|
+
children: [
|
|
2590
|
+
/* @__PURE__ */ jsx18(Archive, { className: "mr-2 h-4 w-4" }),
|
|
2591
|
+
/* @__PURE__ */ jsx18("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2592
|
+
]
|
|
2593
|
+
}
|
|
2594
|
+
),
|
|
2595
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2596
|
+
/* @__PURE__ */ jsxs10(
|
|
2597
|
+
DropdownMenuItem,
|
|
2598
|
+
{
|
|
2599
|
+
onClick: () => setDeleteThreadId(thread.id),
|
|
2600
|
+
className: "text-destructive focus:text-destructive",
|
|
2601
|
+
children: [
|
|
2602
|
+
/* @__PURE__ */ jsx18(Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2603
|
+
/* @__PURE__ */ jsx18("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2604
|
+
]
|
|
2605
|
+
}
|
|
2606
|
+
)
|
|
2607
|
+
]
|
|
2608
|
+
}
|
|
2609
|
+
)
|
|
2562
2610
|
] })
|
|
2563
2611
|
] }, thread.id)) }) })
|
|
2564
2612
|
] }, group))
|
|
@@ -2571,32 +2619,40 @@ var Sidebar2 = ({
|
|
|
2571
2619
|
callbacks: userMenuCallbacks,
|
|
2572
2620
|
currentTheme,
|
|
2573
2621
|
showThemeOptions,
|
|
2622
|
+
sections: userMenuSections,
|
|
2574
2623
|
additionalItems: userMenuAdditionalItems
|
|
2575
2624
|
}
|
|
2576
2625
|
) }),
|
|
2577
2626
|
/* @__PURE__ */ jsx18(SidebarRail, {}),
|
|
2578
|
-
deleteThreadId && /* @__PURE__ */ jsx18(
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2587
|
-
|
|
2588
|
-
|
|
2589
|
-
|
|
2590
|
-
|
|
2591
|
-
|
|
2592
|
-
|
|
2593
|
-
|
|
2594
|
-
|
|
2627
|
+
deleteThreadId && /* @__PURE__ */ jsx18(
|
|
2628
|
+
AlertDialog,
|
|
2629
|
+
{
|
|
2630
|
+
open: !!deleteThreadId,
|
|
2631
|
+
onOpenChange: () => setDeleteThreadId(null),
|
|
2632
|
+
children: /* @__PURE__ */ jsxs10(AlertDialogContent, { children: [
|
|
2633
|
+
/* @__PURE__ */ jsxs10(AlertDialogHeader, { children: [
|
|
2634
|
+
/* @__PURE__ */ jsx18(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2635
|
+
/* @__PURE__ */ jsx18(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2636
|
+
] }),
|
|
2637
|
+
/* @__PURE__ */ jsxs10(AlertDialogFooter, { children: [
|
|
2638
|
+
/* @__PURE__ */ jsx18(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2639
|
+
/* @__PURE__ */ jsx18(
|
|
2640
|
+
AlertDialogAction,
|
|
2641
|
+
{
|
|
2642
|
+
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
2643
|
+
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
2644
|
+
children: config.labels?.deleteThread || "Delete"
|
|
2645
|
+
}
|
|
2646
|
+
)
|
|
2647
|
+
] })
|
|
2648
|
+
] })
|
|
2649
|
+
}
|
|
2650
|
+
)
|
|
2595
2651
|
] });
|
|
2596
2652
|
};
|
|
2597
2653
|
|
|
2598
2654
|
// src/components/chat/ChatHeader.tsx
|
|
2599
|
-
import
|
|
2655
|
+
import React11 from "react";
|
|
2600
2656
|
import {
|
|
2601
2657
|
Bot as Bot2,
|
|
2602
2658
|
MoreVertical,
|
|
@@ -2608,12 +2664,12 @@ import {
|
|
|
2608
2664
|
Moon as Moon2,
|
|
2609
2665
|
Sun as Sun2,
|
|
2610
2666
|
ChevronDown as ChevronDown3,
|
|
2611
|
-
Check as
|
|
2667
|
+
Check as Check4
|
|
2612
2668
|
} from "lucide-react";
|
|
2613
2669
|
|
|
2614
2670
|
// src/components/chat/AgentSelectors.tsx
|
|
2615
2671
|
import { memo as memo3, useMemo as useMemo4 } from "react";
|
|
2616
|
-
import { Check as
|
|
2672
|
+
import { Check as Check3, ChevronDown as ChevronDown2, Users, AtSign, X as X2 } from "lucide-react";
|
|
2617
2673
|
import { Fragment as Fragment3, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2618
2674
|
var ParticipantsSelector = memo3(({
|
|
2619
2675
|
agents,
|
|
@@ -2703,7 +2759,7 @@ var ParticipantsSelector = memo3(({
|
|
|
2703
2759
|
/* @__PURE__ */ jsx19("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2704
2760
|
agent.description && /* @__PURE__ */ jsx19("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2705
2761
|
] }),
|
|
2706
|
-
isSelected && /* @__PURE__ */ jsx19(
|
|
2762
|
+
isSelected && /* @__PURE__ */ jsx19(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2707
2763
|
]
|
|
2708
2764
|
},
|
|
2709
2765
|
agent.id
|
|
@@ -2778,7 +2834,7 @@ var TargetAgentSelector = memo3(({
|
|
|
2778
2834
|
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2779
2835
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2780
2836
|
/* @__PURE__ */ jsx19("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2781
|
-
isSelected && /* @__PURE__ */ jsx19(
|
|
2837
|
+
isSelected && /* @__PURE__ */ jsx19(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2782
2838
|
] }),
|
|
2783
2839
|
agent.description && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2784
2840
|
] })
|
|
@@ -2860,11 +2916,11 @@ var ChatHeader = ({
|
|
|
2860
2916
|
onParticipantsChange,
|
|
2861
2917
|
className = ""
|
|
2862
2918
|
}) => {
|
|
2863
|
-
const [isDarkMode, setIsDarkMode] =
|
|
2919
|
+
const [isDarkMode, setIsDarkMode] = React11.useState(() => {
|
|
2864
2920
|
if (typeof window === "undefined") return false;
|
|
2865
2921
|
return document.documentElement.classList.contains("dark");
|
|
2866
2922
|
});
|
|
2867
|
-
|
|
2923
|
+
React11.useEffect(() => {
|
|
2868
2924
|
const observer = new MutationObserver(() => {
|
|
2869
2925
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
2870
2926
|
});
|
|
@@ -2961,7 +3017,7 @@ var ChatHeader = ({
|
|
|
2961
3017
|
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2962
3018
|
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2963
3019
|
/* @__PURE__ */ jsx20("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2964
|
-
isSelected && /* @__PURE__ */ jsx20(
|
|
3020
|
+
isSelected && /* @__PURE__ */ jsx20(Check4, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2965
3021
|
] }),
|
|
2966
3022
|
agent.description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2967
3023
|
] })
|
|
@@ -3038,7 +3094,7 @@ var ChatHeader = ({
|
|
|
3038
3094
|
};
|
|
3039
3095
|
|
|
3040
3096
|
// src/components/chat/ChatInput.tsx
|
|
3041
|
-
import
|
|
3097
|
+
import React13, { useState as useState7, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect10, memo as memo4 } from "react";
|
|
3042
3098
|
|
|
3043
3099
|
// src/components/chat/UserContext.tsx
|
|
3044
3100
|
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect9, useMemo as useMemo5, useState as useState6 } from "react";
|
|
@@ -3905,7 +3961,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
3905
3961
|
const voiceDraftRef = useRef5(null);
|
|
3906
3962
|
const voiceAppendBaseRef = useRef5(null);
|
|
3907
3963
|
const voiceAppendBaseDurationRef = useRef5(0);
|
|
3908
|
-
const filteredMentionAgents =
|
|
3964
|
+
const filteredMentionAgents = React13.useMemo(() => {
|
|
3909
3965
|
if (!activeMention || mentionAgents.length === 0) return [];
|
|
3910
3966
|
const query = activeMention.query.trim().toLowerCase();
|
|
3911
3967
|
const rank = (agent) => {
|
|
@@ -4605,10 +4661,10 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4605
4661
|
import { useState as useState8 } from "react";
|
|
4606
4662
|
|
|
4607
4663
|
// src/components/ui/scroll-area.tsx
|
|
4608
|
-
import * as
|
|
4664
|
+
import * as React14 from "react";
|
|
4609
4665
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4610
4666
|
import { jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4611
|
-
var ScrollArea =
|
|
4667
|
+
var ScrollArea = React14.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4612
4668
|
return /* @__PURE__ */ jsxs15(
|
|
4613
4669
|
ScrollAreaPrimitive.Root,
|
|
4614
4670
|
{
|
|
@@ -4690,7 +4746,7 @@ import {
|
|
|
4690
4746
|
Heart,
|
|
4691
4747
|
Bot as Bot3,
|
|
4692
4748
|
Pencil,
|
|
4693
|
-
Check as
|
|
4749
|
+
Check as Check5,
|
|
4694
4750
|
X as X5
|
|
4695
4751
|
} from "lucide-react";
|
|
4696
4752
|
import { Fragment as Fragment6, jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
@@ -5004,7 +5060,7 @@ var UserProfile = ({
|
|
|
5004
5060
|
onClick: handleSaveEdit,
|
|
5005
5061
|
disabled: !editingMemoryContent.trim(),
|
|
5006
5062
|
children: [
|
|
5007
|
-
/* @__PURE__ */ jsx26(
|
|
5063
|
+
/* @__PURE__ */ jsx26(Check5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
5008
5064
|
"Salvar"
|
|
5009
5065
|
]
|
|
5010
5066
|
}
|
|
@@ -5067,7 +5123,14 @@ var UserProfile = ({
|
|
|
5067
5123
|
};
|
|
5068
5124
|
|
|
5069
5125
|
// src/components/chat/ChatUI.tsx
|
|
5070
|
-
import {
|
|
5126
|
+
import {
|
|
5127
|
+
ArrowRight,
|
|
5128
|
+
HelpCircle,
|
|
5129
|
+
Lightbulb as Lightbulb2,
|
|
5130
|
+
MessageSquare,
|
|
5131
|
+
Sparkles as Sparkles2,
|
|
5132
|
+
Zap
|
|
5133
|
+
} from "lucide-react";
|
|
5071
5134
|
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5072
5135
|
function getMessageSpeakerKey(message) {
|
|
5073
5136
|
if (!message) return null;
|
|
@@ -5081,7 +5144,9 @@ function getMessageSpeakerKey(message) {
|
|
|
5081
5144
|
}
|
|
5082
5145
|
function getAssistantSpeakerTokens(message) {
|
|
5083
5146
|
if (!message || message.role !== "assistant") return [];
|
|
5084
|
-
const rawTokens = [message.senderAgentId, message.senderName].filter(
|
|
5147
|
+
const rawTokens = [message.senderAgentId, message.senderName].filter(
|
|
5148
|
+
(value) => typeof value === "string" && value.trim().length > 0
|
|
5149
|
+
).map((value) => value.trim().toLowerCase());
|
|
5085
5150
|
if (rawTokens.length > 0) {
|
|
5086
5151
|
return Array.from(new Set(rawTokens));
|
|
5087
5152
|
}
|
|
@@ -5115,7 +5180,9 @@ var mergeReasoning = (activities) => {
|
|
|
5115
5180
|
return segments.filter((segment, index) => index === 0 || segment !== segments[index - 1]).join("\n\n");
|
|
5116
5181
|
};
|
|
5117
5182
|
var mergeGroupActivity = (messages) => {
|
|
5118
|
-
const activities = messages.map((message) => message.activity).filter(
|
|
5183
|
+
const activities = messages.map((message) => message.activity).filter(
|
|
5184
|
+
(activity) => Boolean(activity)
|
|
5185
|
+
);
|
|
5119
5186
|
if (activities.length === 0) return void 0;
|
|
5120
5187
|
const lastActivity = activities[activities.length - 1];
|
|
5121
5188
|
const mergedReasoning = mergeReasoning(activities);
|
|
@@ -5179,6 +5246,7 @@ var ChatUI = ({
|
|
|
5179
5246
|
currentThreadId = null,
|
|
5180
5247
|
config: userConfig,
|
|
5181
5248
|
sidebar: _sidebar,
|
|
5249
|
+
userMenuSections,
|
|
5182
5250
|
userMenuAdditionalItems,
|
|
5183
5251
|
isGenerating = false,
|
|
5184
5252
|
isMessagesLoading = false,
|
|
@@ -5267,10 +5335,13 @@ var ChatUI = ({
|
|
|
5267
5335
|
}, [attachments]);
|
|
5268
5336
|
const [isCustomMounted, setIsCustomMounted] = useState9(false);
|
|
5269
5337
|
const [isCustomVisible, setIsCustomVisible] = useState9(false);
|
|
5270
|
-
const groupedMessages = useMemo6(() => groupMessagesForRender(messages), [
|
|
5338
|
+
const groupedMessages = useMemo6(() => groupMessagesForRender(messages), [
|
|
5339
|
+
messages
|
|
5340
|
+
]);
|
|
5271
5341
|
const virtualizer = useVirtualizer({
|
|
5272
5342
|
count: groupedMessages.length,
|
|
5273
5343
|
getScrollElement: () => scrollAreaRef.current,
|
|
5344
|
+
getItemKey: (index) => groupedMessages[index]?.id ?? index,
|
|
5274
5345
|
estimateSize: () => 100,
|
|
5275
5346
|
overscan: 5
|
|
5276
5347
|
});
|
|
@@ -5320,7 +5391,9 @@ var ChatUI = ({
|
|
|
5320
5391
|
if (wasEmpty) {
|
|
5321
5392
|
requestAnimationFrame(() => {
|
|
5322
5393
|
requestAnimationFrame(() => {
|
|
5323
|
-
virtualizer.scrollToIndex(groupedMessages.length - 1, {
|
|
5394
|
+
virtualizer.scrollToIndex(groupedMessages.length - 1, {
|
|
5395
|
+
align: "end"
|
|
5396
|
+
});
|
|
5324
5397
|
});
|
|
5325
5398
|
});
|
|
5326
5399
|
return;
|
|
@@ -5337,8 +5410,29 @@ var ChatUI = ({
|
|
|
5337
5410
|
});
|
|
5338
5411
|
}, [groupedMessages, state.isAtBottom, virtualizer]);
|
|
5339
5412
|
useEffect11(() => {
|
|
5340
|
-
|
|
5341
|
-
|
|
5413
|
+
const viewport = scrollAreaRef.current;
|
|
5414
|
+
if (!viewport) return;
|
|
5415
|
+
let rafId;
|
|
5416
|
+
const ro = new ResizeObserver(() => {
|
|
5417
|
+
cancelAnimationFrame(rafId);
|
|
5418
|
+
rafId = requestAnimationFrame(() => {
|
|
5419
|
+
const elements = virtualizer.elementsCache;
|
|
5420
|
+
if (elements) {
|
|
5421
|
+
elements.forEach((node) => {
|
|
5422
|
+
if (node.isConnected) {
|
|
5423
|
+
virtualizer.observer?.unobserve(node);
|
|
5424
|
+
virtualizer.observer?.observe(node);
|
|
5425
|
+
}
|
|
5426
|
+
});
|
|
5427
|
+
}
|
|
5428
|
+
});
|
|
5429
|
+
});
|
|
5430
|
+
ro.observe(viewport);
|
|
5431
|
+
return () => {
|
|
5432
|
+
cancelAnimationFrame(rafId);
|
|
5433
|
+
ro.disconnect();
|
|
5434
|
+
};
|
|
5435
|
+
}, [virtualizer]);
|
|
5342
5436
|
useEffect11(() => {
|
|
5343
5437
|
prependSnapshotRef.current = null;
|
|
5344
5438
|
}, [currentThreadId]);
|
|
@@ -5378,12 +5472,19 @@ var ChatUI = ({
|
|
|
5378
5472
|
messageCount: groupedMessages.length
|
|
5379
5473
|
} : null;
|
|
5380
5474
|
onLoadOlderMessages();
|
|
5381
|
-
}, [
|
|
5475
|
+
}, [
|
|
5476
|
+
groupedMessages,
|
|
5477
|
+
hasMoreMessagesBefore,
|
|
5478
|
+
isLoadingOlderMessages,
|
|
5479
|
+
onLoadOlderMessages
|
|
5480
|
+
]);
|
|
5382
5481
|
useEffect11(() => {
|
|
5383
5482
|
const validMessageIds = new Set(groupedMessages.map((group) => group.id));
|
|
5384
5483
|
setExpandedMessageIds((prev) => {
|
|
5385
5484
|
const activeIds = Object.keys(prev);
|
|
5386
|
-
const staleIds = activeIds.filter(
|
|
5485
|
+
const staleIds = activeIds.filter(
|
|
5486
|
+
(messageId) => !validMessageIds.has(messageId)
|
|
5487
|
+
);
|
|
5387
5488
|
if (staleIds.length === 0) {
|
|
5388
5489
|
return prev;
|
|
5389
5490
|
}
|
|
@@ -5408,7 +5509,11 @@ var ChatUI = ({
|
|
|
5408
5509
|
}, [hasMoreMessagesBefore, isLoadingOlderMessages, requestOlderMessages]);
|
|
5409
5510
|
const handleSendMessage = useCallback4((content, messageAttachments = []) => {
|
|
5410
5511
|
if (!content.trim() && messageAttachments.length === 0) return;
|
|
5411
|
-
callbacks.onSendMessage?.(
|
|
5512
|
+
callbacks.onSendMessage?.(
|
|
5513
|
+
content,
|
|
5514
|
+
messageAttachments,
|
|
5515
|
+
createStateCallback()
|
|
5516
|
+
);
|
|
5412
5517
|
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5413
5518
|
initialInputConsumedRef.current = true;
|
|
5414
5519
|
onInitialInputConsumed?.();
|
|
@@ -5420,7 +5525,11 @@ var ChatUI = ({
|
|
|
5420
5525
|
const { action, messageId, content } = event;
|
|
5421
5526
|
switch (action) {
|
|
5422
5527
|
case "copy":
|
|
5423
|
-
callbacks.onCopyMessage?.(
|
|
5528
|
+
callbacks.onCopyMessage?.(
|
|
5529
|
+
messageId,
|
|
5530
|
+
content || "",
|
|
5531
|
+
createStateCallback()
|
|
5532
|
+
);
|
|
5424
5533
|
break;
|
|
5425
5534
|
case "edit":
|
|
5426
5535
|
if (content) {
|
|
@@ -5454,9 +5563,12 @@ var ChatUI = ({
|
|
|
5454
5563
|
const handleSelectThread = useCallback4((threadId) => {
|
|
5455
5564
|
callbacks.onSelectThread?.(threadId, createStateCallback());
|
|
5456
5565
|
}, [callbacks, createStateCallback]);
|
|
5457
|
-
const handleRenameThread = useCallback4(
|
|
5458
|
-
|
|
5459
|
-
|
|
5566
|
+
const handleRenameThread = useCallback4(
|
|
5567
|
+
(threadId, newTitle) => {
|
|
5568
|
+
callbacks.onRenameThread?.(threadId, newTitle, createStateCallback());
|
|
5569
|
+
},
|
|
5570
|
+
[callbacks, createStateCallback]
|
|
5571
|
+
);
|
|
5460
5572
|
const handleDeleteThread = useCallback4((threadId) => {
|
|
5461
5573
|
callbacks.onDeleteThread?.(threadId, createStateCallback());
|
|
5462
5574
|
}, [callbacks, createStateCallback]);
|
|
@@ -5484,7 +5596,12 @@ var ChatUI = ({
|
|
|
5484
5596
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5485
5597
|
onThemeChange: callbacks.onThemeChange,
|
|
5486
5598
|
onLogout: callbacks.onLogout
|
|
5487
|
-
}), [
|
|
5599
|
+
}), [
|
|
5600
|
+
handleViewProfile,
|
|
5601
|
+
callbacks.onOpenSettings,
|
|
5602
|
+
callbacks.onThemeChange,
|
|
5603
|
+
callbacks.onLogout
|
|
5604
|
+
]);
|
|
5488
5605
|
const renderCustomComponent = useCallback4(() => {
|
|
5489
5606
|
const component = config?.customComponent?.component;
|
|
5490
5607
|
if (!component) return null;
|
|
@@ -5525,19 +5642,25 @@ var ChatUI = ({
|
|
|
5525
5642
|
const items = messageSuggestions?.[messageId];
|
|
5526
5643
|
if (!items || items.length === 0) return null;
|
|
5527
5644
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5528
|
-
return /* @__PURE__ */ jsx27(
|
|
5529
|
-
"
|
|
5645
|
+
return /* @__PURE__ */ jsx27(
|
|
5646
|
+
"div",
|
|
5530
5647
|
{
|
|
5531
|
-
|
|
5532
|
-
|
|
5533
|
-
|
|
5534
|
-
|
|
5535
|
-
|
|
5536
|
-
|
|
5537
|
-
|
|
5538
|
-
|
|
5539
|
-
|
|
5540
|
-
|
|
5648
|
+
className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`,
|
|
5649
|
+
children: items.map((suggestion, index) => /* @__PURE__ */ jsxs17(
|
|
5650
|
+
"button",
|
|
5651
|
+
{
|
|
5652
|
+
type: "button",
|
|
5653
|
+
onClick: () => handleSendMessage(suggestion),
|
|
5654
|
+
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",
|
|
5655
|
+
children: [
|
|
5656
|
+
/* @__PURE__ */ jsx27(Sparkles2, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5657
|
+
/* @__PURE__ */ jsx27("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5658
|
+
]
|
|
5659
|
+
},
|
|
5660
|
+
`${messageId}-suggestion-${index}`
|
|
5661
|
+
))
|
|
5662
|
+
}
|
|
5663
|
+
);
|
|
5541
5664
|
};
|
|
5542
5665
|
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx27("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5543
5666
|
const isUserRow = index % 2 === 1;
|
|
@@ -5612,202 +5735,229 @@ var ChatUI = ({
|
|
|
5612
5735
|
const shouldShowAgentSelector = Boolean(
|
|
5613
5736
|
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5614
5737
|
);
|
|
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: [
|
|
5738
|
+
return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsx27(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs17(
|
|
5739
|
+
"div",
|
|
5740
|
+
{
|
|
5741
|
+
className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`,
|
|
5742
|
+
children: [
|
|
5743
|
+
/* @__PURE__ */ jsx27(
|
|
5744
|
+
Sidebar2,
|
|
5745
|
+
{
|
|
5746
|
+
threads,
|
|
5747
|
+
currentThreadId: state.selectedThreadId,
|
|
5748
|
+
config,
|
|
5749
|
+
onCreateThread: handleCreateThread,
|
|
5750
|
+
onSelectThread: handleSelectThread,
|
|
5751
|
+
onRenameThread: handleRenameThread,
|
|
5752
|
+
onDeleteThread: handleDeleteThread,
|
|
5753
|
+
onArchiveThread: handleArchiveThread,
|
|
5754
|
+
user: sidebarUser,
|
|
5755
|
+
userMenuCallbacks: sidebarUserMenuCallbacks,
|
|
5756
|
+
currentTheme: config.ui.theme === "auto" ? "system" : config.ui.theme,
|
|
5757
|
+
showThemeOptions: !!callbacks.onThemeChange,
|
|
5758
|
+
userMenuSections,
|
|
5759
|
+
userMenuAdditionalItems
|
|
5760
|
+
}
|
|
5761
|
+
),
|
|
5762
|
+
/* @__PURE__ */ jsx27(SidebarInset, { children: /* @__PURE__ */ jsxs17("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5655
5763
|
/* @__PURE__ */ jsx27(
|
|
5656
|
-
|
|
5764
|
+
ChatHeader,
|
|
5657
5765
|
{
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
|
|
5661
|
-
|
|
5662
|
-
|
|
5663
|
-
|
|
5664
|
-
|
|
5665
|
-
|
|
5766
|
+
config,
|
|
5767
|
+
currentThreadTitle: threads.find(
|
|
5768
|
+
(t) => t.id === state.selectedThreadId
|
|
5769
|
+
)?.title,
|
|
5770
|
+
isMobile,
|
|
5771
|
+
onCustomComponentToggle: handleCustomComponentToggle,
|
|
5772
|
+
onNewThread: handleCreateThread,
|
|
5773
|
+
showCustomComponentButton: !!config?.customComponent?.component,
|
|
5774
|
+
showAgentSelector: shouldShowAgentSelector,
|
|
5775
|
+
isMultiAgentMode,
|
|
5776
|
+
agentOptions,
|
|
5777
|
+
selectedAgentId,
|
|
5778
|
+
onSelectAgent,
|
|
5779
|
+
participantIds,
|
|
5780
|
+
onParticipantsChange
|
|
5781
|
+
}
|
|
5782
|
+
),
|
|
5783
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5784
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5785
|
+
/* @__PURE__ */ jsx27(
|
|
5786
|
+
ScrollArea,
|
|
5787
|
+
{
|
|
5788
|
+
ref: scrollAreaRef,
|
|
5789
|
+
className: "flex-1 min-h-0",
|
|
5790
|
+
viewportClassName: "p-4 overscroll-contain",
|
|
5791
|
+
onScrollCapture: handleScroll,
|
|
5792
|
+
style: { contain: "content" },
|
|
5793
|
+
children: /* @__PURE__ */ jsxs17("div", { className: "max-w-4xl mx-auto pb-4", children: [
|
|
5794
|
+
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(
|
|
5795
|
+
"button",
|
|
5796
|
+
{
|
|
5797
|
+
type: "button",
|
|
5798
|
+
onClick: requestOlderMessages,
|
|
5799
|
+
className: "text-xs text-muted-foreground transition-colors hover:text-foreground",
|
|
5800
|
+
children: config.labels.loadOlderMessages
|
|
5801
|
+
}
|
|
5802
|
+
) : null }),
|
|
5803
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : groupedMessages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx27(
|
|
5804
|
+
"div",
|
|
5805
|
+
{
|
|
5806
|
+
style: {
|
|
5807
|
+
height: `${virtualizer.getTotalSize()}px`,
|
|
5808
|
+
width: "100%",
|
|
5809
|
+
position: "relative"
|
|
5810
|
+
},
|
|
5811
|
+
children: virtualizer.getVirtualItems().map((virtualRow) => {
|
|
5812
|
+
const group = groupedMessages[virtualRow.index];
|
|
5813
|
+
const message = group.message;
|
|
5814
|
+
return /* @__PURE__ */ jsx27(
|
|
5815
|
+
"div",
|
|
5816
|
+
{
|
|
5817
|
+
"data-index": virtualRow.index,
|
|
5818
|
+
ref: virtualizer.measureElement,
|
|
5819
|
+
style: {
|
|
5820
|
+
position: "absolute",
|
|
5821
|
+
top: 0,
|
|
5822
|
+
left: 0,
|
|
5823
|
+
width: "100%",
|
|
5824
|
+
transform: `translateY(${virtualRow.start}px)`
|
|
5825
|
+
},
|
|
5826
|
+
children: /* @__PURE__ */ jsxs17(
|
|
5827
|
+
"div",
|
|
5828
|
+
{
|
|
5829
|
+
className: virtualRow.index === 0 ? "" : "pt-4",
|
|
5830
|
+
children: [
|
|
5831
|
+
/* @__PURE__ */ jsx27(
|
|
5832
|
+
Message,
|
|
5833
|
+
{
|
|
5834
|
+
message,
|
|
5835
|
+
...messageProps,
|
|
5836
|
+
isExpanded: Boolean(
|
|
5837
|
+
expandedMessageIds[message.id]
|
|
5838
|
+
)
|
|
5839
|
+
}
|
|
5840
|
+
),
|
|
5841
|
+
message.role === "assistant" && renderInlineSuggestions(
|
|
5842
|
+
group.suggestionMessageId
|
|
5843
|
+
)
|
|
5844
|
+
]
|
|
5845
|
+
}
|
|
5846
|
+
)
|
|
5847
|
+
},
|
|
5848
|
+
group.id
|
|
5849
|
+
);
|
|
5850
|
+
})
|
|
5851
|
+
}
|
|
5852
|
+
)
|
|
5853
|
+
] })
|
|
5854
|
+
}
|
|
5855
|
+
),
|
|
5856
|
+
/* @__PURE__ */ jsxs17("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5857
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx27("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx27(
|
|
5858
|
+
TargetAgentSelector,
|
|
5666
5859
|
{
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5860
|
+
agents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
5861
|
+
(a) => participantIds.includes(a.id)
|
|
5862
|
+
) : agentOptions,
|
|
5863
|
+
targetAgentId,
|
|
5864
|
+
onTargetChange: onTargetAgentChange,
|
|
5865
|
+
placeholder: config.agentSelector?.label || "Select agent",
|
|
5866
|
+
disabled: isGenerating
|
|
5671
5867
|
}
|
|
5672
|
-
)
|
|
5673
|
-
|
|
5674
|
-
|
|
5868
|
+
) }),
|
|
5869
|
+
/* @__PURE__ */ jsx27(
|
|
5870
|
+
ChatInput,
|
|
5675
5871
|
{
|
|
5676
|
-
|
|
5677
|
-
|
|
5678
|
-
|
|
5679
|
-
|
|
5872
|
+
value: inputValue,
|
|
5873
|
+
onChange: (value) => {
|
|
5874
|
+
setInputValue(value);
|
|
5875
|
+
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5876
|
+
initialInputConsumedRef.current = true;
|
|
5877
|
+
onInitialInputConsumed?.();
|
|
5878
|
+
}
|
|
5680
5879
|
},
|
|
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
|
-
})
|
|
5880
|
+
onSubmit: handleSendMessage,
|
|
5881
|
+
attachments,
|
|
5882
|
+
onAttachmentsChange: setAttachments,
|
|
5883
|
+
placeholder: config.labels.inputPlaceholder,
|
|
5884
|
+
disabled: false,
|
|
5885
|
+
isGenerating,
|
|
5886
|
+
onStopGeneration: callbacks.onStopGeneration,
|
|
5887
|
+
enableFileUpload: config.features.enableFileUpload,
|
|
5888
|
+
enableAudioRecording: config.features.enableAudioRecording,
|
|
5889
|
+
maxAttachments: config.features.maxAttachments,
|
|
5890
|
+
maxFileSize: config.features.maxFileSize,
|
|
5891
|
+
config,
|
|
5892
|
+
mentionAgents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
5893
|
+
(a) => participantIds.includes(a.id)
|
|
5894
|
+
) : agentOptions,
|
|
5895
|
+
onTargetAgentChange
|
|
5711
5896
|
}
|
|
5712
5897
|
)
|
|
5713
5898
|
] })
|
|
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,
|
|
5899
|
+
] }),
|
|
5900
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx27(
|
|
5901
|
+
"div",
|
|
5729
5902
|
{
|
|
5730
|
-
|
|
5731
|
-
|
|
5732
|
-
|
|
5733
|
-
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5734
|
-
initialInputConsumedRef.current = true;
|
|
5735
|
-
onInitialInputConsumed?.();
|
|
5736
|
-
}
|
|
5903
|
+
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5904
|
+
style: {
|
|
5905
|
+
width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0
|
|
5737
5906
|
},
|
|
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
|
|
5907
|
+
children: state.showSidebar && /* @__PURE__ */ jsx27(
|
|
5908
|
+
"div",
|
|
5909
|
+
{
|
|
5910
|
+
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
5911
|
+
style: {
|
|
5912
|
+
width: config.customComponent.panelWidth ?? 320
|
|
5913
|
+
},
|
|
5914
|
+
children: renderCustomComponent()
|
|
5915
|
+
}
|
|
5916
|
+
)
|
|
5752
5917
|
}
|
|
5753
5918
|
)
|
|
5754
5919
|
] })
|
|
5920
|
+
] }) }),
|
|
5921
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs17("div", { className: "fixed inset-0 z-50", children: [
|
|
5922
|
+
/* @__PURE__ */ jsx27(
|
|
5923
|
+
"div",
|
|
5924
|
+
{
|
|
5925
|
+
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
5926
|
+
style: { willChange: "opacity" },
|
|
5927
|
+
onClick: closeSidebar
|
|
5928
|
+
}
|
|
5929
|
+
),
|
|
5930
|
+
/* @__PURE__ */ jsx27(
|
|
5931
|
+
"div",
|
|
5932
|
+
{
|
|
5933
|
+
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"}`,
|
|
5934
|
+
style: { willChange: "transform" },
|
|
5935
|
+
children: /* @__PURE__ */ jsx27("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5936
|
+
}
|
|
5937
|
+
)
|
|
5755
5938
|
] }),
|
|
5756
|
-
|
|
5757
|
-
|
|
5939
|
+
isUserProfileOpen && /* @__PURE__ */ jsx27(
|
|
5940
|
+
UserProfile,
|
|
5758
5941
|
{
|
|
5759
|
-
|
|
5760
|
-
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
5765
|
-
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5942
|
+
isOpen: isUserProfileOpen,
|
|
5943
|
+
onClose: () => setIsUserProfileOpen(false),
|
|
5944
|
+
user: user ? {
|
|
5945
|
+
id: user.id,
|
|
5946
|
+
name: user.name,
|
|
5947
|
+
email: user.email,
|
|
5948
|
+
avatar: user.avatar
|
|
5949
|
+
} : null,
|
|
5950
|
+
customFields: userContext?.customFields,
|
|
5951
|
+
memories: userContext?.memories?.items,
|
|
5952
|
+
onLogout: callbacks.onLogout,
|
|
5953
|
+
onAddMemory,
|
|
5954
|
+
onUpdateMemory,
|
|
5955
|
+
onDeleteMemory
|
|
5769
5956
|
}
|
|
5770
5957
|
)
|
|
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
|
-
] }) }) });
|
|
5958
|
+
]
|
|
5959
|
+
}
|
|
5960
|
+
) }) });
|
|
5811
5961
|
};
|
|
5812
5962
|
export {
|
|
5813
5963
|
AssistantActivity,
|