@copilotz/chat-ui 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +905 -564
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +75 -1
- package/dist/index.d.ts +75 -1
- package/dist/index.js +801 -466
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/chat/ChatUI.tsx
|
|
2
|
-
import { useState as useState8, useEffect as useEffect10, useRef as useRef6, useCallback as useCallback4, useMemo as
|
|
2
|
+
import { useState as useState8, useEffect as useEffect10, useRef as useRef6, useCallback as useCallback4, useMemo as useMemo5 } from "react";
|
|
3
3
|
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
4
4
|
|
|
5
5
|
// src/config/chatConfig.ts
|
|
@@ -296,6 +296,75 @@ import ReactMarkdown from "react-markdown";
|
|
|
296
296
|
import remarkGfm from "remark-gfm";
|
|
297
297
|
import rehypeHighlight from "rehype-highlight";
|
|
298
298
|
|
|
299
|
+
// src/lib/chatUtils.ts
|
|
300
|
+
var chatUtils = {
|
|
301
|
+
generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
302
|
+
generateMessageId: () => chatUtils.generateId(),
|
|
303
|
+
generateThreadId: () => chatUtils.generateId(),
|
|
304
|
+
createMessage: (role, content, attachments) => ({
|
|
305
|
+
id: chatUtils.generateMessageId(),
|
|
306
|
+
role,
|
|
307
|
+
content,
|
|
308
|
+
timestamp: Date.now(),
|
|
309
|
+
attachments,
|
|
310
|
+
isComplete: true
|
|
311
|
+
}),
|
|
312
|
+
createThread: (title) => ({
|
|
313
|
+
id: chatUtils.generateThreadId(),
|
|
314
|
+
title,
|
|
315
|
+
createdAt: Date.now(),
|
|
316
|
+
updatedAt: Date.now(),
|
|
317
|
+
messageCount: 0
|
|
318
|
+
}),
|
|
319
|
+
generateThreadTitle: (firstMessage) => {
|
|
320
|
+
const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
|
|
321
|
+
const words = cleaned.split(/\s+/).slice(0, 6);
|
|
322
|
+
return words.join(" ") || "Nova Conversa";
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
var AGENT_COLORS = [
|
|
326
|
+
"#6366f1",
|
|
327
|
+
// indigo
|
|
328
|
+
"#8b5cf6",
|
|
329
|
+
// violet
|
|
330
|
+
"#ec4899",
|
|
331
|
+
// pink
|
|
332
|
+
"#f59e0b",
|
|
333
|
+
// amber
|
|
334
|
+
"#10b981",
|
|
335
|
+
// emerald
|
|
336
|
+
"#3b82f6",
|
|
337
|
+
// blue
|
|
338
|
+
"#ef4444",
|
|
339
|
+
// red
|
|
340
|
+
"#14b8a6",
|
|
341
|
+
// teal
|
|
342
|
+
"#f97316",
|
|
343
|
+
// orange
|
|
344
|
+
"#84cc16"
|
|
345
|
+
// lime
|
|
346
|
+
];
|
|
347
|
+
function getAgentColor(agentId) {
|
|
348
|
+
let hash = 0;
|
|
349
|
+
for (let i = 0; i < agentId.length; i++) {
|
|
350
|
+
hash = (hash << 5) - hash + agentId.charCodeAt(i) | 0;
|
|
351
|
+
}
|
|
352
|
+
return AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length];
|
|
353
|
+
}
|
|
354
|
+
function getAgentInitials(name) {
|
|
355
|
+
const parts = name.trim().split(/\s+/);
|
|
356
|
+
if (parts.length >= 2) {
|
|
357
|
+
return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
358
|
+
}
|
|
359
|
+
return name.slice(0, 2).toUpperCase();
|
|
360
|
+
}
|
|
361
|
+
function assignAgentColors(agents) {
|
|
362
|
+
return agents.map((agent) => ({
|
|
363
|
+
...agent,
|
|
364
|
+
color: agent.color || getAgentColor(agent.id)
|
|
365
|
+
}));
|
|
366
|
+
}
|
|
367
|
+
|
|
299
368
|
// src/components/ui/button.tsx
|
|
300
369
|
import { Slot } from "@radix-ui/react-slot";
|
|
301
370
|
import { cva } from "class-variance-authority";
|
|
@@ -975,13 +1044,20 @@ var Message = memo(({
|
|
|
975
1044
|
markdown,
|
|
976
1045
|
isExpanded = false,
|
|
977
1046
|
onToggleExpanded,
|
|
978
|
-
isGrouped = false
|
|
1047
|
+
isGrouped = false,
|
|
1048
|
+
agentOptions = []
|
|
979
1049
|
}) => {
|
|
980
1050
|
const [isEditing, setIsEditing] = useState(false);
|
|
981
1051
|
const [editContent, setEditContent] = useState(message.content);
|
|
982
1052
|
const [showActions, setShowActions] = useState(false);
|
|
983
1053
|
const [copied, setCopied] = useState(false);
|
|
984
1054
|
const messageIsUser = isUser ?? message.role === "user";
|
|
1055
|
+
const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
|
|
1056
|
+
(a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
|
|
1057
|
+
) : void 0;
|
|
1058
|
+
const isMultiAgent = agentOptions.length > 1;
|
|
1059
|
+
const resolvedAssistantName = isMultiAgent && (agentSender?.name || message.senderName) || assistantName;
|
|
1060
|
+
const agentColor = agentSender ? agentSender.color || getAgentColor(agentSender.id) : void 0;
|
|
985
1061
|
const canEdit = enableEdit && messageIsUser;
|
|
986
1062
|
const canRegenerate = enableRegenerate && !messageIsUser;
|
|
987
1063
|
const normalizedPreviewChars = Math.max(longMessagePreviewChars, 1);
|
|
@@ -1045,9 +1121,26 @@ var Message = memo(({
|
|
|
1045
1121
|
showAvatar && /* @__PURE__ */ jsx7("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ jsx7(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1046
1122
|
/* @__PURE__ */ jsx7(AvatarImage, { src: userAvatar, alt: userName }),
|
|
1047
1123
|
/* @__PURE__ */ jsx7(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
|
|
1124
|
+
] }) : agentSender ? /* @__PURE__ */ jsxs2(Fragment, { children: [
|
|
1125
|
+
agentSender.avatarUrl ? /* @__PURE__ */ jsx7(AvatarImage, { src: agentSender.avatarUrl, alt: agentSender.name }) : null,
|
|
1126
|
+
/* @__PURE__ */ jsx7(
|
|
1127
|
+
AvatarFallback,
|
|
1128
|
+
{
|
|
1129
|
+
style: agentColor ? { backgroundColor: agentColor, color: "white" } : void 0,
|
|
1130
|
+
className: agentColor ? "text-[10px]" : "bg-secondary text-secondary-foreground",
|
|
1131
|
+
children: getAgentInitials(agentSender.name)
|
|
1132
|
+
}
|
|
1133
|
+
)
|
|
1048
1134
|
] }) : /* @__PURE__ */ jsx7(Fragment, { children: assistantAvatar || /* @__PURE__ */ jsx7(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
|
|
1049
1135
|
/* @__PURE__ */ jsxs2("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
1050
|
-
/* @__PURE__ */ jsx7(
|
|
1136
|
+
/* @__PURE__ */ jsx7(
|
|
1137
|
+
"span",
|
|
1138
|
+
{
|
|
1139
|
+
className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
|
|
1140
|
+
style: !messageIsUser && agentColor ? { color: agentColor } : void 0,
|
|
1141
|
+
children: messageIsUser ? userName : resolvedAssistantName
|
|
1142
|
+
}
|
|
1143
|
+
),
|
|
1051
1144
|
showTimestamp && /* @__PURE__ */ jsx7("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
|
|
1052
1145
|
message.isEdited && /* @__PURE__ */ jsx7(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
1053
1146
|
] })
|
|
@@ -2624,7 +2717,7 @@ var Sidebar2 = ({
|
|
|
2624
2717
|
};
|
|
2625
2718
|
|
|
2626
2719
|
// src/components/chat/ChatHeader.tsx
|
|
2627
|
-
import
|
|
2720
|
+
import React9 from "react";
|
|
2628
2721
|
import {
|
|
2629
2722
|
Bot as Bot2,
|
|
2630
2723
|
MoreVertical,
|
|
@@ -2635,10 +2728,239 @@ import {
|
|
|
2635
2728
|
Menu,
|
|
2636
2729
|
Moon as Moon2,
|
|
2637
2730
|
Sun as Sun2,
|
|
2638
|
-
ChevronDown as
|
|
2639
|
-
Check as
|
|
2731
|
+
ChevronDown as ChevronDown3,
|
|
2732
|
+
Check as Check3
|
|
2640
2733
|
} from "lucide-react";
|
|
2734
|
+
|
|
2735
|
+
// src/components/chat/AgentSelectors.tsx
|
|
2736
|
+
import { memo as memo2, useMemo as useMemo3 } from "react";
|
|
2737
|
+
import { Check as Check2, ChevronDown as ChevronDown2, Users, AtSign, X as X2 } from "lucide-react";
|
|
2641
2738
|
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2739
|
+
var ParticipantsSelector = memo2(({
|
|
2740
|
+
agents,
|
|
2741
|
+
participantIds,
|
|
2742
|
+
onParticipantsChange,
|
|
2743
|
+
label = "Team",
|
|
2744
|
+
maxVisible = 3,
|
|
2745
|
+
disabled = false
|
|
2746
|
+
}) => {
|
|
2747
|
+
const agentsWithColors = useMemo3(() => assignAgentColors(agents), [agents]);
|
|
2748
|
+
const selectedAgents = useMemo3(
|
|
2749
|
+
() => agentsWithColors.filter((a) => participantIds.includes(a.id)),
|
|
2750
|
+
[agentsWithColors, participantIds]
|
|
2751
|
+
);
|
|
2752
|
+
const toggleParticipant = (agentId) => {
|
|
2753
|
+
if (participantIds.includes(agentId)) {
|
|
2754
|
+
if (participantIds.length > 1) {
|
|
2755
|
+
onParticipantsChange(participantIds.filter((id) => id !== agentId));
|
|
2756
|
+
}
|
|
2757
|
+
} else {
|
|
2758
|
+
onParticipantsChange([...participantIds, agentId]);
|
|
2759
|
+
}
|
|
2760
|
+
};
|
|
2761
|
+
const selectAll = () => {
|
|
2762
|
+
onParticipantsChange(agentsWithColors.map((a) => a.id));
|
|
2763
|
+
};
|
|
2764
|
+
const visibleAgents = selectedAgents.slice(0, maxVisible);
|
|
2765
|
+
const hiddenCount = selectedAgents.length - maxVisible;
|
|
2766
|
+
return /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2767
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
2768
|
+
Button,
|
|
2769
|
+
{
|
|
2770
|
+
variant: "ghost",
|
|
2771
|
+
className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
|
|
2772
|
+
disabled,
|
|
2773
|
+
children: [
|
|
2774
|
+
/* @__PURE__ */ jsx18(Users, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2775
|
+
/* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2776
|
+
/* @__PURE__ */ jsx18("div", { className: "flex -space-x-1.5", children: visibleAgents.map((agent) => /* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5 border-2 border-background", children: [
|
|
2777
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2778
|
+
/* @__PURE__ */ jsx18(
|
|
2779
|
+
AvatarFallback,
|
|
2780
|
+
{
|
|
2781
|
+
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
2782
|
+
className: "text-[8px]",
|
|
2783
|
+
children: getAgentInitials(agent.name)
|
|
2784
|
+
}
|
|
2785
|
+
)
|
|
2786
|
+
] }, agent.id)) }),
|
|
2787
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs10("span", { className: "text-xs text-muted-foreground", children: [
|
|
2788
|
+
"+",
|
|
2789
|
+
hiddenCount
|
|
2790
|
+
] })
|
|
2791
|
+
] }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: label }) }),
|
|
2792
|
+
/* @__PURE__ */ jsx18(ChevronDown2, { className: "h-3 w-3 opacity-50" })
|
|
2793
|
+
]
|
|
2794
|
+
}
|
|
2795
|
+
) }),
|
|
2796
|
+
/* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
|
|
2797
|
+
/* @__PURE__ */ jsxs10(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
|
|
2798
|
+
/* @__PURE__ */ jsx18("span", { children: "Participants" }),
|
|
2799
|
+
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ jsx18(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
|
|
2800
|
+
] }),
|
|
2801
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2802
|
+
agentsWithColors.map((agent) => {
|
|
2803
|
+
const isSelected = participantIds.includes(agent.id);
|
|
2804
|
+
const isLastSelected = isSelected && participantIds.length === 1;
|
|
2805
|
+
return /* @__PURE__ */ jsxs10(
|
|
2806
|
+
DropdownMenuItem,
|
|
2807
|
+
{
|
|
2808
|
+
onClick: () => toggleParticipant(agent.id),
|
|
2809
|
+
className: "flex items-center gap-3 p-2 cursor-pointer",
|
|
2810
|
+
disabled: isLastSelected,
|
|
2811
|
+
children: [
|
|
2812
|
+
/* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6", children: [
|
|
2813
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2814
|
+
/* @__PURE__ */ jsx18(
|
|
2815
|
+
AvatarFallback,
|
|
2816
|
+
{
|
|
2817
|
+
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
2818
|
+
className: "text-[10px]",
|
|
2819
|
+
children: getAgentInitials(agent.name)
|
|
2820
|
+
}
|
|
2821
|
+
)
|
|
2822
|
+
] }),
|
|
2823
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
|
|
2824
|
+
/* @__PURE__ */ jsx18("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2825
|
+
agent.description && /* @__PURE__ */ jsx18("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2826
|
+
] }),
|
|
2827
|
+
isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2828
|
+
]
|
|
2829
|
+
},
|
|
2830
|
+
agent.id
|
|
2831
|
+
);
|
|
2832
|
+
})
|
|
2833
|
+
] })
|
|
2834
|
+
] });
|
|
2835
|
+
});
|
|
2836
|
+
ParticipantsSelector.displayName = "ParticipantsSelector";
|
|
2837
|
+
var TargetAgentSelector = memo2(({
|
|
2838
|
+
agents,
|
|
2839
|
+
targetAgentId,
|
|
2840
|
+
onTargetChange,
|
|
2841
|
+
label = "Target",
|
|
2842
|
+
placeholder = "Select agent",
|
|
2843
|
+
disabled = false
|
|
2844
|
+
}) => {
|
|
2845
|
+
const agentsWithColors = useMemo3(() => assignAgentColors(agents), [agents]);
|
|
2846
|
+
const selectedAgent = useMemo3(
|
|
2847
|
+
() => agentsWithColors.find((a) => a.id === targetAgentId),
|
|
2848
|
+
[agentsWithColors, targetAgentId]
|
|
2849
|
+
);
|
|
2850
|
+
return /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2851
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
2852
|
+
Button,
|
|
2853
|
+
{
|
|
2854
|
+
variant: "ghost",
|
|
2855
|
+
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2856
|
+
disabled,
|
|
2857
|
+
children: [
|
|
2858
|
+
/* @__PURE__ */ jsx18(AtSign, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2859
|
+
selectedAgent ? /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2860
|
+
/* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5", children: [
|
|
2861
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2862
|
+
/* @__PURE__ */ jsx18(
|
|
2863
|
+
AvatarFallback,
|
|
2864
|
+
{
|
|
2865
|
+
style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
|
|
2866
|
+
className: "text-[10px]",
|
|
2867
|
+
children: getAgentInitials(selectedAgent.name)
|
|
2868
|
+
}
|
|
2869
|
+
)
|
|
2870
|
+
] }),
|
|
2871
|
+
/* @__PURE__ */ jsx18("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
|
|
2872
|
+
] }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2873
|
+
/* @__PURE__ */ jsx18(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
2874
|
+
]
|
|
2875
|
+
}
|
|
2876
|
+
) }),
|
|
2877
|
+
/* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
|
|
2878
|
+
/* @__PURE__ */ jsx18(DropdownMenuLabel, { children: label }),
|
|
2879
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2880
|
+
agentsWithColors.map((agent) => {
|
|
2881
|
+
const isSelected = agent.id === targetAgentId;
|
|
2882
|
+
return /* @__PURE__ */ jsxs10(
|
|
2883
|
+
DropdownMenuItem,
|
|
2884
|
+
{
|
|
2885
|
+
onClick: () => onTargetChange(agent.id),
|
|
2886
|
+
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2887
|
+
children: [
|
|
2888
|
+
/* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2889
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2890
|
+
/* @__PURE__ */ jsx18(
|
|
2891
|
+
AvatarFallback,
|
|
2892
|
+
{
|
|
2893
|
+
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
2894
|
+
className: "text-[10px]",
|
|
2895
|
+
children: getAgentInitials(agent.name)
|
|
2896
|
+
}
|
|
2897
|
+
)
|
|
2898
|
+
] }),
|
|
2899
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
|
|
2900
|
+
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2901
|
+
/* @__PURE__ */ jsx18("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2902
|
+
isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2903
|
+
] }),
|
|
2904
|
+
agent.description && /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2905
|
+
] })
|
|
2906
|
+
]
|
|
2907
|
+
},
|
|
2908
|
+
agent.id
|
|
2909
|
+
);
|
|
2910
|
+
})
|
|
2911
|
+
] })
|
|
2912
|
+
] });
|
|
2913
|
+
});
|
|
2914
|
+
TargetAgentSelector.displayName = "TargetAgentSelector";
|
|
2915
|
+
var AgentBadge = memo2(({
|
|
2916
|
+
agent,
|
|
2917
|
+
onRemove,
|
|
2918
|
+
showRemove = false,
|
|
2919
|
+
size = "md"
|
|
2920
|
+
}) => {
|
|
2921
|
+
const color = agent.color || getAgentColor(agent.id);
|
|
2922
|
+
const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
2923
|
+
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
2924
|
+
return /* @__PURE__ */ jsxs10(
|
|
2925
|
+
Badge,
|
|
2926
|
+
{
|
|
2927
|
+
variant: "secondary",
|
|
2928
|
+
className: "flex items-center gap-1.5 pr-1",
|
|
2929
|
+
style: { borderColor: color, borderWidth: 1 },
|
|
2930
|
+
children: [
|
|
2931
|
+
/* @__PURE__ */ jsxs10(Avatar, { className: avatarSize, children: [
|
|
2932
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2933
|
+
/* @__PURE__ */ jsx18(
|
|
2934
|
+
AvatarFallback,
|
|
2935
|
+
{
|
|
2936
|
+
style: { backgroundColor: color, color: "white" },
|
|
2937
|
+
className: "text-[8px]",
|
|
2938
|
+
children: getAgentInitials(agent.name)
|
|
2939
|
+
}
|
|
2940
|
+
)
|
|
2941
|
+
] }),
|
|
2942
|
+
/* @__PURE__ */ jsx18("span", { className: textSize, children: agent.name }),
|
|
2943
|
+
showRemove && onRemove && /* @__PURE__ */ jsx18(
|
|
2944
|
+
Button,
|
|
2945
|
+
{
|
|
2946
|
+
variant: "ghost",
|
|
2947
|
+
size: "icon",
|
|
2948
|
+
className: "h-4 w-4 ml-0.5 hover:bg-destructive/20",
|
|
2949
|
+
onClick: (e) => {
|
|
2950
|
+
e.stopPropagation();
|
|
2951
|
+
onRemove();
|
|
2952
|
+
},
|
|
2953
|
+
children: /* @__PURE__ */ jsx18(X2, { className: "h-3 w-3" })
|
|
2954
|
+
}
|
|
2955
|
+
)
|
|
2956
|
+
]
|
|
2957
|
+
}
|
|
2958
|
+
);
|
|
2959
|
+
});
|
|
2960
|
+
AgentBadge.displayName = "AgentBadge";
|
|
2961
|
+
|
|
2962
|
+
// src/components/chat/ChatHeader.tsx
|
|
2963
|
+
import { Fragment as Fragment4, jsx as jsx19, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2642
2964
|
var ChatHeader = ({
|
|
2643
2965
|
config,
|
|
2644
2966
|
currentThreadTitle,
|
|
@@ -2651,16 +2973,19 @@ var ChatHeader = ({
|
|
|
2651
2973
|
showCustomComponentButton,
|
|
2652
2974
|
isMobile,
|
|
2653
2975
|
showAgentSelector = false,
|
|
2976
|
+
isMultiAgentMode = false,
|
|
2654
2977
|
agentOptions = [],
|
|
2655
2978
|
selectedAgentId = null,
|
|
2656
2979
|
onSelectAgent,
|
|
2980
|
+
participantIds,
|
|
2981
|
+
onParticipantsChange,
|
|
2657
2982
|
className = ""
|
|
2658
2983
|
}) => {
|
|
2659
|
-
const [isDarkMode, setIsDarkMode] =
|
|
2984
|
+
const [isDarkMode, setIsDarkMode] = React9.useState(() => {
|
|
2660
2985
|
if (typeof window === "undefined") return false;
|
|
2661
2986
|
return document.documentElement.classList.contains("dark");
|
|
2662
2987
|
});
|
|
2663
|
-
|
|
2988
|
+
React9.useEffect(() => {
|
|
2664
2989
|
const observer = new MutationObserver(() => {
|
|
2665
2990
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
2666
2991
|
});
|
|
@@ -2706,52 +3031,60 @@ var ChatHeader = ({
|
|
|
2706
3031
|
};
|
|
2707
3032
|
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2708
3033
|
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2709
|
-
return /* @__PURE__ */
|
|
3034
|
+
return /* @__PURE__ */ jsx19(
|
|
2710
3035
|
Card,
|
|
2711
3036
|
{
|
|
2712
3037
|
"data-chat-header": true,
|
|
2713
3038
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2714
3039
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2715
|
-
children: /* @__PURE__ */
|
|
2716
|
-
/* @__PURE__ */
|
|
2717
|
-
/* @__PURE__ */
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
3040
|
+
children: /* @__PURE__ */ jsx19(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center justify-between gap-2", children: [
|
|
3041
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
3042
|
+
/* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
3043
|
+
/* @__PURE__ */ jsx19(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(SidebarTrigger, { className: "-ml-1" }) }),
|
|
3044
|
+
/* @__PURE__ */ jsx19(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2720
3045
|
] }),
|
|
2721
|
-
showAgentSelector && /* @__PURE__ */
|
|
2722
|
-
|
|
3046
|
+
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ jsx19(
|
|
3047
|
+
ParticipantsSelector,
|
|
3048
|
+
{
|
|
3049
|
+
agents: agentOptions,
|
|
3050
|
+
participantIds: participantIds ?? agentOptions.map((a) => a.id),
|
|
3051
|
+
onParticipantsChange
|
|
3052
|
+
}
|
|
3053
|
+
),
|
|
3054
|
+
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
3055
|
+
/* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(
|
|
2723
3056
|
Button,
|
|
2724
3057
|
{
|
|
2725
3058
|
variant: "ghost",
|
|
2726
3059
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2727
3060
|
children: [
|
|
2728
|
-
selectedAgent?.avatarUrl ? /* @__PURE__ */
|
|
2729
|
-
/* @__PURE__ */
|
|
2730
|
-
/* @__PURE__ */
|
|
3061
|
+
selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs11(Avatar, { className: "h-5 w-5", children: [
|
|
3062
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
3063
|
+
/* @__PURE__ */ jsx19(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2731
3064
|
] }) : null,
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ jsx19("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
3066
|
+
/* @__PURE__ */ jsx19(ChevronDown3, { className: "h-4 w-4 opacity-50" })
|
|
2734
3067
|
]
|
|
2735
3068
|
}
|
|
2736
3069
|
) }),
|
|
2737
|
-
/* @__PURE__ */
|
|
3070
|
+
/* @__PURE__ */ jsx19(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
2738
3071
|
const isSelected = agent.id === selectedAgentId;
|
|
2739
|
-
return /* @__PURE__ */
|
|
3072
|
+
return /* @__PURE__ */ jsxs11(
|
|
2740
3073
|
DropdownMenuItem,
|
|
2741
3074
|
{
|
|
2742
3075
|
onClick: () => onSelectAgent?.(agent.id),
|
|
2743
3076
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2744
3077
|
children: [
|
|
2745
|
-
agent.avatarUrl ? /* @__PURE__ */
|
|
2746
|
-
/* @__PURE__ */
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
] }) : /* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2750
|
-
/* @__PURE__ */
|
|
2751
|
-
/* @__PURE__ */
|
|
2752
|
-
isSelected && /* @__PURE__ */
|
|
3078
|
+
agent.avatarUrl ? /* @__PURE__ */ jsxs11(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
3079
|
+
/* @__PURE__ */ jsx19(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
3080
|
+
/* @__PURE__ */ jsx19(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
3081
|
+
] }) : /* @__PURE__ */ jsx19("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx19(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3082
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
3083
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
3084
|
+
/* @__PURE__ */ jsx19("span", { className: "font-medium text-sm", children: agent.name }),
|
|
3085
|
+
isSelected && /* @__PURE__ */ jsx19(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2753
3086
|
] }),
|
|
2754
|
-
agent.description && /* @__PURE__ */
|
|
3087
|
+
agent.description && /* @__PURE__ */ jsx19("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2755
3088
|
] })
|
|
2756
3089
|
]
|
|
2757
3090
|
},
|
|
@@ -2759,59 +3092,59 @@ var ChatHeader = ({
|
|
|
2759
3092
|
);
|
|
2760
3093
|
}) })
|
|
2761
3094
|
] }),
|
|
2762
|
-
!showAgentSelector && isMobile && /* @__PURE__ */
|
|
3095
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ jsx19("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
2763
3096
|
] }),
|
|
2764
|
-
/* @__PURE__ */
|
|
2765
|
-
/* @__PURE__ */
|
|
2766
|
-
showCustomComponentButton && config.customComponent && /* @__PURE__ */
|
|
2767
|
-
/* @__PURE__ */
|
|
3097
|
+
/* @__PURE__ */ jsx19("div", { className: "flex-1" }),
|
|
3098
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-1", children: [
|
|
3099
|
+
showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
3100
|
+
/* @__PURE__ */ jsx19(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(
|
|
2768
3101
|
Button,
|
|
2769
3102
|
{
|
|
2770
3103
|
variant: "ghost",
|
|
2771
3104
|
size: "icon",
|
|
2772
3105
|
className: "h-8 w-8",
|
|
2773
3106
|
onClick: onCustomComponentToggle,
|
|
2774
|
-
children: config.customComponent.icon || /* @__PURE__ */
|
|
3107
|
+
children: config.customComponent.icon || /* @__PURE__ */ jsx19(Menu, { className: "h-4 w-4" })
|
|
2775
3108
|
}
|
|
2776
3109
|
) }),
|
|
2777
|
-
/* @__PURE__ */
|
|
3110
|
+
/* @__PURE__ */ jsx19(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
2778
3111
|
] }),
|
|
2779
3112
|
config.headerActions,
|
|
2780
|
-
/* @__PURE__ */
|
|
2781
|
-
/* @__PURE__ */
|
|
2782
|
-
/* @__PURE__ */
|
|
2783
|
-
onNewThread && /* @__PURE__ */
|
|
2784
|
-
/* @__PURE__ */
|
|
2785
|
-
/* @__PURE__ */
|
|
3113
|
+
/* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
3114
|
+
/* @__PURE__ */ jsx19(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx19(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx19(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
3115
|
+
/* @__PURE__ */ jsxs11(DropdownMenuContent, { align: "end", children: [
|
|
3116
|
+
onNewThread && /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3117
|
+
/* @__PURE__ */ jsxs11(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
3118
|
+
/* @__PURE__ */ jsx19(Plus2, { className: "h-4 w-4 mr-2" }),
|
|
2786
3119
|
config.labels?.newThread || "New Thread"
|
|
2787
3120
|
] }),
|
|
2788
|
-
/* @__PURE__ */
|
|
3121
|
+
/* @__PURE__ */ jsx19(DropdownMenuSeparator, {})
|
|
2789
3122
|
] }),
|
|
2790
|
-
onExportData && /* @__PURE__ */
|
|
2791
|
-
/* @__PURE__ */
|
|
3123
|
+
onExportData && /* @__PURE__ */ jsxs11(DropdownMenuItem, { onClick: onExportData, children: [
|
|
3124
|
+
/* @__PURE__ */ jsx19(Download, { className: "h-4 w-4 mr-2" }),
|
|
2792
3125
|
config.labels?.exportData || "Export Data"
|
|
2793
3126
|
] }),
|
|
2794
|
-
onImportData && /* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
3127
|
+
onImportData && /* @__PURE__ */ jsxs11(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
3128
|
+
/* @__PURE__ */ jsx19(Upload, { className: "h-4 w-4 mr-2" }),
|
|
2796
3129
|
config.labels?.importData || "Import Data"
|
|
2797
3130
|
] }),
|
|
2798
|
-
(onExportData || onImportData) && /* @__PURE__ */
|
|
2799
|
-
/* @__PURE__ */
|
|
2800
|
-
/* @__PURE__ */
|
|
3131
|
+
(onExportData || onImportData) && /* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
|
|
3132
|
+
/* @__PURE__ */ jsx19(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3133
|
+
/* @__PURE__ */ jsx19(Sun2, { className: "h-4 w-4 mr-2" }),
|
|
2801
3134
|
config.labels?.lightMode || "Light Mode"
|
|
2802
|
-
] }) : /* @__PURE__ */
|
|
2803
|
-
/* @__PURE__ */
|
|
3135
|
+
] }) : /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3136
|
+
/* @__PURE__ */ jsx19(Moon2, { className: "h-4 w-4 mr-2" }),
|
|
2804
3137
|
config.labels?.darkMode || "Dark Mode"
|
|
2805
3138
|
] }) }),
|
|
2806
|
-
onClearAll && /* @__PURE__ */
|
|
2807
|
-
/* @__PURE__ */
|
|
2808
|
-
/* @__PURE__ */
|
|
3139
|
+
onClearAll && /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3140
|
+
/* @__PURE__ */ jsx19(DropdownMenuSeparator, {}),
|
|
3141
|
+
/* @__PURE__ */ jsxs11(
|
|
2809
3142
|
DropdownMenuItem,
|
|
2810
3143
|
{
|
|
2811
3144
|
onClick: onClearAll,
|
|
2812
3145
|
className: "text-destructive",
|
|
2813
3146
|
children: [
|
|
2814
|
-
/* @__PURE__ */
|
|
3147
|
+
/* @__PURE__ */ jsx19(Trash22, { className: "h-4 w-4 mr-2" }),
|
|
2815
3148
|
config.labels?.clearAll || "Clear All"
|
|
2816
3149
|
]
|
|
2817
3150
|
}
|
|
@@ -2826,11 +3159,11 @@ var ChatHeader = ({
|
|
|
2826
3159
|
};
|
|
2827
3160
|
|
|
2828
3161
|
// src/components/chat/ChatInput.tsx
|
|
2829
|
-
import { useState as useState6, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect9, memo as
|
|
3162
|
+
import { useState as useState6, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect9, memo as memo3 } from "react";
|
|
2830
3163
|
|
|
2831
3164
|
// src/components/chat/UserContext.tsx
|
|
2832
|
-
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as
|
|
2833
|
-
import { jsx as
|
|
3165
|
+
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo4, useState as useState5 } from "react";
|
|
3166
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2834
3167
|
var Ctx = createContext2(void 0);
|
|
2835
3168
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
2836
3169
|
const [ctx, setCtx] = useState5(() => ({
|
|
@@ -2852,12 +3185,12 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
2852
3185
|
return { ...prev, ...partial, updatedAt: Date.now() };
|
|
2853
3186
|
});
|
|
2854
3187
|
}, []);
|
|
2855
|
-
const value =
|
|
3188
|
+
const value = useMemo4(() => ({
|
|
2856
3189
|
context: ctx,
|
|
2857
3190
|
setContext: setPartial,
|
|
2858
3191
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
2859
3192
|
}), [ctx, setPartial]);
|
|
2860
|
-
return /* @__PURE__ */
|
|
3193
|
+
return /* @__PURE__ */ jsx20(Ctx.Provider, { value, children });
|
|
2861
3194
|
};
|
|
2862
3195
|
function useChatUserContext() {
|
|
2863
3196
|
const v = useContext2(Ctx);
|
|
@@ -3191,13 +3524,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
|
|
|
3191
3524
|
|
|
3192
3525
|
// src/components/ui/progress.tsx
|
|
3193
3526
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3194
|
-
import { jsx as
|
|
3527
|
+
import { jsx as jsx21 } from "react/jsx-runtime";
|
|
3195
3528
|
function Progress({
|
|
3196
3529
|
className,
|
|
3197
3530
|
value,
|
|
3198
3531
|
...props
|
|
3199
3532
|
}) {
|
|
3200
|
-
return /* @__PURE__ */
|
|
3533
|
+
return /* @__PURE__ */ jsx21(
|
|
3201
3534
|
ProgressPrimitive.Root,
|
|
3202
3535
|
{
|
|
3203
3536
|
"data-slot": "progress",
|
|
@@ -3206,7 +3539,7 @@ function Progress({
|
|
|
3206
3539
|
className
|
|
3207
3540
|
),
|
|
3208
3541
|
...props,
|
|
3209
|
-
children: /* @__PURE__ */
|
|
3542
|
+
children: /* @__PURE__ */ jsx21(
|
|
3210
3543
|
ProgressPrimitive.Indicator,
|
|
3211
3544
|
{
|
|
3212
3545
|
"data-slot": "progress-indicator",
|
|
@@ -3219,8 +3552,8 @@ function Progress({
|
|
|
3219
3552
|
}
|
|
3220
3553
|
|
|
3221
3554
|
// src/components/chat/VoiceComposer.tsx
|
|
3222
|
-
import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as
|
|
3223
|
-
import { jsx as
|
|
3555
|
+
import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as X3 } from "lucide-react";
|
|
3556
|
+
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3224
3557
|
var formatDuration = (durationMs) => {
|
|
3225
3558
|
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
3226
3559
|
const minutes = Math.floor(totalSeconds / 60);
|
|
@@ -3315,13 +3648,13 @@ var VoiceComposer = ({
|
|
|
3315
3648
|
}
|
|
3316
3649
|
onRecordAgain();
|
|
3317
3650
|
};
|
|
3318
|
-
return /* @__PURE__ */
|
|
3319
|
-
/* @__PURE__ */
|
|
3320
|
-
/* @__PURE__ */
|
|
3321
|
-
/* @__PURE__ */
|
|
3322
|
-
/* @__PURE__ */
|
|
3651
|
+
return /* @__PURE__ */ jsxs12("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
|
|
3652
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
|
|
3653
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3654
|
+
/* @__PURE__ */ jsx22(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
|
|
3655
|
+
/* @__PURE__ */ jsx22("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
|
|
3323
3656
|
] }),
|
|
3324
|
-
/* @__PURE__ */
|
|
3657
|
+
/* @__PURE__ */ jsxs12(
|
|
3325
3658
|
Button,
|
|
3326
3659
|
{
|
|
3327
3660
|
type: "button",
|
|
@@ -3331,14 +3664,14 @@ var VoiceComposer = ({
|
|
|
3331
3664
|
onClick: onExit,
|
|
3332
3665
|
disabled: disabled || isBusy,
|
|
3333
3666
|
children: [
|
|
3334
|
-
/* @__PURE__ */
|
|
3335
|
-
/* @__PURE__ */
|
|
3667
|
+
/* @__PURE__ */ jsx22(Keyboard, { className: "h-4 w-4" }),
|
|
3668
|
+
/* @__PURE__ */ jsx22("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
|
|
3336
3669
|
]
|
|
3337
3670
|
}
|
|
3338
3671
|
)
|
|
3339
3672
|
] }),
|
|
3340
|
-
!isDraftLayout ? /* @__PURE__ */
|
|
3341
|
-
/* @__PURE__ */
|
|
3673
|
+
!isDraftLayout ? /* @__PURE__ */ jsx22("div", { className: "mt-3 rounded-xl border border-dashed border-primary/30 bg-primary/5 px-3 py-3 text-center sm:px-4 sm:py-4", children: /* @__PURE__ */ jsxs12("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
|
|
3674
|
+
/* @__PURE__ */ jsx22(
|
|
3342
3675
|
Button,
|
|
3343
3676
|
{
|
|
3344
3677
|
type: "button",
|
|
@@ -3347,21 +3680,21 @@ var VoiceComposer = ({
|
|
|
3347
3680
|
className: `h-16 w-16 rounded-full sm:h-20 sm:w-20 ${isCapturing ? "bg-red-500 hover:bg-red-600 text-white border-red-500" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
|
|
3348
3681
|
onClick: isCapturing ? onStop : onStart,
|
|
3349
3682
|
disabled: disabled || isBusy,
|
|
3350
|
-
children: isBusy ? /* @__PURE__ */
|
|
3683
|
+
children: isBusy ? /* @__PURE__ */ jsx22(Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ jsx22(Square, { className: "h-7 w-7" }) : /* @__PURE__ */ jsx22(Mic, { className: "h-7 w-7" })
|
|
3351
3684
|
}
|
|
3352
3685
|
),
|
|
3353
|
-
/* @__PURE__ */
|
|
3354
|
-
/* @__PURE__ */
|
|
3355
|
-
/* @__PURE__ */
|
|
3356
|
-
/* @__PURE__ */
|
|
3357
|
-
/* @__PURE__ */
|
|
3686
|
+
/* @__PURE__ */ jsxs12("div", { className: "w-full space-y-2", children: [
|
|
3687
|
+
/* @__PURE__ */ jsx22(Progress, { value: levelValue, className: "h-2" }),
|
|
3688
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
3689
|
+
/* @__PURE__ */ jsx22("span", { children: formatDuration(durationMs) }),
|
|
3690
|
+
/* @__PURE__ */ jsx22("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
|
|
3358
3691
|
] })
|
|
3359
3692
|
] }),
|
|
3360
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3361
|
-
] }) }) : /* @__PURE__ */
|
|
3362
|
-
/* @__PURE__ */
|
|
3363
|
-
/* @__PURE__ */
|
|
3364
|
-
/* @__PURE__ */
|
|
3693
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx22("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
|
|
3694
|
+
] }) }) : /* @__PURE__ */ jsxs12("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
|
|
3695
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
|
|
3696
|
+
/* @__PURE__ */ jsx22("span", { children: formatDuration(durationMs) }),
|
|
3697
|
+
/* @__PURE__ */ jsx22(
|
|
3365
3698
|
Button,
|
|
3366
3699
|
{
|
|
3367
3700
|
type: "button",
|
|
@@ -3372,12 +3705,12 @@ var VoiceComposer = ({
|
|
|
3372
3705
|
disabled,
|
|
3373
3706
|
"aria-label": labels?.voiceDiscard || "Delete recording",
|
|
3374
3707
|
title: labels?.voiceDiscard || "Delete recording",
|
|
3375
|
-
children: /* @__PURE__ */
|
|
3708
|
+
children: /* @__PURE__ */ jsx22(Trash23, { className: "h-4 w-4" })
|
|
3376
3709
|
}
|
|
3377
3710
|
)
|
|
3378
3711
|
] }),
|
|
3379
|
-
/* @__PURE__ */
|
|
3380
|
-
/* @__PURE__ */
|
|
3712
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
|
|
3713
|
+
/* @__PURE__ */ jsx22(
|
|
3381
3714
|
Button,
|
|
3382
3715
|
{
|
|
3383
3716
|
type: "button",
|
|
@@ -3386,12 +3719,12 @@ var VoiceComposer = ({
|
|
|
3386
3719
|
className: `h-20 w-20 rounded-full sm:h-24 sm:w-24 ${orbIsListening ? "border-red-500 bg-red-500 text-white hover:bg-red-600" : isArmedDraft ? "border-red-200 bg-red-50 text-red-600 shadow-[0_0_0_10px_rgba(239,68,68,0.08)] hover:bg-red-100 hover:text-red-700" : "border-red-200 bg-red-50 text-red-600 hover:bg-red-100 hover:text-red-700"}`,
|
|
3387
3720
|
onClick: handleReviewOrbClick,
|
|
3388
3721
|
disabled: disabled || orbIsReviewBusy,
|
|
3389
|
-
children: orbIsReviewBusy ? /* @__PURE__ */
|
|
3722
|
+
children: orbIsReviewBusy ? /* @__PURE__ */ jsx22(Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ jsx22(Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ jsx22(Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ jsx22(Mic, { className: "h-7 w-7" })
|
|
3390
3723
|
}
|
|
3391
3724
|
),
|
|
3392
|
-
/* @__PURE__ */
|
|
3393
|
-
/* @__PURE__ */
|
|
3394
|
-
isCapturing && /* @__PURE__ */
|
|
3725
|
+
/* @__PURE__ */ jsxs12("div", { className: "max-w-sm space-y-1 px-2", children: [
|
|
3726
|
+
/* @__PURE__ */ jsx22("p", { className: "text-sm text-foreground", children: reviewHelperText }),
|
|
3727
|
+
isCapturing && /* @__PURE__ */ jsx22("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx22(
|
|
3395
3728
|
"div",
|
|
3396
3729
|
{
|
|
3397
3730
|
className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
|
|
@@ -3400,21 +3733,21 @@ var VoiceComposer = ({
|
|
|
3400
3733
|
) })
|
|
3401
3734
|
] })
|
|
3402
3735
|
] }),
|
|
3403
|
-
attachment && /* @__PURE__ */
|
|
3404
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3405
|
-
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */
|
|
3406
|
-
/* @__PURE__ */
|
|
3407
|
-
isAutoSendActive && /* @__PURE__ */
|
|
3408
|
-
/* @__PURE__ */
|
|
3736
|
+
attachment && /* @__PURE__ */ jsx22("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ jsx22("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ jsx22("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
|
|
3737
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx22("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
|
|
3738
|
+
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ jsx22("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ jsx22("div", { className: "inline-flex items-center rounded-full border bg-background px-3 py-1 text-xs text-muted-foreground", children: interpolateSeconds(labels?.voiceAutoSendIn, countdownSeconds) }) }),
|
|
3739
|
+
/* @__PURE__ */ jsxs12("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
|
|
3740
|
+
isAutoSendActive && /* @__PURE__ */ jsxs12(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
|
|
3741
|
+
/* @__PURE__ */ jsx22(X3, { className: "h-4 w-4" }),
|
|
3409
3742
|
labels?.voiceCancel || "Cancel"
|
|
3410
3743
|
] }),
|
|
3411
|
-
/* @__PURE__ */
|
|
3412
|
-
/* @__PURE__ */
|
|
3744
|
+
/* @__PURE__ */ jsxs12(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
|
|
3745
|
+
/* @__PURE__ */ jsx22(Send, { className: "h-4 w-4" }),
|
|
3413
3746
|
labels?.voiceSendNow || "Send now"
|
|
3414
3747
|
] })
|
|
3415
3748
|
] })
|
|
3416
3749
|
] }),
|
|
3417
|
-
errorMessage && /* @__PURE__ */
|
|
3750
|
+
errorMessage && /* @__PURE__ */ jsx22("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
|
|
3418
3751
|
] });
|
|
3419
3752
|
};
|
|
3420
3753
|
|
|
@@ -3426,14 +3759,14 @@ import {
|
|
|
3426
3759
|
Image as Image2,
|
|
3427
3760
|
Video,
|
|
3428
3761
|
FileText,
|
|
3429
|
-
X as
|
|
3762
|
+
X as X4,
|
|
3430
3763
|
Square as Square2,
|
|
3431
3764
|
Play,
|
|
3432
3765
|
Pause,
|
|
3433
3766
|
Loader2 as Loader22
|
|
3434
3767
|
} from "lucide-react";
|
|
3435
|
-
import { Fragment as
|
|
3436
|
-
var FileUploadItem =
|
|
3768
|
+
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3769
|
+
var FileUploadItem = memo3(function FileUploadItem2({ file, progress, onCancel }) {
|
|
3437
3770
|
const guessTypeFromName = (name) => {
|
|
3438
3771
|
const ext = (name || "").split(".").pop()?.toLowerCase();
|
|
3439
3772
|
switch (ext) {
|
|
@@ -3461,10 +3794,10 @@ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3461
3794
|
};
|
|
3462
3795
|
const getFileIcon = (type, name) => {
|
|
3463
3796
|
const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
|
|
3464
|
-
if (t.startsWith("image/")) return /* @__PURE__ */
|
|
3465
|
-
if (t.startsWith("video/")) return /* @__PURE__ */
|
|
3466
|
-
if (t.startsWith("audio/")) return /* @__PURE__ */
|
|
3467
|
-
return /* @__PURE__ */
|
|
3797
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ jsx23(Image2, { className: "h-4 w-4" });
|
|
3798
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ jsx23(Video, { className: "h-4 w-4" });
|
|
3799
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ jsx23(Mic2, { className: "h-4 w-4" });
|
|
3800
|
+
return /* @__PURE__ */ jsx23(FileText, { className: "h-4 w-4" });
|
|
3468
3801
|
};
|
|
3469
3802
|
const formatFileSize = (bytes) => {
|
|
3470
3803
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -3473,26 +3806,26 @@ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3473
3806
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
3474
3807
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3475
3808
|
};
|
|
3476
|
-
return /* @__PURE__ */
|
|
3809
|
+
return /* @__PURE__ */ jsx23(Card, { className: "relative", children: /* @__PURE__ */ jsx23(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
|
|
3477
3810
|
getFileIcon(file.type, file.name),
|
|
3478
|
-
/* @__PURE__ */
|
|
3479
|
-
/* @__PURE__ */
|
|
3480
|
-
/* @__PURE__ */
|
|
3481
|
-
/* @__PURE__ */
|
|
3811
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3812
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3813
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
3814
|
+
/* @__PURE__ */ jsx23(Progress, { value: progress, className: "h-1 mt-1" })
|
|
3482
3815
|
] }),
|
|
3483
|
-
/* @__PURE__ */
|
|
3816
|
+
/* @__PURE__ */ jsx23(
|
|
3484
3817
|
Button,
|
|
3485
3818
|
{
|
|
3486
3819
|
variant: "ghost",
|
|
3487
3820
|
size: "icon",
|
|
3488
3821
|
className: "h-6 w-6",
|
|
3489
3822
|
onClick: onCancel,
|
|
3490
|
-
children: /* @__PURE__ */
|
|
3823
|
+
children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
|
|
3491
3824
|
}
|
|
3492
3825
|
)
|
|
3493
3826
|
] }) }) });
|
|
3494
3827
|
});
|
|
3495
|
-
var AttachmentPreview =
|
|
3828
|
+
var AttachmentPreview = memo3(function AttachmentPreview2({ attachment, onRemove }) {
|
|
3496
3829
|
const [isPlaying, setIsPlaying] = useState6(false);
|
|
3497
3830
|
const [audioPlaybackSrc, setAudioPlaybackSrc] = useState6(attachment.dataUrl);
|
|
3498
3831
|
const audioRef = useRef5(null);
|
|
@@ -3527,9 +3860,9 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
3527
3860
|
const minutes = Math.floor(seconds / 60);
|
|
3528
3861
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
3529
3862
|
};
|
|
3530
|
-
return /* @__PURE__ */
|
|
3531
|
-
attachment.kind === "image" && /* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3863
|
+
return /* @__PURE__ */ jsx23(Card, { className: "relative group", children: /* @__PURE__ */ jsxs13(CardContent, { className: "p-2", children: [
|
|
3864
|
+
attachment.kind === "image" && /* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
3865
|
+
/* @__PURE__ */ jsx23(
|
|
3533
3866
|
"img",
|
|
3534
3867
|
{
|
|
3535
3868
|
src: attachment.dataUrl,
|
|
@@ -3537,19 +3870,19 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
3537
3870
|
className: "w-full h-20 object-cover rounded"
|
|
3538
3871
|
}
|
|
3539
3872
|
),
|
|
3540
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsx23("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx23(
|
|
3541
3874
|
Button,
|
|
3542
3875
|
{
|
|
3543
3876
|
variant: "destructive",
|
|
3544
3877
|
size: "icon",
|
|
3545
3878
|
className: "h-6 w-6",
|
|
3546
3879
|
onClick: onRemove,
|
|
3547
|
-
children: /* @__PURE__ */
|
|
3880
|
+
children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
|
|
3548
3881
|
}
|
|
3549
3882
|
) })
|
|
3550
3883
|
] }),
|
|
3551
|
-
attachment.kind === "video" && /* @__PURE__ */
|
|
3552
|
-
/* @__PURE__ */
|
|
3884
|
+
attachment.kind === "video" && /* @__PURE__ */ jsxs13("div", { className: "relative", children: [
|
|
3885
|
+
/* @__PURE__ */ jsx23(
|
|
3553
3886
|
"video",
|
|
3554
3887
|
{
|
|
3555
3888
|
src: attachment.dataUrl,
|
|
@@ -3558,34 +3891,34 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
3558
3891
|
muted: true
|
|
3559
3892
|
}
|
|
3560
3893
|
),
|
|
3561
|
-
/* @__PURE__ */
|
|
3894
|
+
/* @__PURE__ */ jsx23("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx23(
|
|
3562
3895
|
Button,
|
|
3563
3896
|
{
|
|
3564
3897
|
variant: "destructive",
|
|
3565
3898
|
size: "icon",
|
|
3566
3899
|
className: "h-6 w-6",
|
|
3567
3900
|
onClick: onRemove,
|
|
3568
|
-
children: /* @__PURE__ */
|
|
3901
|
+
children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
|
|
3569
3902
|
}
|
|
3570
3903
|
) }),
|
|
3571
|
-
/* @__PURE__ */
|
|
3904
|
+
/* @__PURE__ */ jsx23(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
|
|
3572
3905
|
] }),
|
|
3573
|
-
attachment.kind === "audio" && /* @__PURE__ */
|
|
3574
|
-
/* @__PURE__ */
|
|
3906
|
+
attachment.kind === "audio" && /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 p-2", children: [
|
|
3907
|
+
/* @__PURE__ */ jsx23(
|
|
3575
3908
|
Button,
|
|
3576
3909
|
{
|
|
3577
3910
|
variant: "outline",
|
|
3578
3911
|
size: "icon",
|
|
3579
3912
|
className: "h-8 w-8",
|
|
3580
3913
|
onClick: handlePlayPause,
|
|
3581
|
-
children: isPlaying ? /* @__PURE__ */
|
|
3914
|
+
children: isPlaying ? /* @__PURE__ */ jsx23(Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx23(Play, { className: "h-3 w-3" })
|
|
3582
3915
|
}
|
|
3583
3916
|
),
|
|
3584
|
-
/* @__PURE__ */
|
|
3585
|
-
/* @__PURE__ */
|
|
3586
|
-
/* @__PURE__ */
|
|
3917
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1", children: [
|
|
3918
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
|
|
3919
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
|
|
3587
3920
|
] }),
|
|
3588
|
-
/* @__PURE__ */
|
|
3921
|
+
/* @__PURE__ */ jsx23(
|
|
3589
3922
|
"audio",
|
|
3590
3923
|
{
|
|
3591
3924
|
ref: audioRef,
|
|
@@ -3593,71 +3926,71 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
3593
3926
|
onPause: () => setIsPlaying(false),
|
|
3594
3927
|
onEnded: () => setIsPlaying(false),
|
|
3595
3928
|
preload: "metadata",
|
|
3596
|
-
children: /* @__PURE__ */
|
|
3929
|
+
children: /* @__PURE__ */ jsx23("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
3597
3930
|
}
|
|
3598
3931
|
),
|
|
3599
|
-
/* @__PURE__ */
|
|
3932
|
+
/* @__PURE__ */ jsx23(
|
|
3600
3933
|
Button,
|
|
3601
3934
|
{
|
|
3602
3935
|
variant: "ghost",
|
|
3603
3936
|
size: "icon",
|
|
3604
3937
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3605
3938
|
onClick: onRemove,
|
|
3606
|
-
children: /* @__PURE__ */
|
|
3939
|
+
children: /* @__PURE__ */ jsx23(X4, { className: "h-3 w-3" })
|
|
3607
3940
|
}
|
|
3608
3941
|
)
|
|
3609
3942
|
] }),
|
|
3610
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */
|
|
3943
|
+
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx23("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx23("p", { className: "truncate", children: attachment.fileName }) })
|
|
3611
3944
|
] }) });
|
|
3612
3945
|
});
|
|
3613
|
-
var AudioRecorder =
|
|
3946
|
+
var AudioRecorder = memo3(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
|
|
3614
3947
|
const formatTime = (seconds) => {
|
|
3615
3948
|
const mins = Math.floor(seconds / 60);
|
|
3616
3949
|
const secs = seconds % 60;
|
|
3617
3950
|
return `${mins}:${secs.toString().padStart(2, "0")}`;
|
|
3618
3951
|
};
|
|
3619
3952
|
if (!isRecording) {
|
|
3620
|
-
return /* @__PURE__ */
|
|
3621
|
-
/* @__PURE__ */
|
|
3953
|
+
return /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
3954
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
3622
3955
|
Button,
|
|
3623
3956
|
{
|
|
3624
3957
|
variant: "outline",
|
|
3625
3958
|
size: "icon",
|
|
3626
3959
|
onClick: onStartRecording,
|
|
3627
3960
|
className: "h-10 w-10",
|
|
3628
|
-
children: /* @__PURE__ */
|
|
3961
|
+
children: /* @__PURE__ */ jsx23(Mic2, { className: "h-4 w-4" })
|
|
3629
3962
|
}
|
|
3630
3963
|
) }),
|
|
3631
|
-
/* @__PURE__ */
|
|
3964
|
+
/* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.recordAudioTooltip })
|
|
3632
3965
|
] });
|
|
3633
3966
|
}
|
|
3634
|
-
return /* @__PURE__ */
|
|
3635
|
-
/* @__PURE__ */
|
|
3636
|
-
/* @__PURE__ */
|
|
3637
|
-
/* @__PURE__ */
|
|
3967
|
+
return /* @__PURE__ */ jsx23(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ jsx23(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-3", children: [
|
|
3968
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3969
|
+
/* @__PURE__ */ jsx23("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
|
|
3970
|
+
/* @__PURE__ */ jsx23("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: config?.labels?.voiceListening || "Recording" })
|
|
3638
3971
|
] }),
|
|
3639
|
-
/* @__PURE__ */
|
|
3640
|
-
/* @__PURE__ */
|
|
3641
|
-
/* @__PURE__ */
|
|
3972
|
+
/* @__PURE__ */ jsx23(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
|
|
3973
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex gap-1 ml-auto", children: [
|
|
3974
|
+
/* @__PURE__ */ jsxs13(
|
|
3642
3975
|
Button,
|
|
3643
3976
|
{
|
|
3644
3977
|
variant: "outline",
|
|
3645
3978
|
size: "sm",
|
|
3646
3979
|
onClick: onCancel,
|
|
3647
3980
|
children: [
|
|
3648
|
-
/* @__PURE__ */
|
|
3981
|
+
/* @__PURE__ */ jsx23(X4, { className: "h-3 w-3 mr-1" }),
|
|
3649
3982
|
config?.labels?.cancel || "Cancel"
|
|
3650
3983
|
]
|
|
3651
3984
|
}
|
|
3652
3985
|
),
|
|
3653
|
-
/* @__PURE__ */
|
|
3986
|
+
/* @__PURE__ */ jsxs13(
|
|
3654
3987
|
Button,
|
|
3655
3988
|
{
|
|
3656
3989
|
variant: "default",
|
|
3657
3990
|
size: "sm",
|
|
3658
3991
|
onClick: onStopRecording,
|
|
3659
3992
|
children: [
|
|
3660
|
-
/* @__PURE__ */
|
|
3993
|
+
/* @__PURE__ */ jsx23(Square2, { className: "h-3 w-3 mr-1" }),
|
|
3661
3994
|
config?.labels?.voiceStop || "Stop"
|
|
3662
3995
|
]
|
|
3663
3996
|
}
|
|
@@ -3676,7 +4009,7 @@ var resolveVoiceErrorMessage = (error, config) => {
|
|
|
3676
4009
|
};
|
|
3677
4010
|
var clearVoiceTranscript = () => ({});
|
|
3678
4011
|
var resolveVoiceSegmentDuration = (segment) => segment.attachment.durationMs ?? 0;
|
|
3679
|
-
var ChatInput =
|
|
4012
|
+
var ChatInput = memo3(function ChatInput2({
|
|
3680
4013
|
value,
|
|
3681
4014
|
onChange,
|
|
3682
4015
|
onSubmit,
|
|
@@ -4204,8 +4537,8 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4204
4537
|
};
|
|
4205
4538
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
4206
4539
|
const showVoiceComposer = voiceComposeEnabled && isVoiceComposerOpen;
|
|
4207
|
-
return /* @__PURE__ */
|
|
4208
|
-
uploadProgress.size > 0 && /* @__PURE__ */
|
|
4540
|
+
return /* @__PURE__ */ jsx23(TooltipProvider, { children: /* @__PURE__ */ jsx23("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs13("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
|
|
4541
|
+
uploadProgress.size > 0 && /* @__PURE__ */ jsx23("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx23(
|
|
4209
4542
|
FileUploadItem,
|
|
4210
4543
|
{
|
|
4211
4544
|
file: { name: progress.fileName },
|
|
@@ -4220,7 +4553,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4220
4553
|
},
|
|
4221
4554
|
id
|
|
4222
4555
|
)) }),
|
|
4223
|
-
isRecording && /* @__PURE__ */
|
|
4556
|
+
isRecording && /* @__PURE__ */ jsx23(
|
|
4224
4557
|
AudioRecorder,
|
|
4225
4558
|
{
|
|
4226
4559
|
isRecording,
|
|
@@ -4231,7 +4564,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4231
4564
|
config
|
|
4232
4565
|
}
|
|
4233
4566
|
),
|
|
4234
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4567
|
+
attachments.length > 0 && /* @__PURE__ */ jsx23("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx23(
|
|
4235
4568
|
AttachmentPreview,
|
|
4236
4569
|
{
|
|
4237
4570
|
attachment,
|
|
@@ -4239,7 +4572,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4239
4572
|
},
|
|
4240
4573
|
index
|
|
4241
4574
|
)) }),
|
|
4242
|
-
showVoiceComposer ? /* @__PURE__ */
|
|
4575
|
+
showVoiceComposer ? /* @__PURE__ */ jsx23("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsx23(
|
|
4243
4576
|
VoiceComposer,
|
|
4244
4577
|
{
|
|
4245
4578
|
state: voiceState,
|
|
@@ -4279,15 +4612,15 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4279
4612
|
void closeVoiceComposer();
|
|
4280
4613
|
}
|
|
4281
4614
|
}
|
|
4282
|
-
) }) : /* @__PURE__ */
|
|
4615
|
+
) }) : /* @__PURE__ */ jsx23("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs13(
|
|
4283
4616
|
"div",
|
|
4284
4617
|
{
|
|
4285
4618
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
4286
4619
|
onDrop: handleDrop,
|
|
4287
4620
|
onDragOver: handleDragOver,
|
|
4288
4621
|
children: [
|
|
4289
|
-
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */
|
|
4290
|
-
/* @__PURE__ */
|
|
4622
|
+
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
4623
|
+
/* @__PURE__ */ jsx23(
|
|
4291
4624
|
"input",
|
|
4292
4625
|
{
|
|
4293
4626
|
ref: fileInputRef,
|
|
@@ -4298,8 +4631,8 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4298
4631
|
className: "hidden"
|
|
4299
4632
|
}
|
|
4300
4633
|
),
|
|
4301
|
-
/* @__PURE__ */
|
|
4302
|
-
/* @__PURE__ */
|
|
4634
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
4635
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
4303
4636
|
Button,
|
|
4304
4637
|
{
|
|
4305
4638
|
type: "button",
|
|
@@ -4312,13 +4645,13 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4312
4645
|
fileInputRef.current?.click();
|
|
4313
4646
|
},
|
|
4314
4647
|
disabled,
|
|
4315
|
-
children: /* @__PURE__ */
|
|
4648
|
+
children: /* @__PURE__ */ jsx23(Paperclip, { className: "h-4 w-4" })
|
|
4316
4649
|
}
|
|
4317
4650
|
) }),
|
|
4318
|
-
/* @__PURE__ */
|
|
4651
|
+
/* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
4319
4652
|
] })
|
|
4320
4653
|
] }),
|
|
4321
|
-
/* @__PURE__ */
|
|
4654
|
+
/* @__PURE__ */ jsx23("div", { className: "flex-1", children: /* @__PURE__ */ jsx23(
|
|
4322
4655
|
Textarea,
|
|
4323
4656
|
{
|
|
4324
4657
|
ref: textareaRef,
|
|
@@ -4331,8 +4664,8 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4331
4664
|
rows: 1
|
|
4332
4665
|
}
|
|
4333
4666
|
) }),
|
|
4334
|
-
enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && (voiceComposeEnabled ? /* @__PURE__ */
|
|
4335
|
-
/* @__PURE__ */
|
|
4667
|
+
enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && (voiceComposeEnabled ? /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
4668
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
4336
4669
|
Button,
|
|
4337
4670
|
{
|
|
4338
4671
|
type: "button",
|
|
@@ -4343,11 +4676,11 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4343
4676
|
void startVoiceCapture();
|
|
4344
4677
|
},
|
|
4345
4678
|
disabled: disabled || isGenerating,
|
|
4346
|
-
children: /* @__PURE__ */
|
|
4679
|
+
children: /* @__PURE__ */ jsx23(Mic2, { className: "h-4 w-4" })
|
|
4347
4680
|
}
|
|
4348
4681
|
) }),
|
|
4349
|
-
/* @__PURE__ */
|
|
4350
|
-
] }) : /* @__PURE__ */
|
|
4682
|
+
/* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.voiceEnter || config?.labels?.recordAudioTooltip })
|
|
4683
|
+
] }) : /* @__PURE__ */ jsx23(
|
|
4351
4684
|
AudioRecorder,
|
|
4352
4685
|
{
|
|
4353
4686
|
isRecording,
|
|
@@ -4358,8 +4691,8 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4358
4691
|
config
|
|
4359
4692
|
}
|
|
4360
4693
|
)),
|
|
4361
|
-
isGenerating ? /* @__PURE__ */
|
|
4362
|
-
/* @__PURE__ */
|
|
4694
|
+
isGenerating ? /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
4695
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
4363
4696
|
Button,
|
|
4364
4697
|
{
|
|
4365
4698
|
type: "button",
|
|
@@ -4367,36 +4700,36 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4367
4700
|
size: "icon",
|
|
4368
4701
|
className: "h-10 w-10",
|
|
4369
4702
|
onClick: onStopGeneration,
|
|
4370
|
-
children: /* @__PURE__ */
|
|
4703
|
+
children: /* @__PURE__ */ jsx23(Square2, { className: "h-4 w-4" })
|
|
4371
4704
|
}
|
|
4372
4705
|
) }),
|
|
4373
|
-
/* @__PURE__ */
|
|
4374
|
-
] }) : /* @__PURE__ */
|
|
4375
|
-
/* @__PURE__ */
|
|
4706
|
+
/* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
4707
|
+
] }) : /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
4708
|
+
/* @__PURE__ */ jsx23(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx23(
|
|
4376
4709
|
Button,
|
|
4377
4710
|
{
|
|
4378
4711
|
type: "submit",
|
|
4379
4712
|
size: "icon",
|
|
4380
4713
|
className: "h-10 w-10",
|
|
4381
4714
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
4382
|
-
children: disabled ? /* @__PURE__ */
|
|
4715
|
+
children: disabled ? /* @__PURE__ */ jsx23(Loader22, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx23(Send2, { className: "h-4 w-4" })
|
|
4383
4716
|
}
|
|
4384
4717
|
) }),
|
|
4385
|
-
/* @__PURE__ */
|
|
4718
|
+
/* @__PURE__ */ jsx23(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
4386
4719
|
] })
|
|
4387
4720
|
]
|
|
4388
4721
|
}
|
|
4389
4722
|
) }),
|
|
4390
|
-
/* @__PURE__ */
|
|
4723
|
+
/* @__PURE__ */ jsxs13("div", { className: "text-[10px] text-muted-foreground text-center", children: [
|
|
4391
4724
|
window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
|
|
4392
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4725
|
+
attachments.length > 0 && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
4393
4726
|
" \u2022 ",
|
|
4394
4727
|
attachments.length,
|
|
4395
4728
|
"/",
|
|
4396
4729
|
maxAttachments,
|
|
4397
4730
|
" anexos"
|
|
4398
4731
|
] }),
|
|
4399
|
-
config?.labels?.footerLabel && /* @__PURE__ */
|
|
4732
|
+
config?.labels?.footerLabel && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
4400
4733
|
" \u2022 ",
|
|
4401
4734
|
config.labels.footerLabel
|
|
4402
4735
|
] })
|
|
@@ -4408,18 +4741,18 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
4408
4741
|
import { useState as useState7 } from "react";
|
|
4409
4742
|
|
|
4410
4743
|
// src/components/ui/scroll-area.tsx
|
|
4411
|
-
import * as
|
|
4744
|
+
import * as React12 from "react";
|
|
4412
4745
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4413
|
-
import { jsx as
|
|
4414
|
-
var ScrollArea =
|
|
4415
|
-
return /* @__PURE__ */
|
|
4746
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
4747
|
+
var ScrollArea = React12.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4748
|
+
return /* @__PURE__ */ jsxs14(
|
|
4416
4749
|
ScrollAreaPrimitive.Root,
|
|
4417
4750
|
{
|
|
4418
4751
|
"data-slot": "scroll-area",
|
|
4419
4752
|
className: cn("relative", className),
|
|
4420
4753
|
...props,
|
|
4421
4754
|
children: [
|
|
4422
|
-
/* @__PURE__ */
|
|
4755
|
+
/* @__PURE__ */ jsx24(
|
|
4423
4756
|
ScrollAreaPrimitive.Viewport,
|
|
4424
4757
|
{
|
|
4425
4758
|
ref,
|
|
@@ -4433,8 +4766,8 @@ var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, o
|
|
|
4433
4766
|
children
|
|
4434
4767
|
}
|
|
4435
4768
|
),
|
|
4436
|
-
/* @__PURE__ */
|
|
4437
|
-
/* @__PURE__ */
|
|
4769
|
+
/* @__PURE__ */ jsx24(ScrollBar, {}),
|
|
4770
|
+
/* @__PURE__ */ jsx24(ScrollAreaPrimitive.Corner, {})
|
|
4438
4771
|
]
|
|
4439
4772
|
}
|
|
4440
4773
|
);
|
|
@@ -4445,7 +4778,7 @@ function ScrollBar({
|
|
|
4445
4778
|
orientation = "vertical",
|
|
4446
4779
|
...props
|
|
4447
4780
|
}) {
|
|
4448
|
-
return /* @__PURE__ */
|
|
4781
|
+
return /* @__PURE__ */ jsx24(
|
|
4449
4782
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4450
4783
|
{
|
|
4451
4784
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -4457,7 +4790,7 @@ function ScrollBar({
|
|
|
4457
4790
|
className
|
|
4458
4791
|
),
|
|
4459
4792
|
...props,
|
|
4460
|
-
children: /* @__PURE__ */
|
|
4793
|
+
children: /* @__PURE__ */ jsx24(
|
|
4461
4794
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4462
4795
|
{
|
|
4463
4796
|
"data-slot": "scroll-area-thumb",
|
|
@@ -4472,14 +4805,14 @@ function ScrollBar({
|
|
|
4472
4805
|
import {
|
|
4473
4806
|
User as User2,
|
|
4474
4807
|
Mail,
|
|
4475
|
-
AtSign,
|
|
4808
|
+
AtSign as AtSign2,
|
|
4476
4809
|
Calendar,
|
|
4477
4810
|
MapPin,
|
|
4478
4811
|
Phone,
|
|
4479
4812
|
Globe,
|
|
4480
4813
|
Building,
|
|
4481
4814
|
Briefcase,
|
|
4482
|
-
Users,
|
|
4815
|
+
Users as Users2,
|
|
4483
4816
|
UserPlus,
|
|
4484
4817
|
Image as Image3,
|
|
4485
4818
|
BadgeCheck,
|
|
@@ -4493,10 +4826,10 @@ import {
|
|
|
4493
4826
|
Heart,
|
|
4494
4827
|
Bot as Bot3,
|
|
4495
4828
|
Pencil,
|
|
4496
|
-
Check as
|
|
4497
|
-
X as
|
|
4829
|
+
Check as Check4,
|
|
4830
|
+
X as X5
|
|
4498
4831
|
} from "lucide-react";
|
|
4499
|
-
import { Fragment as
|
|
4832
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4500
4833
|
var getInitials2 = (name, email) => {
|
|
4501
4834
|
if (name) {
|
|
4502
4835
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -4510,29 +4843,29 @@ var getFieldIcon = (type, key) => {
|
|
|
4510
4843
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4511
4844
|
switch (type) {
|
|
4512
4845
|
case "email":
|
|
4513
|
-
return /* @__PURE__ */
|
|
4846
|
+
return /* @__PURE__ */ jsx25(Mail, { className: iconClass });
|
|
4514
4847
|
case "phone":
|
|
4515
|
-
return /* @__PURE__ */
|
|
4848
|
+
return /* @__PURE__ */ jsx25(Phone, { className: iconClass });
|
|
4516
4849
|
case "url":
|
|
4517
|
-
return /* @__PURE__ */
|
|
4850
|
+
return /* @__PURE__ */ jsx25(Globe, { className: iconClass });
|
|
4518
4851
|
case "date":
|
|
4519
|
-
return /* @__PURE__ */
|
|
4852
|
+
return /* @__PURE__ */ jsx25(Calendar, { className: iconClass });
|
|
4520
4853
|
}
|
|
4521
4854
|
const lowerKey = key?.toLowerCase() || "";
|
|
4522
|
-
if (lowerKey.includes("follower")) return /* @__PURE__ */
|
|
4523
|
-
if (lowerKey.includes("following")) return /* @__PURE__ */
|
|
4524
|
-
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */
|
|
4525
|
-
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */
|
|
4526
|
-
if (lowerKey.includes("bio")) return /* @__PURE__ */
|
|
4527
|
-
if (lowerKey.includes("email")) return /* @__PURE__ */
|
|
4528
|
-
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */
|
|
4529
|
-
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */
|
|
4530
|
-
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */
|
|
4531
|
-
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */
|
|
4532
|
-
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */
|
|
4533
|
-
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */
|
|
4534
|
-
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */
|
|
4535
|
-
return /* @__PURE__ */
|
|
4855
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx25(Users2, { className: iconClass });
|
|
4856
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ jsx25(UserPlus, { className: iconClass });
|
|
4857
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx25(Image3, { className: iconClass });
|
|
4858
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx25(BadgeCheck, { className: iconClass });
|
|
4859
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx25(FileText2, { className: iconClass });
|
|
4860
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ jsx25(Mail, { className: iconClass });
|
|
4861
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx25(Phone, { className: iconClass });
|
|
4862
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx25(MapPin, { className: iconClass });
|
|
4863
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx25(Building, { className: iconClass });
|
|
4864
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx25(Briefcase, { className: iconClass });
|
|
4865
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx25(Globe, { className: iconClass });
|
|
4866
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx25(AtSign2, { className: iconClass });
|
|
4867
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx25(Calendar, { className: iconClass });
|
|
4868
|
+
return /* @__PURE__ */ jsx25(User2, { className: iconClass });
|
|
4536
4869
|
};
|
|
4537
4870
|
var formatValue = (value, type, key) => {
|
|
4538
4871
|
if (value === null || value === void 0) return "-";
|
|
@@ -4566,15 +4899,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
4566
4899
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4567
4900
|
switch (category) {
|
|
4568
4901
|
case "preference":
|
|
4569
|
-
return /* @__PURE__ */
|
|
4902
|
+
return /* @__PURE__ */ jsx25(Heart, { className: iconClass });
|
|
4570
4903
|
case "fact":
|
|
4571
|
-
return /* @__PURE__ */
|
|
4904
|
+
return /* @__PURE__ */ jsx25(Info, { className: iconClass });
|
|
4572
4905
|
case "goal":
|
|
4573
|
-
return /* @__PURE__ */
|
|
4906
|
+
return /* @__PURE__ */ jsx25(Target, { className: iconClass });
|
|
4574
4907
|
case "context":
|
|
4575
|
-
return /* @__PURE__ */
|
|
4908
|
+
return /* @__PURE__ */ jsx25(Lightbulb, { className: iconClass });
|
|
4576
4909
|
default:
|
|
4577
|
-
return /* @__PURE__ */
|
|
4910
|
+
return /* @__PURE__ */ jsx25(Brain2, { className: iconClass });
|
|
4578
4911
|
}
|
|
4579
4912
|
};
|
|
4580
4913
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -4644,66 +4977,66 @@ var UserProfile = ({
|
|
|
4644
4977
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
4645
4978
|
const initials = getInitials2(user?.name, user?.email);
|
|
4646
4979
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
4647
|
-
return /* @__PURE__ */
|
|
4980
|
+
return /* @__PURE__ */ jsx25(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs15(
|
|
4648
4981
|
SheetContent,
|
|
4649
4982
|
{
|
|
4650
4983
|
side: "right",
|
|
4651
4984
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
4652
4985
|
children: [
|
|
4653
|
-
/* @__PURE__ */
|
|
4654
|
-
/* @__PURE__ */
|
|
4655
|
-
/* @__PURE__ */
|
|
4656
|
-
/* @__PURE__ */
|
|
4657
|
-
user?.avatar && /* @__PURE__ */
|
|
4658
|
-
/* @__PURE__ */
|
|
4986
|
+
/* @__PURE__ */ jsx25(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx25("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx25(SheetTitle, { children: labels.title }) }) }),
|
|
4987
|
+
/* @__PURE__ */ jsx25(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs15("div", { className: "p-6 space-y-6", children: [
|
|
4988
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
4989
|
+
/* @__PURE__ */ jsxs15(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
4990
|
+
user?.avatar && /* @__PURE__ */ jsx25(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
4991
|
+
/* @__PURE__ */ jsx25(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
4659
4992
|
] }),
|
|
4660
|
-
/* @__PURE__ */
|
|
4661
|
-
/* @__PURE__ */
|
|
4662
|
-
user?.email && /* @__PURE__ */
|
|
4993
|
+
/* @__PURE__ */ jsxs15("div", { className: "w-full px-2", children: [
|
|
4994
|
+
/* @__PURE__ */ jsx25("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
4995
|
+
user?.email && /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
4663
4996
|
] })
|
|
4664
4997
|
] }),
|
|
4665
|
-
/* @__PURE__ */
|
|
4666
|
-
/* @__PURE__ */
|
|
4667
|
-
/* @__PURE__ */
|
|
4668
|
-
/* @__PURE__ */
|
|
4669
|
-
/* @__PURE__ */
|
|
4670
|
-
/* @__PURE__ */
|
|
4671
|
-
/* @__PURE__ */
|
|
4672
|
-
/* @__PURE__ */
|
|
4673
|
-
/* @__PURE__ */
|
|
4998
|
+
/* @__PURE__ */ jsx25(Separator, {}),
|
|
4999
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
|
|
5000
|
+
/* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
5001
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
5002
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
5003
|
+
/* @__PURE__ */ jsx25(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
5004
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
5005
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
5006
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
4674
5007
|
] })
|
|
4675
5008
|
] }),
|
|
4676
|
-
user?.email && /* @__PURE__ */
|
|
4677
|
-
/* @__PURE__ */
|
|
4678
|
-
/* @__PURE__ */
|
|
4679
|
-
/* @__PURE__ */
|
|
4680
|
-
/* @__PURE__ */
|
|
5009
|
+
user?.email && /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
5010
|
+
/* @__PURE__ */ jsx25(AtSign2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
5011
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
5012
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
5013
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
4681
5014
|
] })
|
|
4682
5015
|
] }),
|
|
4683
|
-
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */
|
|
4684
|
-
/* @__PURE__ */
|
|
4685
|
-
/* @__PURE__ */
|
|
4686
|
-
/* @__PURE__ */
|
|
4687
|
-
/* @__PURE__ */
|
|
5016
|
+
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs15("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
5017
|
+
/* @__PURE__ */ jsx25(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
5018
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
5019
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
5020
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
4688
5021
|
] })
|
|
4689
5022
|
] })
|
|
4690
5023
|
] })
|
|
4691
5024
|
] }),
|
|
4692
|
-
normalizedFields.length > 0 && /* @__PURE__ */
|
|
4693
|
-
/* @__PURE__ */
|
|
4694
|
-
/* @__PURE__ */
|
|
4695
|
-
/* @__PURE__ */
|
|
4696
|
-
/* @__PURE__ */
|
|
5025
|
+
normalizedFields.length > 0 && /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
5026
|
+
/* @__PURE__ */ jsx25(Separator, {}),
|
|
5027
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
|
|
5028
|
+
/* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
5029
|
+
/* @__PURE__ */ jsx25("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
4697
5030
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
4698
|
-
return /* @__PURE__ */
|
|
5031
|
+
return /* @__PURE__ */ jsxs15(
|
|
4699
5032
|
"div",
|
|
4700
5033
|
{
|
|
4701
5034
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
4702
5035
|
children: [
|
|
4703
|
-
/* @__PURE__ */
|
|
4704
|
-
/* @__PURE__ */
|
|
4705
|
-
/* @__PURE__ */
|
|
4706
|
-
/* @__PURE__ */
|
|
5036
|
+
/* @__PURE__ */ jsx25("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
5037
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
5038
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
5039
|
+
/* @__PURE__ */ jsx25("p", { className: cn(
|
|
4707
5040
|
"text-sm font-medium",
|
|
4708
5041
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
4709
5042
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -4715,26 +5048,26 @@ var UserProfile = ({
|
|
|
4715
5048
|
}) })
|
|
4716
5049
|
] })
|
|
4717
5050
|
] }),
|
|
4718
|
-
/* @__PURE__ */
|
|
4719
|
-
/* @__PURE__ */
|
|
4720
|
-
/* @__PURE__ */
|
|
4721
|
-
/* @__PURE__ */
|
|
4722
|
-
/* @__PURE__ */
|
|
5051
|
+
/* @__PURE__ */ jsx25(Separator, {}),
|
|
5052
|
+
/* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
|
|
5053
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
|
|
5054
|
+
/* @__PURE__ */ jsxs15("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
5055
|
+
/* @__PURE__ */ jsx25(Brain2, { className: "h-4 w-4" }),
|
|
4723
5056
|
labels.memories
|
|
4724
5057
|
] }),
|
|
4725
|
-
onAddMemory && /* @__PURE__ */
|
|
5058
|
+
onAddMemory && /* @__PURE__ */ jsx25(
|
|
4726
5059
|
Button,
|
|
4727
5060
|
{
|
|
4728
5061
|
variant: "ghost",
|
|
4729
5062
|
size: "sm",
|
|
4730
5063
|
className: "h-7 px-2",
|
|
4731
5064
|
onClick: () => setIsAddingMemory(true),
|
|
4732
|
-
children: /* @__PURE__ */
|
|
5065
|
+
children: /* @__PURE__ */ jsx25(Plus3, { className: "h-4 w-4" })
|
|
4733
5066
|
}
|
|
4734
5067
|
)
|
|
4735
5068
|
] }),
|
|
4736
|
-
isAddingMemory && onAddMemory && /* @__PURE__ */
|
|
4737
|
-
/* @__PURE__ */
|
|
5069
|
+
isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs15("div", { className: "flex gap-2", children: [
|
|
5070
|
+
/* @__PURE__ */ jsx25(
|
|
4738
5071
|
Input,
|
|
4739
5072
|
{
|
|
4740
5073
|
value: newMemoryContent,
|
|
@@ -4751,24 +5084,24 @@ var UserProfile = ({
|
|
|
4751
5084
|
autoFocus: true
|
|
4752
5085
|
}
|
|
4753
5086
|
),
|
|
4754
|
-
/* @__PURE__ */
|
|
5087
|
+
/* @__PURE__ */ jsx25(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
4755
5088
|
] }),
|
|
4756
|
-
/* @__PURE__ */
|
|
5089
|
+
/* @__PURE__ */ jsx25("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx25("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
|
|
4757
5090
|
const isEditing = editingMemoryId === memory.id;
|
|
4758
|
-
return /* @__PURE__ */
|
|
5091
|
+
return /* @__PURE__ */ jsxs15(
|
|
4759
5092
|
"div",
|
|
4760
5093
|
{
|
|
4761
5094
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
4762
5095
|
children: [
|
|
4763
|
-
/* @__PURE__ */
|
|
4764
|
-
/* @__PURE__ */
|
|
4765
|
-
/* @__PURE__ */
|
|
4766
|
-
/* @__PURE__ */
|
|
4767
|
-
/* @__PURE__ */
|
|
4768
|
-
/* @__PURE__ */
|
|
5096
|
+
/* @__PURE__ */ jsx25("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx25(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
|
|
5097
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
5098
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
5099
|
+
/* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
5100
|
+
/* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
5101
|
+
/* @__PURE__ */ jsx25("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
4769
5102
|
] }),
|
|
4770
|
-
isEditing ? /* @__PURE__ */
|
|
4771
|
-
/* @__PURE__ */
|
|
5103
|
+
isEditing ? /* @__PURE__ */ jsxs15("div", { className: "space-y-2", children: [
|
|
5104
|
+
/* @__PURE__ */ jsx25(
|
|
4772
5105
|
Textarea,
|
|
4773
5106
|
{
|
|
4774
5107
|
value: editingMemoryContent,
|
|
@@ -4785,8 +5118,8 @@ var UserProfile = ({
|
|
|
4785
5118
|
}
|
|
4786
5119
|
}
|
|
4787
5120
|
),
|
|
4788
|
-
/* @__PURE__ */
|
|
4789
|
-
/* @__PURE__ */
|
|
5121
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex gap-1 justify-end", children: [
|
|
5122
|
+
/* @__PURE__ */ jsxs15(
|
|
4790
5123
|
Button,
|
|
4791
5124
|
{
|
|
4792
5125
|
variant: "ghost",
|
|
@@ -4794,12 +5127,12 @@ var UserProfile = ({
|
|
|
4794
5127
|
className: "h-7 px-2",
|
|
4795
5128
|
onClick: handleCancelEdit,
|
|
4796
5129
|
children: [
|
|
4797
|
-
/* @__PURE__ */
|
|
5130
|
+
/* @__PURE__ */ jsx25(X5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
4798
5131
|
"Cancelar"
|
|
4799
5132
|
]
|
|
4800
5133
|
}
|
|
4801
5134
|
),
|
|
4802
|
-
/* @__PURE__ */
|
|
5135
|
+
/* @__PURE__ */ jsxs15(
|
|
4803
5136
|
Button,
|
|
4804
5137
|
{
|
|
4805
5138
|
size: "sm",
|
|
@@ -4807,33 +5140,33 @@ var UserProfile = ({
|
|
|
4807
5140
|
onClick: handleSaveEdit,
|
|
4808
5141
|
disabled: !editingMemoryContent.trim(),
|
|
4809
5142
|
children: [
|
|
4810
|
-
/* @__PURE__ */
|
|
5143
|
+
/* @__PURE__ */ jsx25(Check4, { className: "h-3.5 w-3.5 mr-1" }),
|
|
4811
5144
|
"Salvar"
|
|
4812
5145
|
]
|
|
4813
5146
|
}
|
|
4814
5147
|
)
|
|
4815
5148
|
] })
|
|
4816
|
-
] }) : /* @__PURE__ */
|
|
5149
|
+
] }) : /* @__PURE__ */ jsx25("p", { className: "text-sm break-words", children: memory.content })
|
|
4817
5150
|
] }),
|
|
4818
|
-
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */
|
|
4819
|
-
onUpdateMemory && /* @__PURE__ */
|
|
5151
|
+
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs15("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
5152
|
+
onUpdateMemory && /* @__PURE__ */ jsx25(
|
|
4820
5153
|
Button,
|
|
4821
5154
|
{
|
|
4822
5155
|
variant: "ghost",
|
|
4823
5156
|
size: "icon",
|
|
4824
5157
|
className: "h-7 w-7",
|
|
4825
5158
|
onClick: () => handleStartEdit(memory),
|
|
4826
|
-
children: /* @__PURE__ */
|
|
5159
|
+
children: /* @__PURE__ */ jsx25(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
4827
5160
|
}
|
|
4828
5161
|
),
|
|
4829
|
-
onDeleteMemory && /* @__PURE__ */
|
|
5162
|
+
onDeleteMemory && /* @__PURE__ */ jsx25(
|
|
4830
5163
|
Button,
|
|
4831
5164
|
{
|
|
4832
5165
|
variant: "ghost",
|
|
4833
5166
|
size: "icon",
|
|
4834
5167
|
className: "h-7 w-7",
|
|
4835
5168
|
onClick: () => onDeleteMemory(memory.id),
|
|
4836
|
-
children: /* @__PURE__ */
|
|
5169
|
+
children: /* @__PURE__ */ jsx25(Trash24, { className: "h-3.5 w-3.5 text-destructive" })
|
|
4837
5170
|
}
|
|
4838
5171
|
)
|
|
4839
5172
|
] })
|
|
@@ -4844,8 +5177,8 @@ var UserProfile = ({
|
|
|
4844
5177
|
}) })
|
|
4845
5178
|
] })
|
|
4846
5179
|
] }) }),
|
|
4847
|
-
/* @__PURE__ */
|
|
4848
|
-
onEditProfile && /* @__PURE__ */
|
|
5180
|
+
/* @__PURE__ */ jsxs15("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
5181
|
+
onEditProfile && /* @__PURE__ */ jsx25(
|
|
4849
5182
|
Button,
|
|
4850
5183
|
{
|
|
4851
5184
|
variant: "outline",
|
|
@@ -4854,7 +5187,7 @@ var UserProfile = ({
|
|
|
4854
5187
|
children: "Edit Profile"
|
|
4855
5188
|
}
|
|
4856
5189
|
),
|
|
4857
|
-
onLogout && /* @__PURE__ */
|
|
5190
|
+
onLogout && /* @__PURE__ */ jsx25(
|
|
4858
5191
|
Button,
|
|
4859
5192
|
{
|
|
4860
5193
|
variant: "destructive",
|
|
@@ -4871,7 +5204,7 @@ var UserProfile = ({
|
|
|
4871
5204
|
|
|
4872
5205
|
// src/components/chat/ChatUI.tsx
|
|
4873
5206
|
import { Sparkles, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
|
|
4874
|
-
import { jsx as
|
|
5207
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4875
5208
|
var ChatUI = ({
|
|
4876
5209
|
messages = [],
|
|
4877
5210
|
threads = [],
|
|
@@ -4888,6 +5221,10 @@ var ChatUI = ({
|
|
|
4888
5221
|
agentOptions = [],
|
|
4889
5222
|
selectedAgentId = null,
|
|
4890
5223
|
onSelectAgent,
|
|
5224
|
+
participantIds,
|
|
5225
|
+
onParticipantsChange,
|
|
5226
|
+
targetAgentId = null,
|
|
5227
|
+
onTargetAgentChange,
|
|
4891
5228
|
className = "",
|
|
4892
5229
|
onAddMemory,
|
|
4893
5230
|
onUpdateMemory,
|
|
@@ -4895,7 +5232,7 @@ var ChatUI = ({
|
|
|
4895
5232
|
initialInput,
|
|
4896
5233
|
onInitialInputConsumed
|
|
4897
5234
|
}) => {
|
|
4898
|
-
const config =
|
|
5235
|
+
const config = useMemo5(
|
|
4899
5236
|
() => mergeConfig(defaultChatConfig, userConfig),
|
|
4900
5237
|
[userConfig]
|
|
4901
5238
|
);
|
|
@@ -5110,7 +5447,7 @@ var ChatUI = ({
|
|
|
5110
5447
|
const handleCustomComponentToggle = useCallback4(() => {
|
|
5111
5448
|
setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
|
|
5112
5449
|
}, []);
|
|
5113
|
-
const sidebarUser =
|
|
5450
|
+
const sidebarUser = useMemo5(() => user ? {
|
|
5114
5451
|
id: user.id,
|
|
5115
5452
|
name: user.name,
|
|
5116
5453
|
email: user.email,
|
|
@@ -5120,7 +5457,7 @@ var ChatUI = ({
|
|
|
5120
5457
|
setIsUserProfileOpen(true);
|
|
5121
5458
|
callbacks.onViewProfile?.();
|
|
5122
5459
|
}, [callbacks.onViewProfile]);
|
|
5123
|
-
const sidebarUserMenuCallbacks =
|
|
5460
|
+
const sidebarUserMenuCallbacks = useMemo5(() => ({
|
|
5124
5461
|
onViewProfile: handleViewProfile,
|
|
5125
5462
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5126
5463
|
onThemeChange: callbacks.onThemeChange,
|
|
@@ -5137,13 +5474,13 @@ var ChatUI = ({
|
|
|
5137
5474
|
const SuggestionIconComponents = [MessageSquare, Lightbulb2, Zap, HelpCircle];
|
|
5138
5475
|
const renderSuggestions = () => {
|
|
5139
5476
|
if (messages.length > 0 || !suggestions.length) return null;
|
|
5140
|
-
return /* @__PURE__ */
|
|
5141
|
-
/* @__PURE__ */
|
|
5142
|
-
/* @__PURE__ */
|
|
5143
|
-
/* @__PURE__ */
|
|
5144
|
-
/* @__PURE__ */
|
|
5477
|
+
return /* @__PURE__ */ jsxs16("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
5478
|
+
/* @__PURE__ */ jsxs16("div", { className: "text-center mb-8", children: [
|
|
5479
|
+
/* @__PURE__ */ jsx26("div", { className: "inline-flex items-center justify-center w-14 h-14 rounded-2xl bg-gradient-to-br from-primary/20 to-primary/5 mb-4 shadow-sm", children: /* @__PURE__ */ jsx26(Sparkles, { className: "w-7 h-7 text-primary" }) }),
|
|
5480
|
+
/* @__PURE__ */ jsx26("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
5481
|
+
/* @__PURE__ */ jsx26("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
5145
5482
|
] }),
|
|
5146
|
-
/* @__PURE__ */
|
|
5483
|
+
/* @__PURE__ */ jsx26("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs16(
|
|
5147
5484
|
"button",
|
|
5148
5485
|
{
|
|
5149
5486
|
type: "button",
|
|
@@ -5152,10 +5489,10 @@ var ChatUI = ({
|
|
|
5152
5489
|
children: [
|
|
5153
5490
|
(() => {
|
|
5154
5491
|
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
5155
|
-
return /* @__PURE__ */
|
|
5492
|
+
return /* @__PURE__ */ jsx26("div", { className: "flex items-center justify-center w-8 h-8 rounded-lg bg-primary/10 text-primary shrink-0 group-hover:bg-primary/15 transition-colors", children: /* @__PURE__ */ jsx26(IconComponent, { className: "h-4 w-4" }) });
|
|
5156
5493
|
})(),
|
|
5157
|
-
/* @__PURE__ */
|
|
5158
|
-
/* @__PURE__ */
|
|
5494
|
+
/* @__PURE__ */ jsx26("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx26("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
|
|
5495
|
+
/* @__PURE__ */ jsx26(ArrowRight, { className: "absolute right-4 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-opacity" })
|
|
5159
5496
|
]
|
|
5160
5497
|
},
|
|
5161
5498
|
index
|
|
@@ -5166,40 +5503,41 @@ var ChatUI = ({
|
|
|
5166
5503
|
const items = messageSuggestions?.[messageId];
|
|
5167
5504
|
if (!items || items.length === 0) return null;
|
|
5168
5505
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5169
|
-
return /* @__PURE__ */
|
|
5506
|
+
return /* @__PURE__ */ jsx26("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ jsxs16(
|
|
5170
5507
|
"button",
|
|
5171
5508
|
{
|
|
5172
5509
|
type: "button",
|
|
5173
5510
|
onClick: () => handleSendMessage(suggestion),
|
|
5174
5511
|
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",
|
|
5175
5512
|
children: [
|
|
5176
|
-
/* @__PURE__ */
|
|
5177
|
-
/* @__PURE__ */
|
|
5513
|
+
/* @__PURE__ */ jsx26(Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5514
|
+
/* @__PURE__ */ jsx26("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5178
5515
|
]
|
|
5179
5516
|
},
|
|
5180
5517
|
`${messageId}-suggestion-${index}`
|
|
5181
5518
|
)) });
|
|
5182
5519
|
};
|
|
5183
|
-
const renderMessageLoadingSkeleton = () => /* @__PURE__ */
|
|
5520
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx26("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5184
5521
|
const isUserRow = index % 2 === 1;
|
|
5185
|
-
return /* @__PURE__ */
|
|
5522
|
+
return /* @__PURE__ */ jsxs16(
|
|
5186
5523
|
"div",
|
|
5187
5524
|
{
|
|
5188
5525
|
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
5189
5526
|
children: [
|
|
5190
|
-
!isUserRow && /* @__PURE__ */
|
|
5191
|
-
/* @__PURE__ */
|
|
5192
|
-
/* @__PURE__ */
|
|
5193
|
-
/* @__PURE__ */
|
|
5194
|
-
/* @__PURE__ */
|
|
5527
|
+
!isUserRow && /* @__PURE__ */ jsx26(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
5528
|
+
/* @__PURE__ */ jsxs16("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
5529
|
+
/* @__PURE__ */ jsx26(Skeleton, { className: "h-4 w-24" }),
|
|
5530
|
+
/* @__PURE__ */ jsx26(Skeleton, { className: "h-4 w-full" }),
|
|
5531
|
+
/* @__PURE__ */ jsx26(Skeleton, { className: "h-4 w-[85%]" })
|
|
5195
5532
|
] }),
|
|
5196
|
-
isUserRow && /* @__PURE__ */
|
|
5533
|
+
isUserRow && /* @__PURE__ */ jsx26(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
5197
5534
|
]
|
|
5198
5535
|
},
|
|
5199
5536
|
`message-skeleton-${index}`
|
|
5200
5537
|
);
|
|
5201
5538
|
}) });
|
|
5202
|
-
const
|
|
5539
|
+
const isMultiAgentMode = config.agentSelector?.mode === "multi";
|
|
5540
|
+
const messageProps = useMemo5(() => ({
|
|
5203
5541
|
userAvatar: user?.avatar,
|
|
5204
5542
|
userName: user?.name,
|
|
5205
5543
|
assistantAvatar: assistant?.avatar,
|
|
@@ -5222,12 +5560,15 @@ var ChatUI = ({
|
|
|
5222
5560
|
longMessageChunkChars: config.ui.longMessageChunkChars,
|
|
5223
5561
|
renderUserMarkdown: config.ui.renderUserMarkdown,
|
|
5224
5562
|
markdown: config.markdown,
|
|
5225
|
-
onToggleExpanded: handleToggleMessageExpansion
|
|
5563
|
+
onToggleExpanded: handleToggleMessageExpansion,
|
|
5564
|
+
agentOptions: isMultiAgentMode ? agentOptions : void 0
|
|
5226
5565
|
}), [
|
|
5227
5566
|
user?.avatar,
|
|
5228
5567
|
user?.name,
|
|
5229
5568
|
assistant?.avatar,
|
|
5230
5569
|
assistant?.name,
|
|
5570
|
+
isMultiAgentMode,
|
|
5571
|
+
agentOptions,
|
|
5231
5572
|
config.ui.showTimestamps,
|
|
5232
5573
|
config.ui.showAvatars,
|
|
5233
5574
|
config.ui.compactMode,
|
|
@@ -5249,10 +5590,10 @@ var ChatUI = ({
|
|
|
5249
5590
|
handleToggleMessageExpansion
|
|
5250
5591
|
]);
|
|
5251
5592
|
const shouldShowAgentSelector = Boolean(
|
|
5252
|
-
config.agentSelector?.enabled &&
|
|
5593
|
+
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5253
5594
|
);
|
|
5254
|
-
return /* @__PURE__ */
|
|
5255
|
-
/* @__PURE__ */
|
|
5595
|
+
return /* @__PURE__ */ jsx26(TooltipProvider, { children: /* @__PURE__ */ jsx26(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs16("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
|
|
5596
|
+
/* @__PURE__ */ jsx26(
|
|
5256
5597
|
Sidebar2,
|
|
5257
5598
|
{
|
|
5258
5599
|
threads,
|
|
@@ -5269,8 +5610,8 @@ var ChatUI = ({
|
|
|
5269
5610
|
showThemeOptions: !!callbacks.onThemeChange
|
|
5270
5611
|
}
|
|
5271
5612
|
),
|
|
5272
|
-
/* @__PURE__ */
|
|
5273
|
-
/* @__PURE__ */
|
|
5613
|
+
/* @__PURE__ */ jsx26(SidebarInset, { children: /* @__PURE__ */ jsxs16("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5614
|
+
/* @__PURE__ */ jsx26(
|
|
5274
5615
|
ChatHeader,
|
|
5275
5616
|
{
|
|
5276
5617
|
config,
|
|
@@ -5280,14 +5621,17 @@ var ChatUI = ({
|
|
|
5280
5621
|
onNewThread: handleCreateThread,
|
|
5281
5622
|
showCustomComponentButton: !!config?.customComponent?.component,
|
|
5282
5623
|
showAgentSelector: shouldShowAgentSelector,
|
|
5624
|
+
isMultiAgentMode,
|
|
5283
5625
|
agentOptions,
|
|
5284
5626
|
selectedAgentId,
|
|
5285
|
-
onSelectAgent
|
|
5627
|
+
onSelectAgent,
|
|
5628
|
+
participantIds,
|
|
5629
|
+
onParticipantsChange
|
|
5286
5630
|
}
|
|
5287
5631
|
),
|
|
5288
|
-
/* @__PURE__ */
|
|
5289
|
-
/* @__PURE__ */
|
|
5290
|
-
/* @__PURE__ */
|
|
5632
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5633
|
+
/* @__PURE__ */ jsxs16("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5634
|
+
/* @__PURE__ */ jsx26(
|
|
5291
5635
|
ScrollArea,
|
|
5292
5636
|
{
|
|
5293
5637
|
ref: scrollAreaRef,
|
|
@@ -5295,7 +5639,7 @@ var ChatUI = ({
|
|
|
5295
5639
|
viewportClassName: "p-4 overscroll-contain",
|
|
5296
5640
|
onScrollCapture: handleScroll,
|
|
5297
5641
|
style: { contain: "strict" },
|
|
5298
|
-
children: /* @__PURE__ */
|
|
5642
|
+
children: /* @__PURE__ */ jsx26("div", { className: "max-w-4xl mx-auto pb-4", children: isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx26(
|
|
5299
5643
|
"div",
|
|
5300
5644
|
{
|
|
5301
5645
|
style: {
|
|
@@ -5307,7 +5651,7 @@ var ChatUI = ({
|
|
|
5307
5651
|
const message = messages[virtualRow.index];
|
|
5308
5652
|
const prevMessage = virtualRow.index > 0 ? messages[virtualRow.index - 1] : null;
|
|
5309
5653
|
const isGrouped = prevMessage !== null && prevMessage.role === message.role;
|
|
5310
|
-
return /* @__PURE__ */
|
|
5654
|
+
return /* @__PURE__ */ jsx26(
|
|
5311
5655
|
"div",
|
|
5312
5656
|
{
|
|
5313
5657
|
"data-index": virtualRow.index,
|
|
@@ -5319,8 +5663,8 @@ var ChatUI = ({
|
|
|
5319
5663
|
width: "100%",
|
|
5320
5664
|
transform: `translateY(${virtualRow.start}px)`
|
|
5321
5665
|
},
|
|
5322
|
-
children: /* @__PURE__ */
|
|
5323
|
-
/* @__PURE__ */
|
|
5666
|
+
children: /* @__PURE__ */ jsxs16("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
|
|
5667
|
+
/* @__PURE__ */ jsx26(
|
|
5324
5668
|
Message,
|
|
5325
5669
|
{
|
|
5326
5670
|
message,
|
|
@@ -5339,38 +5683,50 @@ var ChatUI = ({
|
|
|
5339
5683
|
) })
|
|
5340
5684
|
}
|
|
5341
5685
|
),
|
|
5342
|
-
/* @__PURE__ */
|
|
5343
|
-
|
|
5344
|
-
|
|
5345
|
-
|
|
5346
|
-
|
|
5347
|
-
|
|
5348
|
-
|
|
5349
|
-
|
|
5350
|
-
|
|
5351
|
-
|
|
5352
|
-
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5358
|
-
|
|
5359
|
-
|
|
5360
|
-
|
|
5361
|
-
|
|
5362
|
-
|
|
5363
|
-
|
|
5364
|
-
|
|
5365
|
-
|
|
5366
|
-
|
|
5686
|
+
/* @__PURE__ */ jsxs16("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5687
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx26("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx26(
|
|
5688
|
+
TargetAgentSelector,
|
|
5689
|
+
{
|
|
5690
|
+
agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
|
|
5691
|
+
targetAgentId,
|
|
5692
|
+
onTargetChange: onTargetAgentChange,
|
|
5693
|
+
placeholder: config.agentSelector?.label || "Select agent",
|
|
5694
|
+
disabled: isGenerating
|
|
5695
|
+
}
|
|
5696
|
+
) }),
|
|
5697
|
+
/* @__PURE__ */ jsx26(
|
|
5698
|
+
ChatInput,
|
|
5699
|
+
{
|
|
5700
|
+
value: inputValue,
|
|
5701
|
+
onChange: (value) => {
|
|
5702
|
+
setInputValue(value);
|
|
5703
|
+
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
5704
|
+
initialInputConsumedRef.current = true;
|
|
5705
|
+
onInitialInputConsumed?.();
|
|
5706
|
+
}
|
|
5707
|
+
},
|
|
5708
|
+
onSubmit: handleSendMessage,
|
|
5709
|
+
attachments,
|
|
5710
|
+
onAttachmentsChange: setAttachments,
|
|
5711
|
+
placeholder: config.labels.inputPlaceholder,
|
|
5712
|
+
disabled: false,
|
|
5713
|
+
isGenerating,
|
|
5714
|
+
onStopGeneration: callbacks.onStopGeneration,
|
|
5715
|
+
enableFileUpload: config.features.enableFileUpload,
|
|
5716
|
+
enableAudioRecording: config.features.enableAudioRecording,
|
|
5717
|
+
maxAttachments: config.features.maxAttachments,
|
|
5718
|
+
maxFileSize: config.features.maxFileSize,
|
|
5719
|
+
config
|
|
5720
|
+
}
|
|
5721
|
+
)
|
|
5722
|
+
] })
|
|
5367
5723
|
] }),
|
|
5368
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */
|
|
5724
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx26(
|
|
5369
5725
|
"div",
|
|
5370
5726
|
{
|
|
5371
5727
|
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5372
5728
|
style: { width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0 },
|
|
5373
|
-
children: state.showSidebar && /* @__PURE__ */
|
|
5729
|
+
children: state.showSidebar && /* @__PURE__ */ jsx26(
|
|
5374
5730
|
"div",
|
|
5375
5731
|
{
|
|
5376
5732
|
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
@@ -5382,8 +5738,8 @@ var ChatUI = ({
|
|
|
5382
5738
|
)
|
|
5383
5739
|
] })
|
|
5384
5740
|
] }) }),
|
|
5385
|
-
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */
|
|
5386
|
-
/* @__PURE__ */
|
|
5741
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs16("div", { className: "fixed inset-0 z-50", children: [
|
|
5742
|
+
/* @__PURE__ */ jsx26(
|
|
5387
5743
|
"div",
|
|
5388
5744
|
{
|
|
5389
5745
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -5391,16 +5747,16 @@ var ChatUI = ({
|
|
|
5391
5747
|
onClick: closeSidebar
|
|
5392
5748
|
}
|
|
5393
5749
|
),
|
|
5394
|
-
/* @__PURE__ */
|
|
5750
|
+
/* @__PURE__ */ jsx26(
|
|
5395
5751
|
"div",
|
|
5396
5752
|
{
|
|
5397
5753
|
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"}`,
|
|
5398
5754
|
style: { willChange: "transform" },
|
|
5399
|
-
children: /* @__PURE__ */
|
|
5755
|
+
children: /* @__PURE__ */ jsx26("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5400
5756
|
}
|
|
5401
5757
|
)
|
|
5402
5758
|
] }),
|
|
5403
|
-
isUserProfileOpen && /* @__PURE__ */
|
|
5759
|
+
isUserProfileOpen && /* @__PURE__ */ jsx26(
|
|
5404
5760
|
UserProfile,
|
|
5405
5761
|
{
|
|
5406
5762
|
isOpen: isUserProfileOpen,
|
|
@@ -5435,10 +5791,10 @@ import {
|
|
|
5435
5791
|
Filter as Filter2,
|
|
5436
5792
|
Calendar as Calendar2,
|
|
5437
5793
|
Hash,
|
|
5438
|
-
X as
|
|
5439
|
-
Check as
|
|
5794
|
+
X as X6,
|
|
5795
|
+
Check as Check5
|
|
5440
5796
|
} from "lucide-react";
|
|
5441
|
-
import { Fragment as
|
|
5797
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5442
5798
|
var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
|
|
5443
5799
|
const [isEditing, setIsEditing] = useState9(false);
|
|
5444
5800
|
const [editTitle, setEditTitle] = useState9(thread.title);
|
|
@@ -5467,9 +5823,9 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
|
|
|
5467
5823
|
handleCancelEdit();
|
|
5468
5824
|
}
|
|
5469
5825
|
};
|
|
5470
|
-
return /* @__PURE__ */
|
|
5471
|
-
/* @__PURE__ */
|
|
5472
|
-
/* @__PURE__ */
|
|
5826
|
+
return /* @__PURE__ */ jsx27(Card, { className: `cursor-pointer transition-all duration-200 hover:shadow-md py-0 ${isActive ? "ring-2 ring-primary bg-primary/5" : "hover:bg-muted/50"}`, children: /* @__PURE__ */ jsx27(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs17("div", { className: "flex items-start justify-between gap-2", children: [
|
|
5827
|
+
/* @__PURE__ */ jsx27("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
|
|
5828
|
+
/* @__PURE__ */ jsx27(
|
|
5473
5829
|
Input,
|
|
5474
5830
|
{
|
|
5475
5831
|
ref: inputRef,
|
|
@@ -5481,44 +5837,44 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
|
|
|
5481
5837
|
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
|
|
5482
5838
|
}
|
|
5483
5839
|
),
|
|
5484
|
-
/* @__PURE__ */
|
|
5485
|
-
/* @__PURE__ */
|
|
5486
|
-
] }) : /* @__PURE__ */
|
|
5487
|
-
/* @__PURE__ */
|
|
5488
|
-
/* @__PURE__ */
|
|
5489
|
-
/* @__PURE__ */
|
|
5490
|
-
/* @__PURE__ */
|
|
5840
|
+
/* @__PURE__ */ jsx27(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx27(Check5, { className: "h-3 w-3" }) }),
|
|
5841
|
+
/* @__PURE__ */ jsx27(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx27(X6, { className: "h-3 w-3" }) })
|
|
5842
|
+
] }) : /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
5843
|
+
/* @__PURE__ */ jsx27("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
|
|
5844
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
5845
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
5846
|
+
/* @__PURE__ */ jsx27(Hash, { className: "h-3 w-3" }),
|
|
5491
5847
|
thread.messageCount,
|
|
5492
5848
|
" msgs"
|
|
5493
5849
|
] }),
|
|
5494
|
-
/* @__PURE__ */
|
|
5495
|
-
/* @__PURE__ */
|
|
5496
|
-
/* @__PURE__ */
|
|
5850
|
+
/* @__PURE__ */ jsx27(Separator, { orientation: "vertical", className: "h-3" }),
|
|
5851
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-1", children: [
|
|
5852
|
+
/* @__PURE__ */ jsx27(Calendar2, { className: "h-3 w-3" }),
|
|
5497
5853
|
formatDate(thread.updatedAt, config?.labels)
|
|
5498
5854
|
] }),
|
|
5499
|
-
thread.isArchived && /* @__PURE__ */
|
|
5500
|
-
/* @__PURE__ */
|
|
5501
|
-
/* @__PURE__ */
|
|
5502
|
-
/* @__PURE__ */
|
|
5855
|
+
thread.isArchived && /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
5856
|
+
/* @__PURE__ */ jsx27(Separator, { orientation: "vertical", className: "h-3" }),
|
|
5857
|
+
/* @__PURE__ */ jsxs17(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
5858
|
+
/* @__PURE__ */ jsx27(Archive2, { className: "h-2 w-2 mr-1" }),
|
|
5503
5859
|
config?.labels?.archiveThread || "Archived"
|
|
5504
5860
|
] })
|
|
5505
5861
|
] })
|
|
5506
5862
|
] })
|
|
5507
5863
|
] }) }),
|
|
5508
|
-
!isEditing && /* @__PURE__ */
|
|
5509
|
-
/* @__PURE__ */
|
|
5510
|
-
/* @__PURE__ */
|
|
5511
|
-
/* @__PURE__ */
|
|
5512
|
-
/* @__PURE__ */
|
|
5864
|
+
!isEditing && /* @__PURE__ */ jsxs17(DropdownMenu, { children: [
|
|
5865
|
+
/* @__PURE__ */ jsx27(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx27(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx27(MoreVertical2, { className: "h-3 w-3" }) }) }),
|
|
5866
|
+
/* @__PURE__ */ jsxs17(DropdownMenuContent, { align: "end", children: [
|
|
5867
|
+
/* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
|
|
5868
|
+
/* @__PURE__ */ jsx27(Edit22, { className: "h-4 w-4 mr-2" }),
|
|
5513
5869
|
config?.labels?.renameThread || "Rename"
|
|
5514
5870
|
] }),
|
|
5515
|
-
/* @__PURE__ */
|
|
5516
|
-
/* @__PURE__ */
|
|
5871
|
+
/* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: onArchive, children: [
|
|
5872
|
+
/* @__PURE__ */ jsx27(Archive2, { className: "h-4 w-4 mr-2" }),
|
|
5517
5873
|
thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
|
|
5518
5874
|
] }),
|
|
5519
|
-
/* @__PURE__ */
|
|
5520
|
-
/* @__PURE__ */
|
|
5521
|
-
/* @__PURE__ */
|
|
5875
|
+
/* @__PURE__ */ jsx27(DropdownMenuSeparator, {}),
|
|
5876
|
+
/* @__PURE__ */ jsxs17(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
|
|
5877
|
+
/* @__PURE__ */ jsx27(Trash25, { className: "h-4 w-4 mr-2" }),
|
|
5522
5878
|
config?.labels?.deleteThread || "Delete"
|
|
5523
5879
|
] })
|
|
5524
5880
|
] })
|
|
@@ -5533,17 +5889,17 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
|
5533
5889
|
setTitle("");
|
|
5534
5890
|
setIsOpen(false);
|
|
5535
5891
|
};
|
|
5536
|
-
return /* @__PURE__ */
|
|
5537
|
-
/* @__PURE__ */
|
|
5538
|
-
/* @__PURE__ */
|
|
5892
|
+
return /* @__PURE__ */ jsxs17(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5893
|
+
/* @__PURE__ */ jsx27(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs17(Button, { variant: "outline", className: "w-full", children: [
|
|
5894
|
+
/* @__PURE__ */ jsx27(Plus4, { className: "h-4 w-4 mr-2" }),
|
|
5539
5895
|
config?.labels?.createNewThread || "New Conversation"
|
|
5540
5896
|
] }) }),
|
|
5541
|
-
/* @__PURE__ */
|
|
5542
|
-
/* @__PURE__ */
|
|
5543
|
-
/* @__PURE__ */
|
|
5544
|
-
/* @__PURE__ */
|
|
5897
|
+
/* @__PURE__ */ jsxs17(DialogContent, { children: [
|
|
5898
|
+
/* @__PURE__ */ jsxs17(DialogHeader, { children: [
|
|
5899
|
+
/* @__PURE__ */ jsx27(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
|
|
5900
|
+
/* @__PURE__ */ jsx27(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
5545
5901
|
] }),
|
|
5546
|
-
/* @__PURE__ */
|
|
5902
|
+
/* @__PURE__ */ jsx27(
|
|
5547
5903
|
Input,
|
|
5548
5904
|
{
|
|
5549
5905
|
value: title,
|
|
@@ -5553,9 +5909,9 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
|
5553
5909
|
autoFocus: true
|
|
5554
5910
|
}
|
|
5555
5911
|
),
|
|
5556
|
-
/* @__PURE__ */
|
|
5557
|
-
/* @__PURE__ */
|
|
5558
|
-
/* @__PURE__ */
|
|
5912
|
+
/* @__PURE__ */ jsxs17(DialogFooter, { children: [
|
|
5913
|
+
/* @__PURE__ */ jsx27(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
|
|
5914
|
+
/* @__PURE__ */ jsx27(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
|
|
5559
5915
|
] })
|
|
5560
5916
|
] })
|
|
5561
5917
|
] });
|
|
@@ -5609,20 +5965,20 @@ var ThreadManager = ({
|
|
|
5609
5965
|
setDeleteThreadId(null);
|
|
5610
5966
|
};
|
|
5611
5967
|
if (!isOpen) return null;
|
|
5612
|
-
return /* @__PURE__ */
|
|
5613
|
-
/* @__PURE__ */
|
|
5614
|
-
/* @__PURE__ */
|
|
5615
|
-
/* @__PURE__ */
|
|
5616
|
-
/* @__PURE__ */
|
|
5617
|
-
/* @__PURE__ */
|
|
5968
|
+
return /* @__PURE__ */ jsx27(TooltipProvider, { children: /* @__PURE__ */ jsxs17("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
|
|
5969
|
+
/* @__PURE__ */ jsx27("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs17(Card, { className: "h-full border-0 rounded-none", children: [
|
|
5970
|
+
/* @__PURE__ */ jsxs17(CardHeader, { className: "border-b", children: [
|
|
5971
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
5972
|
+
/* @__PURE__ */ jsxs17(CardTitle, { className: "flex items-center gap-2", children: [
|
|
5973
|
+
/* @__PURE__ */ jsx27(MessageSquare2, { className: "h-5 w-5" }),
|
|
5618
5974
|
config?.labels?.newChat || "Conversations"
|
|
5619
5975
|
] }),
|
|
5620
|
-
/* @__PURE__ */
|
|
5976
|
+
/* @__PURE__ */ jsx27(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx27(X6, { className: "h-4 w-4" }) })
|
|
5621
5977
|
] }),
|
|
5622
|
-
/* @__PURE__ */
|
|
5623
|
-
/* @__PURE__ */
|
|
5624
|
-
/* @__PURE__ */
|
|
5625
|
-
/* @__PURE__ */
|
|
5978
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
|
|
5979
|
+
/* @__PURE__ */ jsxs17("div", { className: "relative", children: [
|
|
5980
|
+
/* @__PURE__ */ jsx27(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
5981
|
+
/* @__PURE__ */ jsx27(
|
|
5626
5982
|
Input,
|
|
5627
5983
|
{
|
|
5628
5984
|
placeholder: config?.labels?.search || "Search conversations...",
|
|
@@ -5632,8 +5988,8 @@ var ThreadManager = ({
|
|
|
5632
5988
|
}
|
|
5633
5989
|
)
|
|
5634
5990
|
] }),
|
|
5635
|
-
/* @__PURE__ */
|
|
5636
|
-
/* @__PURE__ */
|
|
5991
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
5992
|
+
/* @__PURE__ */ jsxs17(
|
|
5637
5993
|
Button,
|
|
5638
5994
|
{
|
|
5639
5995
|
variant: "outline",
|
|
@@ -5641,12 +5997,12 @@ var ThreadManager = ({
|
|
|
5641
5997
|
onClick: () => setShowArchived(!showArchived),
|
|
5642
5998
|
className: "text-xs",
|
|
5643
5999
|
children: [
|
|
5644
|
-
/* @__PURE__ */
|
|
6000
|
+
/* @__PURE__ */ jsx27(Filter2, { className: "h-3 w-3 mr-1" }),
|
|
5645
6001
|
showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
|
|
5646
6002
|
]
|
|
5647
6003
|
}
|
|
5648
6004
|
),
|
|
5649
|
-
/* @__PURE__ */
|
|
6005
|
+
/* @__PURE__ */ jsxs17(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
5650
6006
|
filteredThreads.length,
|
|
5651
6007
|
" / ",
|
|
5652
6008
|
threads.length
|
|
@@ -5654,14 +6010,14 @@ var ThreadManager = ({
|
|
|
5654
6010
|
] })
|
|
5655
6011
|
] })
|
|
5656
6012
|
] }),
|
|
5657
|
-
/* @__PURE__ */
|
|
5658
|
-
/* @__PURE__ */
|
|
5659
|
-
/* @__PURE__ */
|
|
5660
|
-
/* @__PURE__ */
|
|
5661
|
-
/* @__PURE__ */
|
|
5662
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */
|
|
5663
|
-
/* @__PURE__ */
|
|
5664
|
-
/* @__PURE__ */
|
|
6013
|
+
/* @__PURE__ */ jsxs17(CardContent, { className: "p-0 flex-1", children: [
|
|
6014
|
+
/* @__PURE__ */ jsx27("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx27(CreateThreadDialog2, { onCreateThread, config }) }),
|
|
6015
|
+
/* @__PURE__ */ jsx27(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx27("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs17("div", { className: "text-center py-8 text-muted-foreground", children: [
|
|
6016
|
+
/* @__PURE__ */ jsx27(MessageSquare2, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
|
|
6017
|
+
/* @__PURE__ */ jsx27("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
|
|
6018
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs17("div", { children: [
|
|
6019
|
+
/* @__PURE__ */ jsx27("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
|
|
6020
|
+
/* @__PURE__ */ jsx27("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx27(
|
|
5665
6021
|
ThreadItem,
|
|
5666
6022
|
{
|
|
5667
6023
|
thread,
|
|
@@ -5677,14 +6033,14 @@ var ThreadManager = ({
|
|
|
5677
6033
|
] }, group)) }) })
|
|
5678
6034
|
] })
|
|
5679
6035
|
] }) }),
|
|
5680
|
-
deleteThreadId && /* @__PURE__ */
|
|
5681
|
-
/* @__PURE__ */
|
|
5682
|
-
/* @__PURE__ */
|
|
5683
|
-
/* @__PURE__ */
|
|
6036
|
+
deleteThreadId && /* @__PURE__ */ jsx27(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs17(AlertDialogContent, { children: [
|
|
6037
|
+
/* @__PURE__ */ jsxs17(AlertDialogHeader, { children: [
|
|
6038
|
+
/* @__PURE__ */ jsx27(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
6039
|
+
/* @__PURE__ */ jsx27(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
5684
6040
|
] }),
|
|
5685
|
-
/* @__PURE__ */
|
|
5686
|
-
/* @__PURE__ */
|
|
5687
|
-
/* @__PURE__ */
|
|
6041
|
+
/* @__PURE__ */ jsxs17(AlertDialogFooter, { children: [
|
|
6042
|
+
/* @__PURE__ */ jsx27(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
|
|
6043
|
+
/* @__PURE__ */ jsx27(
|
|
5688
6044
|
AlertDialogAction,
|
|
5689
6045
|
{
|
|
5690
6046
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
@@ -5696,43 +6052,20 @@ var ThreadManager = ({
|
|
|
5696
6052
|
] }) })
|
|
5697
6053
|
] }) });
|
|
5698
6054
|
};
|
|
5699
|
-
|
|
5700
|
-
// src/lib/chatUtils.ts
|
|
5701
|
-
var chatUtils = {
|
|
5702
|
-
generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
5703
|
-
generateMessageId: () => chatUtils.generateId(),
|
|
5704
|
-
generateThreadId: () => chatUtils.generateId(),
|
|
5705
|
-
createMessage: (role, content, attachments) => ({
|
|
5706
|
-
id: chatUtils.generateMessageId(),
|
|
5707
|
-
role,
|
|
5708
|
-
content,
|
|
5709
|
-
timestamp: Date.now(),
|
|
5710
|
-
attachments,
|
|
5711
|
-
isComplete: true
|
|
5712
|
-
}),
|
|
5713
|
-
createThread: (title) => ({
|
|
5714
|
-
id: chatUtils.generateThreadId(),
|
|
5715
|
-
title,
|
|
5716
|
-
createdAt: Date.now(),
|
|
5717
|
-
updatedAt: Date.now(),
|
|
5718
|
-
messageCount: 0
|
|
5719
|
-
}),
|
|
5720
|
-
generateThreadTitle: (firstMessage) => {
|
|
5721
|
-
const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
|
|
5722
|
-
const words = cleaned.split(/\s+/).slice(0, 6);
|
|
5723
|
-
return words.join(" ") || "Nova Conversa";
|
|
5724
|
-
}
|
|
5725
|
-
};
|
|
5726
6055
|
export {
|
|
6056
|
+
AgentBadge,
|
|
5727
6057
|
ChatHeader,
|
|
5728
6058
|
ChatInput,
|
|
5729
6059
|
ChatUI,
|
|
5730
6060
|
ChatUserContextProvider,
|
|
5731
6061
|
Message,
|
|
6062
|
+
ParticipantsSelector,
|
|
5732
6063
|
Sidebar2 as Sidebar,
|
|
6064
|
+
TargetAgentSelector,
|
|
5733
6065
|
ThreadManager,
|
|
5734
6066
|
UserMenu,
|
|
5735
6067
|
UserProfile,
|
|
6068
|
+
assignAgentColors,
|
|
5736
6069
|
chatConfigPresets,
|
|
5737
6070
|
chatUtils,
|
|
5738
6071
|
cn,
|
|
@@ -5741,6 +6074,8 @@ export {
|
|
|
5741
6074
|
defaultChatConfig,
|
|
5742
6075
|
featureFlags,
|
|
5743
6076
|
formatDate,
|
|
6077
|
+
getAgentColor,
|
|
6078
|
+
getAgentInitials,
|
|
5744
6079
|
mergeConfig,
|
|
5745
6080
|
themeUtils,
|
|
5746
6081
|
useChatUserContext,
|