@copilotz/chat-ui 0.4.1 → 0.5.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/README.md +42 -32
- package/dist/components/chat/AgentSelectors.d.ts +50 -0
- package/dist/components/chat/AgentSelectors.d.ts.map +1 -0
- package/dist/components/chat/AgentSelectors.js +67 -0
- package/dist/components/chat/AgentSelectors.js.map +1 -0
- package/dist/components/chat/AssistantActivity.d.ts +11 -0
- package/dist/components/chat/AssistantActivity.d.ts.map +1 -0
- package/dist/components/chat/AssistantActivity.js +82 -0
- package/dist/components/chat/AssistantActivity.js.map +1 -0
- package/dist/components/chat/ChatHeader.d.ts +56 -0
- package/dist/components/chat/ChatHeader.d.ts.map +1 -0
- package/dist/components/chat/ChatHeader.js +71 -0
- package/dist/components/chat/ChatHeader.js.map +1 -0
- package/dist/components/chat/ChatInput.d.ts +25 -0
- package/dist/components/chat/ChatInput.d.ts.map +1 -0
- package/dist/components/chat/ChatInput.js +732 -0
- package/dist/components/chat/ChatInput.js.map +1 -0
- package/dist/components/chat/ChatUI.d.ts +4 -0
- package/dist/components/chat/ChatUI.d.ts.map +1 -0
- package/dist/components/chat/ChatUI.js +470 -0
- package/dist/components/chat/ChatUI.js.map +1 -0
- package/dist/components/chat/Message.d.ts +37 -0
- package/dist/components/chat/Message.d.ts.map +1 -0
- package/dist/components/chat/Message.js +262 -0
- package/dist/components/chat/Message.js.map +1 -0
- package/dist/components/chat/Sidebar.d.ts +52 -0
- package/dist/components/chat/Sidebar.d.ts.map +1 -0
- package/dist/components/chat/Sidebar.js +112 -0
- package/dist/components/chat/Sidebar.js.map +1 -0
- package/dist/components/chat/ThreadManager.d.ts +18 -0
- package/dist/components/chat/ThreadManager.d.ts.map +1 -0
- package/dist/components/chat/ThreadManager.js +108 -0
- package/dist/components/chat/ThreadManager.js.map +1 -0
- package/dist/components/chat/UserContext.d.ts +15 -0
- package/dist/components/chat/UserContext.d.ts.map +1 -0
- package/dist/components/chat/UserContext.js +39 -0
- package/dist/components/chat/UserContext.js.map +1 -0
- package/dist/components/chat/UserMenu.d.ts +38 -0
- package/dist/components/chat/UserMenu.d.ts.map +1 -0
- package/dist/components/chat/UserMenu.js +44 -0
- package/dist/components/chat/UserMenu.js.map +1 -0
- package/dist/components/chat/UserProfile.d.ts +51 -0
- package/dist/components/chat/UserProfile.d.ts.map +1 -0
- package/dist/components/chat/UserProfile.js +206 -0
- package/dist/components/chat/UserProfile.js.map +1 -0
- package/dist/components/chat/VoiceComposer.d.ts +29 -0
- package/dist/components/chat/VoiceComposer.d.ts.map +1 -0
- package/dist/components/chat/VoiceComposer.js +99 -0
- package/dist/components/chat/VoiceComposer.js.map +1 -0
- package/dist/components/ui/Spinner.d.ts +7 -0
- package/dist/components/ui/Spinner.d.ts.map +1 -0
- package/dist/components/ui/Spinner.js +14 -0
- package/dist/components/ui/Spinner.js.map +1 -0
- package/dist/components/ui/accordion.d.ts +8 -0
- package/dist/components/ui/accordion.d.ts.map +1 -0
- package/dist/components/ui/accordion.js +14 -0
- package/dist/components/ui/accordion.js.map +1 -0
- package/dist/components/ui/alert-dialog.d.ts +15 -0
- package/dist/components/ui/alert-dialog.d.ts.map +1 -0
- package/dist/components/ui/alert-dialog.js +66 -0
- package/dist/components/ui/alert-dialog.js.map +1 -0
- package/dist/components/ui/avatar.d.ts +7 -0
- package/dist/components/ui/avatar.d.ts.map +1 -0
- package/dist/components/ui/avatar.js +15 -0
- package/dist/components/ui/avatar.js.map +1 -0
- package/dist/components/ui/badge.d.ts +10 -0
- package/dist/components/ui/badge.d.ts.map +1 -0
- package/dist/components/ui/badge.js +23 -0
- package/dist/components/ui/badge.js.map +1 -0
- package/dist/components/ui/button.d.ts +11 -0
- package/dist/components/ui/button.d.ts.map +1 -0
- package/dist/components/ui/button.js +32 -0
- package/dist/components/ui/button.js.map +1 -0
- package/dist/components/ui/card.d.ts +10 -0
- package/dist/components/ui/card.d.ts.map +1 -0
- package/dist/components/ui/card.js +25 -0
- package/dist/components/ui/card.js.map +1 -0
- package/dist/components/ui/collapsible.d.ts +6 -0
- package/dist/components/ui/collapsible.d.ts.map +1 -0
- package/dist/components/ui/collapsible.js +6 -0
- package/dist/components/ui/collapsible.js.map +1 -0
- package/dist/components/ui/context-menu.d.ts +26 -0
- package/dist/components/ui/context-menu.d.ts.map +1 -0
- package/dist/components/ui/context-menu.js +51 -0
- package/dist/components/ui/context-menu.js.map +1 -0
- package/dist/components/ui/dialog.d.ts +16 -0
- package/dist/components/ui/dialog.d.ts.map +1 -0
- package/dist/components/ui/dialog.js +63 -0
- package/dist/components/ui/dialog.js.map +1 -0
- package/dist/components/ui/dropdown-menu.d.ts +26 -0
- package/dist/components/ui/dropdown-menu.d.ts.map +1 -0
- package/dist/components/ui/dropdown-menu.js +51 -0
- package/dist/components/ui/dropdown-menu.js.map +1 -0
- package/dist/components/ui/input.d.ts +4 -0
- package/dist/components/ui/input.d.ts.map +1 -0
- package/dist/components/ui/input.js +7 -0
- package/dist/components/ui/input.js.map +1 -0
- package/dist/components/ui/progress.d.ts +5 -0
- package/dist/components/ui/progress.d.ts.map +1 -0
- package/dist/components/ui/progress.js +8 -0
- package/dist/components/ui/progress.js.map +1 -0
- package/dist/components/ui/scroll-area.d.ts +8 -0
- package/dist/components/ui/scroll-area.d.ts.map +1 -0
- package/dist/components/ui/scroll-area.js +16 -0
- package/dist/components/ui/scroll-area.js.map +1 -0
- package/dist/components/ui/select.d.ts +12 -0
- package/dist/components/ui/select.d.ts.map +1 -0
- package/dist/components/ui/select.js +21 -0
- package/dist/components/ui/select.js.map +1 -0
- package/dist/components/ui/separator.d.ts +5 -0
- package/dist/components/ui/separator.d.ts.map +1 -0
- package/dist/components/ui/separator.js +9 -0
- package/dist/components/ui/separator.js.map +1 -0
- package/dist/components/ui/sheet.d.ts +14 -0
- package/dist/components/ui/sheet.d.ts.map +1 -0
- package/dist/components/ui/sheet.js +66 -0
- package/dist/components/ui/sheet.js.map +1 -0
- package/dist/components/ui/sidebar.d.ts +70 -0
- package/dist/components/ui/sidebar.d.ts.map +1 -0
- package/dist/components/ui/sidebar.js +212 -0
- package/dist/components/ui/sidebar.js.map +1 -0
- package/dist/components/ui/skeleton.d.ts +3 -0
- package/dist/components/ui/skeleton.d.ts.map +1 -0
- package/dist/components/ui/skeleton.js +7 -0
- package/dist/components/ui/skeleton.js.map +1 -0
- package/dist/components/ui/textarea.d.ts +4 -0
- package/dist/components/ui/textarea.d.ts.map +1 -0
- package/dist/components/ui/textarea.js +7 -0
- package/dist/components/ui/textarea.js.map +1 -0
- package/dist/components/ui/tooltip.d.ts +8 -0
- package/dist/components/ui/tooltip.d.ts.map +1 -0
- package/dist/components/ui/tooltip.js +18 -0
- package/dist/components/ui/tooltip.js.map +1 -0
- package/dist/config/chatConfig.d.ts +4 -0
- package/dist/config/chatConfig.d.ts.map +1 -0
- package/dist/config/chatConfig.js +173 -0
- package/dist/config/chatConfig.js.map +1 -0
- package/dist/hooks/use-mobile.d.ts +2 -0
- package/dist/hooks/use-mobile.d.ts.map +1 -0
- package/dist/hooks/use-mobile.js +16 -0
- package/dist/hooks/use-mobile.js.map +1 -0
- package/dist/index.cjs +1000 -1340
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +36 -345
- package/dist/index.d.ts +36 -345
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +943 -1285
- package/dist/index.js.map +1 -1
- package/dist/lib/chatUtils.d.ts +18 -0
- package/dist/lib/chatUtils.d.ts.map +1 -0
- package/dist/lib/chatUtils.js +64 -0
- package/dist/lib/chatUtils.js.map +1 -0
- package/dist/lib/utils.d.ts +6 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +46 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/lib/voiceCompose.d.ts +6 -0
- package/dist/lib/voiceCompose.d.ts.map +1 -0
- package/dist/lib/voiceCompose.js +344 -0
- package/dist/lib/voiceCompose.js.map +1 -0
- package/dist/styles.css +58 -106
- package/dist/types/chatTypes.d.ts +386 -0
- package/dist/types/chatTypes.d.ts.map +1 -0
- package/dist/types/chatTypes.js +2 -0
- package/dist/types/chatTypes.js.map +1 -0
- package/package.json +2 -1
package/dist/index.cjs
CHANGED
|
@@ -30,33 +30,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
-
|
|
34
|
-
ChatHeader: () => ChatHeader,
|
|
35
|
-
ChatInput: () => ChatInput,
|
|
33
|
+
AssistantActivity: () => AssistantActivity,
|
|
36
34
|
ChatUI: () => ChatUI,
|
|
37
35
|
ChatUserContextProvider: () => ChatUserContextProvider,
|
|
38
|
-
Message: () => Message,
|
|
39
|
-
ParticipantsSelector: () => ParticipantsSelector,
|
|
40
|
-
Sidebar: () => Sidebar2,
|
|
41
|
-
TargetAgentSelector: () => TargetAgentSelector,
|
|
42
|
-
ThreadManager: () => ThreadManager,
|
|
43
|
-
UserMenu: () => UserMenu,
|
|
44
|
-
UserProfile: () => UserProfile,
|
|
45
|
-
assignAgentColors: () => assignAgentColors,
|
|
46
|
-
chatUtils: () => chatUtils,
|
|
47
|
-
cn: () => cn,
|
|
48
|
-
createObjectUrlFromDataUrl: () => createObjectUrlFromDataUrl,
|
|
49
36
|
defaultChatConfig: () => defaultChatConfig,
|
|
50
|
-
formatDate: () => formatDate,
|
|
51
|
-
getAgentColor: () => getAgentColor,
|
|
52
|
-
getAgentInitials: () => getAgentInitials,
|
|
53
37
|
mergeConfig: () => mergeConfig,
|
|
54
38
|
useChatUserContext: () => useChatUserContext
|
|
55
39
|
});
|
|
56
40
|
module.exports = __toCommonJS(index_exports);
|
|
57
41
|
|
|
58
42
|
// src/components/chat/ChatUI.tsx
|
|
59
|
-
var
|
|
43
|
+
var import_react9 = require("react");
|
|
60
44
|
var import_react_virtual = require("@tanstack/react-virtual");
|
|
61
45
|
|
|
62
46
|
// src/config/chatConfig.ts
|
|
@@ -137,10 +121,16 @@ var defaultChatConfig = {
|
|
|
137
121
|
cancel: "Cancel",
|
|
138
122
|
create: "Create Conversation",
|
|
139
123
|
footerLabel: "Assistant can make mistakes. Check the AI results.",
|
|
140
|
-
toolUsed: "Tool Used",
|
|
141
124
|
daysAgo: "days ago",
|
|
142
125
|
inputHelpText: "Press Enter to send, Shift+Enter to add a new line.",
|
|
143
|
-
|
|
126
|
+
activityThinking: "Thinking...",
|
|
127
|
+
activityWorking: "Working...",
|
|
128
|
+
activityUsingTools: "Using tools...",
|
|
129
|
+
activityPreparingAnswer: "Preparing answer...",
|
|
130
|
+
activityToolRunning: "Using {{tool}}...",
|
|
131
|
+
activityMultipleTools: "Using {{count}} tools...",
|
|
132
|
+
activityShowDetails: "Show details",
|
|
133
|
+
activityHideDetails: "Hide details",
|
|
144
134
|
defaultThreadName: "Main Thread",
|
|
145
135
|
loadOlderMessages: "Load older messages",
|
|
146
136
|
loadingOlderMessages: "Loading older messages...",
|
|
@@ -154,7 +144,7 @@ var defaultChatConfig = {
|
|
|
154
144
|
enableMessageEditing: true,
|
|
155
145
|
enableMessageCopy: true,
|
|
156
146
|
enableRegeneration: true,
|
|
157
|
-
|
|
147
|
+
activityDisplay: "full",
|
|
158
148
|
maxAttachments: 4,
|
|
159
149
|
maxFileSize: 10 * 1024 * 1024
|
|
160
150
|
// 10MB
|
|
@@ -226,37 +216,12 @@ function mergeConfig(_baseConfig, userConfig) {
|
|
|
226
216
|
}
|
|
227
217
|
|
|
228
218
|
// src/components/chat/Message.tsx
|
|
229
|
-
var
|
|
219
|
+
var import_react2 = __toESM(require("react"), 1);
|
|
230
220
|
var import_react_markdown = __toESM(require("react-markdown"), 1);
|
|
231
221
|
var import_remark_gfm = __toESM(require("remark-gfm"), 1);
|
|
232
222
|
var import_rehype_highlight = __toESM(require("rehype-highlight"), 1);
|
|
233
223
|
|
|
234
224
|
// src/lib/chatUtils.ts
|
|
235
|
-
var chatUtils = {
|
|
236
|
-
generateId: () => globalThis.crypto?.randomUUID?.() ?? `id-${Date.now()}-${Math.random().toString(36).slice(2, 10)}`,
|
|
237
|
-
generateMessageId: () => chatUtils.generateId(),
|
|
238
|
-
generateThreadId: () => chatUtils.generateId(),
|
|
239
|
-
createMessage: (role, content, attachments) => ({
|
|
240
|
-
id: chatUtils.generateMessageId(),
|
|
241
|
-
role,
|
|
242
|
-
content,
|
|
243
|
-
timestamp: Date.now(),
|
|
244
|
-
attachments,
|
|
245
|
-
isComplete: true
|
|
246
|
-
}),
|
|
247
|
-
createThread: (title) => ({
|
|
248
|
-
id: chatUtils.generateThreadId(),
|
|
249
|
-
title,
|
|
250
|
-
createdAt: Date.now(),
|
|
251
|
-
updatedAt: Date.now(),
|
|
252
|
-
messageCount: 0
|
|
253
|
-
}),
|
|
254
|
-
generateThreadTitle: (firstMessage) => {
|
|
255
|
-
const cleaned = firstMessage.replace(/[^\w\s]/g, "").trim();
|
|
256
|
-
const words = cleaned.split(/\s+/).slice(0, 6);
|
|
257
|
-
return words.join(" ") || "Nova Conversa";
|
|
258
|
-
}
|
|
259
|
-
};
|
|
260
225
|
var AGENT_COLORS = [
|
|
261
226
|
"#6366f1",
|
|
262
227
|
// indigo
|
|
@@ -310,24 +275,6 @@ var import_tailwind_merge = require("tailwind-merge");
|
|
|
310
275
|
function cn(...inputs) {
|
|
311
276
|
return (0, import_tailwind_merge.twMerge)((0, import_clsx.clsx)(inputs));
|
|
312
277
|
}
|
|
313
|
-
var formatDate = (timestamp, labels) => {
|
|
314
|
-
const date = new Date(timestamp);
|
|
315
|
-
const now = /* @__PURE__ */ new Date();
|
|
316
|
-
const diffMs = now.getTime() - date.getTime();
|
|
317
|
-
const diffDays = Math.floor(diffMs / (1e3 * 60 * 60 * 24));
|
|
318
|
-
if (diffDays === 0) {
|
|
319
|
-
return labels?.today || "Today";
|
|
320
|
-
} else if (diffDays === 1) {
|
|
321
|
-
return labels?.yesterday || "Yesterday";
|
|
322
|
-
} else if (diffDays < 7) {
|
|
323
|
-
return `${diffDays} ${labels?.daysAgo || "days ago"}`;
|
|
324
|
-
} else {
|
|
325
|
-
return date.toLocaleDateString("en-US", {
|
|
326
|
-
day: "2-digit",
|
|
327
|
-
month: "short"
|
|
328
|
-
});
|
|
329
|
-
}
|
|
330
|
-
};
|
|
331
278
|
var createObjectUrlFromDataUrl = (dataUrl) => {
|
|
332
279
|
const match = dataUrl.match(/^data:(.+?);base64,(.+)$/s);
|
|
333
280
|
if (!match) {
|
|
@@ -478,59 +425,10 @@ function Badge({
|
|
|
478
425
|
);
|
|
479
426
|
}
|
|
480
427
|
|
|
481
|
-
// src/components/ui/card.tsx
|
|
482
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
483
|
-
function Card({ className, ...props }) {
|
|
484
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
485
|
-
"div",
|
|
486
|
-
{
|
|
487
|
-
"data-slot": "card",
|
|
488
|
-
className: cn(
|
|
489
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
490
|
-
className
|
|
491
|
-
),
|
|
492
|
-
...props
|
|
493
|
-
}
|
|
494
|
-
);
|
|
495
|
-
}
|
|
496
|
-
function CardHeader({ className, ...props }) {
|
|
497
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
498
|
-
"div",
|
|
499
|
-
{
|
|
500
|
-
"data-slot": "card-header",
|
|
501
|
-
className: cn(
|
|
502
|
-
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
503
|
-
className
|
|
504
|
-
),
|
|
505
|
-
...props
|
|
506
|
-
}
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
function CardTitle({ className, ...props }) {
|
|
510
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
511
|
-
"div",
|
|
512
|
-
{
|
|
513
|
-
"data-slot": "card-title",
|
|
514
|
-
className: cn("leading-none font-semibold", className),
|
|
515
|
-
...props
|
|
516
|
-
}
|
|
517
|
-
);
|
|
518
|
-
}
|
|
519
|
-
function CardContent({ className, ...props }) {
|
|
520
|
-
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
521
|
-
"div",
|
|
522
|
-
{
|
|
523
|
-
"data-slot": "card-content",
|
|
524
|
-
className: cn("px-6", className),
|
|
525
|
-
...props
|
|
526
|
-
}
|
|
527
|
-
);
|
|
528
|
-
}
|
|
529
|
-
|
|
530
428
|
// src/components/ui/textarea.tsx
|
|
531
|
-
var
|
|
429
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
532
430
|
function Textarea({ className, ...props }) {
|
|
533
|
-
return /* @__PURE__ */ (0,
|
|
431
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
534
432
|
"textarea",
|
|
535
433
|
{
|
|
536
434
|
"data-slot": "textarea",
|
|
@@ -545,12 +443,12 @@ function Textarea({ className, ...props }) {
|
|
|
545
443
|
|
|
546
444
|
// src/components/ui/tooltip.tsx
|
|
547
445
|
var TooltipPrimitive = __toESM(require("@radix-ui/react-tooltip"), 1);
|
|
548
|
-
var
|
|
446
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
549
447
|
function TooltipProvider({
|
|
550
448
|
delayDuration = 0,
|
|
551
449
|
...props
|
|
552
450
|
}) {
|
|
553
|
-
return /* @__PURE__ */ (0,
|
|
451
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
554
452
|
TooltipPrimitive.Provider,
|
|
555
453
|
{
|
|
556
454
|
"data-slot": "tooltip-provider",
|
|
@@ -562,12 +460,12 @@ function TooltipProvider({
|
|
|
562
460
|
function Tooltip({
|
|
563
461
|
...props
|
|
564
462
|
}) {
|
|
565
|
-
return /* @__PURE__ */ (0,
|
|
463
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
566
464
|
}
|
|
567
465
|
function TooltipTrigger({
|
|
568
466
|
...props
|
|
569
467
|
}) {
|
|
570
|
-
return /* @__PURE__ */ (0,
|
|
468
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
571
469
|
}
|
|
572
470
|
function TooltipContent({
|
|
573
471
|
className,
|
|
@@ -575,7 +473,7 @@ function TooltipContent({
|
|
|
575
473
|
children,
|
|
576
474
|
...props
|
|
577
475
|
}) {
|
|
578
|
-
return /* @__PURE__ */ (0,
|
|
476
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
579
477
|
TooltipPrimitive.Content,
|
|
580
478
|
{
|
|
581
479
|
"data-slot": "tooltip-content",
|
|
@@ -587,79 +485,198 @@ function TooltipContent({
|
|
|
587
485
|
...props,
|
|
588
486
|
children: [
|
|
589
487
|
children,
|
|
590
|
-
/* @__PURE__ */ (0,
|
|
488
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
591
489
|
]
|
|
592
490
|
}
|
|
593
491
|
) });
|
|
594
492
|
}
|
|
595
493
|
|
|
596
|
-
// src/components/chat/
|
|
597
|
-
var
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
494
|
+
// src/components/chat/AssistantActivity.tsx
|
|
495
|
+
var import_react = require("react");
|
|
496
|
+
|
|
497
|
+
// src/components/ui/card.tsx
|
|
498
|
+
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
499
|
+
function Card({ className, ...props }) {
|
|
500
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
501
|
+
"div",
|
|
502
|
+
{
|
|
503
|
+
"data-slot": "card",
|
|
504
|
+
className: cn(
|
|
505
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
506
|
+
className
|
|
608
507
|
),
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
508
|
+
...props
|
|
509
|
+
}
|
|
510
|
+
);
|
|
511
|
+
}
|
|
512
|
+
function CardHeader({ className, ...props }) {
|
|
513
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
514
|
+
"div",
|
|
515
|
+
{
|
|
516
|
+
"data-slot": "card-header",
|
|
517
|
+
className: cn(
|
|
518
|
+
"@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",
|
|
519
|
+
className
|
|
615
520
|
),
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
521
|
+
...props
|
|
522
|
+
}
|
|
523
|
+
);
|
|
524
|
+
}
|
|
525
|
+
function CardContent({ className, ...props }) {
|
|
526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
527
|
+
"div",
|
|
528
|
+
{
|
|
529
|
+
"data-slot": "card-content",
|
|
530
|
+
className: cn("px-6", className),
|
|
531
|
+
...props
|
|
532
|
+
}
|
|
533
|
+
);
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
// src/components/ui/collapsible.tsx
|
|
537
|
+
var CollapsiblePrimitive = __toESM(require("@radix-ui/react-collapsible"), 1);
|
|
538
|
+
var Collapsible = CollapsiblePrimitive.Root;
|
|
539
|
+
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
540
|
+
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
541
|
+
|
|
542
|
+
// src/components/chat/AssistantActivity.tsx
|
|
543
|
+
var import_lucide_react = require("lucide-react");
|
|
544
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
545
|
+
var interpolate = (template, replacements) => Object.entries(replacements).reduce(
|
|
546
|
+
(output, [key, value]) => output.replaceAll(`{{${key}}}`, String(value ?? "")),
|
|
547
|
+
template
|
|
548
|
+
);
|
|
549
|
+
var resolveSummaryLabel = (activity, labels) => {
|
|
550
|
+
const summary = activity.summary;
|
|
551
|
+
if (summary.kind === "using_tools") {
|
|
552
|
+
if (summary.toolName) {
|
|
553
|
+
return interpolate(labels?.activityToolRunning || "Using {{tool}}...", {
|
|
554
|
+
tool: summary.toolName
|
|
555
|
+
});
|
|
556
|
+
}
|
|
557
|
+
if (typeof summary.toolCount === "number" && summary.toolCount > 1) {
|
|
558
|
+
return interpolate(labels?.activityMultipleTools || "Using {{count}} tools...", {
|
|
559
|
+
count: summary.toolCount
|
|
560
|
+
});
|
|
561
|
+
}
|
|
562
|
+
return labels?.activityUsingTools || "Using tools...";
|
|
563
|
+
}
|
|
564
|
+
if (summary.kind === "preparing_answer") {
|
|
565
|
+
return labels?.activityPreparingAnswer || "Preparing answer...";
|
|
566
|
+
}
|
|
567
|
+
if (summary.kind === "working") {
|
|
568
|
+
return labels?.activityWorking || "Working...";
|
|
569
|
+
}
|
|
570
|
+
return labels?.activityThinking || "Thinking...";
|
|
571
|
+
};
|
|
572
|
+
var getStatusIcon = (toolCall) => {
|
|
573
|
+
if (toolCall.status === "failed") {
|
|
574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "destructive", children: "failed" });
|
|
575
|
+
}
|
|
576
|
+
if (toolCall.status === "completed") {
|
|
577
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "secondary", className: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300", children: "done" });
|
|
578
|
+
}
|
|
579
|
+
if (toolCall.status === "running") {
|
|
580
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "secondary", className: "bg-primary/10 text-primary", children: "running" });
|
|
581
|
+
}
|
|
582
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "secondary", children: "pending" });
|
|
583
|
+
};
|
|
584
|
+
var AssistantActivitySkeleton = (0, import_react.memo)(function AssistantActivitySkeleton2() {
|
|
585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "mb-3 flex items-center gap-3 rounded-lg border border-border/50 bg-muted/20 px-3 py-2", children: [
|
|
586
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-1.5", children: [
|
|
587
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/80 animate-pulse" }),
|
|
588
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/60 animate-pulse [animation-delay:120ms]" }),
|
|
589
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "inline-block h-2 w-2 rounded-full bg-primary/40 animate-pulse [animation-delay:240ms]" })
|
|
623
590
|
] }),
|
|
624
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("
|
|
591
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-3 w-28 rounded-full bg-muted animate-pulse" })
|
|
625
592
|
] });
|
|
626
593
|
});
|
|
627
|
-
var
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
const
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
594
|
+
var AssistantActivitySummary = (0, import_react.memo)(function AssistantActivitySummary2({
|
|
595
|
+
activity,
|
|
596
|
+
labels
|
|
597
|
+
}) {
|
|
598
|
+
const summaryLabel = (0, import_react.useMemo)(() => resolveSummaryLabel(activity, labels), [activity, labels]);
|
|
599
|
+
const isActive = activity.isActive;
|
|
600
|
+
const icon = activity.summary.kind === "using_tools" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Wrench, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : activity.summary.kind === "preparing_answer" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Sparkles, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Brain, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") });
|
|
601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: cn(
|
|
602
|
+
"flex items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
603
|
+
isActive ? "border-primary/30 bg-primary/5 text-foreground" : "border-border/60 bg-muted/20 text-muted-foreground"
|
|
604
|
+
), children: [
|
|
605
|
+
icon,
|
|
606
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "min-w-0 flex-1 truncate", children: summaryLabel }),
|
|
607
|
+
isActive && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.LoaderCircle, { className: "h-4 w-4 shrink-0 animate-spin text-primary" })
|
|
608
|
+
] });
|
|
609
|
+
});
|
|
610
|
+
var AssistantActivityDetails = (0, import_react.memo)(function AssistantActivityDetails2({
|
|
611
|
+
activity
|
|
612
|
+
}) {
|
|
613
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-3 pt-3", children: [
|
|
614
|
+
activity.reasoning && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-1", children: [
|
|
615
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Reasoning" }),
|
|
616
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "whitespace-pre-wrap break-words text-sm leading-6 text-muted-foreground", children: activity.reasoning })
|
|
617
|
+
] }),
|
|
618
|
+
Array.isArray(activity.toolCalls) && activity.toolCalls.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
619
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Tools" }),
|
|
620
|
+
activity.toolCalls.map((toolCall) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Card, { className: "border-border/60 bg-background/70", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(CardContent, { className: "space-y-2 px-3 py-3", children: [
|
|
621
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
622
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "truncate text-sm font-medium", children: toolCall.name }) }),
|
|
623
|
+
getStatusIcon(toolCall)
|
|
624
|
+
] }),
|
|
625
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
626
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
627
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Args" }),
|
|
628
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "overflow-x-auto rounded-md bg-muted/70 p-2 text-xs text-muted-foreground", children: JSON.stringify(toolCall.arguments, null, 2) })
|
|
647
629
|
] }),
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
] }) })
|
|
630
|
+
typeof toolCall.result !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
631
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
632
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "overflow-x-auto rounded-md bg-muted/70 p-2 text-xs text-muted-foreground", children: JSON.stringify(toolCall.result, null, 2) })
|
|
633
|
+
] })
|
|
634
|
+
] })
|
|
635
|
+
] }) }, toolCall.id))
|
|
636
|
+
] })
|
|
656
637
|
] });
|
|
657
638
|
});
|
|
639
|
+
var AssistantActivity = (0, import_react.memo)(function AssistantActivity2({
|
|
640
|
+
activity,
|
|
641
|
+
displayMode,
|
|
642
|
+
labels
|
|
643
|
+
}) {
|
|
644
|
+
if (!activity) return null;
|
|
645
|
+
if (displayMode === "hidden") {
|
|
646
|
+
return activity.isActive ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivitySkeleton, {}) : null;
|
|
647
|
+
}
|
|
648
|
+
if (displayMode === "summary") {
|
|
649
|
+
if (!activity.isActive && activity.isComplete) return null;
|
|
650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivitySummary, { activity, labels }) });
|
|
651
|
+
}
|
|
652
|
+
const hasDetails = Boolean(activity.reasoning) || Boolean(activity.toolCalls?.length);
|
|
653
|
+
const defaultOpen = activity.isActive && hasDetails;
|
|
654
|
+
const [open, setOpen] = (0, import_react.useState)(defaultOpen);
|
|
655
|
+
(0, import_react.useEffect)(() => {
|
|
656
|
+
if (activity.isActive && hasDetails) {
|
|
657
|
+
setOpen(true);
|
|
658
|
+
}
|
|
659
|
+
}, [activity.isActive, hasDetails]);
|
|
660
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "mb-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Collapsible, { open, onOpenChange: setOpen, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
661
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
662
|
+
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "min-w-0 flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivitySummary, { activity, labels }) }),
|
|
663
|
+
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Button, { variant: "ghost", size: "sm", className: "h-9 shrink-0 px-2 text-xs text-muted-foreground", children: [
|
|
664
|
+
open ? labels?.activityHideDetails || "Hide details" : labels?.activityShowDetails || "Show details",
|
|
665
|
+
open ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.ChevronDown, { className: "ml-1 h-3.5 w-3.5" }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.ChevronRight, { className: "ml-1 h-3.5 w-3.5" })
|
|
666
|
+
] }) })
|
|
667
|
+
] }),
|
|
668
|
+
hasDetails && /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(CollapsibleContent2, { className: "overflow-hidden rounded-lg border border-border/60 bg-muted/10 px-3", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(AssistantActivityDetails, { activity }) })
|
|
669
|
+
] }) }) });
|
|
670
|
+
});
|
|
671
|
+
|
|
672
|
+
// src/components/chat/Message.tsx
|
|
673
|
+
var import_lucide_react2 = require("lucide-react");
|
|
674
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
658
675
|
var defaultMarkdownComponents = {
|
|
659
676
|
code: ({ node, className, children, ...props }) => {
|
|
660
677
|
const inline = props.inline;
|
|
661
678
|
const match = /language-(\w+)/.exec(className || "");
|
|
662
|
-
return !inline && match ? /* @__PURE__ */ (0,
|
|
679
|
+
return !inline && match ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("pre", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className, ...props, children }) }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("code", { className: "bg-muted px-1 py-0.5 rounded text-sm", ...props, children });
|
|
663
680
|
}
|
|
664
681
|
};
|
|
665
682
|
var remarkPluginsDefault = [import_remark_gfm.default];
|
|
@@ -695,66 +712,64 @@ var getCollapsedPreview = (content, previewChars, previewOverride) => {
|
|
|
695
712
|
}
|
|
696
713
|
return `${content.slice(0, previewChars).trimEnd()}...`;
|
|
697
714
|
};
|
|
698
|
-
var LongContentShell = (0,
|
|
699
|
-
return /* @__PURE__ */ (0,
|
|
715
|
+
var LongContentShell = (0, import_react2.memo)(function LongContentShell2({ children, className, style }) {
|
|
716
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className, style, children });
|
|
700
717
|
});
|
|
701
|
-
var PlainTextContent = (0,
|
|
718
|
+
var PlainTextContent = (0, import_react2.memo)(function PlainTextContent2({
|
|
702
719
|
content,
|
|
703
720
|
className = "",
|
|
704
721
|
chunkSize = 12e3,
|
|
705
722
|
style
|
|
706
723
|
}) {
|
|
707
|
-
const chunks = (0,
|
|
708
|
-
return /* @__PURE__ */ (0,
|
|
724
|
+
const chunks = (0, import_react2.useMemo)(() => getPlainTextChunks(content, chunkSize), [content, chunkSize]);
|
|
725
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
709
726
|
LongContentShell,
|
|
710
727
|
{
|
|
711
728
|
className: `text-sm leading-6 whitespace-pre-wrap break-words ${className}`.trim(),
|
|
712
729
|
style,
|
|
713
|
-
children: chunks.map((chunk, index) => /* @__PURE__ */ (0,
|
|
730
|
+
children: chunks.map((chunk, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_react2.default.Fragment, { children: chunk }, index))
|
|
714
731
|
}
|
|
715
732
|
);
|
|
716
733
|
});
|
|
717
|
-
var StreamingText = (0,
|
|
734
|
+
var StreamingText = (0, import_react2.memo)(function StreamingText2({
|
|
718
735
|
content,
|
|
719
736
|
isStreaming = false,
|
|
720
|
-
thinkingLabel = "Thinking...",
|
|
721
737
|
className = "",
|
|
722
738
|
renderMarkdown = true,
|
|
723
739
|
markdown,
|
|
724
740
|
plainTextChunkChars = 12e3,
|
|
725
|
-
contentStyle
|
|
726
|
-
hideThinkingIndicator = false
|
|
741
|
+
contentStyle
|
|
727
742
|
}) {
|
|
728
743
|
const hasContent = content.trim().length > 0;
|
|
729
744
|
const enableSyntaxHighlight = renderMarkdown && !isStreaming && hasCodeBlocks(content);
|
|
730
|
-
const mergedComponents = (0,
|
|
745
|
+
const mergedComponents = (0, import_react2.useMemo)(
|
|
731
746
|
() => ({
|
|
732
747
|
...defaultMarkdownComponents,
|
|
733
748
|
...markdown?.components
|
|
734
749
|
}),
|
|
735
750
|
[markdown?.components]
|
|
736
751
|
);
|
|
737
|
-
const mergedRemarkPlugins = (0,
|
|
752
|
+
const mergedRemarkPlugins = (0, import_react2.useMemo)(
|
|
738
753
|
() => [
|
|
739
754
|
...remarkPluginsDefault,
|
|
740
755
|
...markdown?.remarkPlugins ?? []
|
|
741
756
|
],
|
|
742
757
|
[markdown?.remarkPlugins]
|
|
743
758
|
);
|
|
744
|
-
const mergedRehypePlugins = (0,
|
|
759
|
+
const mergedRehypePlugins = (0, import_react2.useMemo)(
|
|
745
760
|
() => [
|
|
746
761
|
...enableSyntaxHighlight ? rehypePluginsDefault : rehypePluginsEmpty,
|
|
747
762
|
...markdown?.rehypePlugins ?? []
|
|
748
763
|
],
|
|
749
764
|
[enableSyntaxHighlight, markdown?.rehypePlugins]
|
|
750
765
|
);
|
|
751
|
-
return /* @__PURE__ */ (0,
|
|
752
|
-
hasContent ? renderMarkdown ? /* @__PURE__ */ (0,
|
|
766
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
767
|
+
hasContent ? renderMarkdown ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
753
768
|
LongContentShell,
|
|
754
769
|
{
|
|
755
770
|
className: `prose prose-sm max-w-none dark:prose-invert break-words ${className}`.trim(),
|
|
756
771
|
style: contentStyle,
|
|
757
|
-
children: /* @__PURE__ */ (0,
|
|
772
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
758
773
|
import_react_markdown.default,
|
|
759
774
|
{
|
|
760
775
|
remarkPlugins: mergedRemarkPlugins,
|
|
@@ -764,7 +779,7 @@ var StreamingText = (0, import_react.memo)(function StreamingText2({
|
|
|
764
779
|
}
|
|
765
780
|
)
|
|
766
781
|
}
|
|
767
|
-
) : /* @__PURE__ */ (0,
|
|
782
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
768
783
|
PlainTextContent,
|
|
769
784
|
{
|
|
770
785
|
content,
|
|
@@ -772,13 +787,13 @@ var StreamingText = (0, import_react.memo)(function StreamingText2({
|
|
|
772
787
|
chunkSize: plainTextChunkChars,
|
|
773
788
|
style: contentStyle
|
|
774
789
|
}
|
|
775
|
-
) :
|
|
776
|
-
isStreaming && hasContent && /* @__PURE__ */ (0,
|
|
790
|
+
) : null,
|
|
791
|
+
isStreaming && hasContent && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "inline-block w-2 h-4 bg-primary animate-pulse ml-1" })
|
|
777
792
|
] });
|
|
778
793
|
});
|
|
779
|
-
var MediaRenderer = (0,
|
|
780
|
-
const [audioPlaybackSrc, setAudioPlaybackSrc] = (0,
|
|
781
|
-
(0,
|
|
794
|
+
var MediaRenderer = (0, import_react2.memo)(function MediaRenderer2({ attachment }) {
|
|
795
|
+
const [audioPlaybackSrc, setAudioPlaybackSrc] = (0, import_react2.useState)(attachment.dataUrl);
|
|
796
|
+
(0, import_react2.useEffect)(() => {
|
|
782
797
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
783
798
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
784
799
|
return;
|
|
@@ -801,8 +816,8 @@ var MediaRenderer = (0, import_react.memo)(function MediaRenderer2({ attachment
|
|
|
801
816
|
};
|
|
802
817
|
switch (attachment.kind) {
|
|
803
818
|
case "image":
|
|
804
|
-
return /* @__PURE__ */ (0,
|
|
805
|
-
/* @__PURE__ */ (0,
|
|
819
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative rounded-lg overflow-hidden border bg-muted/20 max-w-md", children: [
|
|
820
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
806
821
|
"img",
|
|
807
822
|
{
|
|
808
823
|
src: attachment.dataUrl,
|
|
@@ -811,21 +826,21 @@ var MediaRenderer = (0, import_react.memo)(function MediaRenderer2({ attachment
|
|
|
811
826
|
loading: "lazy"
|
|
812
827
|
}
|
|
813
828
|
),
|
|
814
|
-
attachment.fileName && /* @__PURE__ */ (0,
|
|
829
|
+
attachment.fileName && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/50 text-white text-xs p-2", children: attachment.fileName })
|
|
815
830
|
] });
|
|
816
831
|
case "audio":
|
|
817
|
-
return /* @__PURE__ */ (0,
|
|
832
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "flex w-full max-w-md py-0 min-w-64 items-center gap-3", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
818
833
|
"audio",
|
|
819
834
|
{
|
|
820
835
|
className: "w-full mt-2",
|
|
821
836
|
preload: "metadata",
|
|
822
837
|
controls: true,
|
|
823
|
-
children: /* @__PURE__ */ (0,
|
|
838
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
824
839
|
}
|
|
825
840
|
) });
|
|
826
841
|
case "video":
|
|
827
|
-
return /* @__PURE__ */ (0,
|
|
828
|
-
/* @__PURE__ */ (0,
|
|
842
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "relative rounded-lg overflow-hidden border bg-muted/20 max-w-lg", children: [
|
|
843
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
829
844
|
"video",
|
|
830
845
|
{
|
|
831
846
|
src: attachment.dataUrl,
|
|
@@ -834,82 +849,12 @@ var MediaRenderer = (0, import_react.memo)(function MediaRenderer2({ attachment
|
|
|
834
849
|
className: "w-full h-auto"
|
|
835
850
|
}
|
|
836
851
|
),
|
|
837
|
-
attachment.fileName && /* @__PURE__ */ (0,
|
|
852
|
+
attachment.fileName && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/50 text-white text-xs p-2", children: attachment.fileName })
|
|
838
853
|
] });
|
|
839
854
|
default:
|
|
840
855
|
return null;
|
|
841
856
|
}
|
|
842
857
|
});
|
|
843
|
-
var ToolCallsDisplay = (0, import_react.memo)(function ToolCallsDisplay2({ toolCalls, label }) {
|
|
844
|
-
const [expandedCall, setExpandedCall] = (0, import_react.useState)(null);
|
|
845
|
-
const getStatusIcon = (status) => {
|
|
846
|
-
switch (status) {
|
|
847
|
-
case "pending":
|
|
848
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Clock, { className: "h-3 w-3 text-muted-foreground" });
|
|
849
|
-
case "running":
|
|
850
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "h-3 w-3 border-2 border-primary border-t-transparent rounded-full animate-spin" });
|
|
851
|
-
case "completed":
|
|
852
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Check, { className: "h-3 w-3 text-green-500" });
|
|
853
|
-
case "failed":
|
|
854
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.X, { className: "h-3 w-3 text-destructive" });
|
|
855
|
-
}
|
|
856
|
-
};
|
|
857
|
-
const getStatusBadgeClasses = (status) => {
|
|
858
|
-
switch (status) {
|
|
859
|
-
case "pending":
|
|
860
|
-
return "bg-muted text-muted-foreground";
|
|
861
|
-
case "running":
|
|
862
|
-
return "bg-blue-100 text-blue-700 dark:bg-blue-900 dark:text-blue-300";
|
|
863
|
-
case "completed":
|
|
864
|
-
return "bg-green-100 text-green-700 dark:bg-green-900 dark:text-green-300";
|
|
865
|
-
case "failed":
|
|
866
|
-
return "bg-red-100 text-red-700 dark:bg-red-900 dark:text-red-300";
|
|
867
|
-
}
|
|
868
|
-
};
|
|
869
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "space-y-2", children: [
|
|
870
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2 text-xs uppercase tracking-wide text-muted-foreground font-semibold", children: [
|
|
871
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_lucide_react.Wrench, { className: "h-3 w-3" }),
|
|
872
|
-
label || "Ferramenta utilizada"
|
|
873
|
-
] }),
|
|
874
|
-
toolCalls.map((call) => {
|
|
875
|
-
const isExpanded = expandedCall === call.id;
|
|
876
|
-
const ToggleIcon = isExpanded ? import_lucide_react.ChevronDown : import_lucide_react.ChevronRight;
|
|
877
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(Card, { className: "border border-dashed border-primary/40 bg-card/60", children: [
|
|
878
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
879
|
-
"button",
|
|
880
|
-
{
|
|
881
|
-
type: "button",
|
|
882
|
-
className: "flex w-full items-center justify-between gap-3 px-3 py-2 text-left",
|
|
883
|
-
onClick: () => setExpandedCall(isExpanded ? null : call.id),
|
|
884
|
-
children: [
|
|
885
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
886
|
-
getStatusIcon(call.status),
|
|
887
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "font-medium text-sm", children: call.name }),
|
|
888
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(Badge, { variant: "secondary", className: getStatusBadgeClasses(call.status), children: call.status })
|
|
889
|
-
] }),
|
|
890
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ToggleIcon, { className: "h-4 w-4 text-muted-foreground" })
|
|
891
|
-
]
|
|
892
|
-
}
|
|
893
|
-
),
|
|
894
|
-
isExpanded && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(CardContent, { className: "pt-0 pb-3 px-3 text-xs space-y-2", children: [
|
|
895
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
896
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "font-medium text-muted-foreground mb-1", children: "Args" }),
|
|
897
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "rounded bg-muted p-2 overflow-x-auto text-xs", children: JSON.stringify(call.arguments, null, 2) })
|
|
898
|
-
] }),
|
|
899
|
-
typeof call.result !== "undefined" && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
|
|
900
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "font-medium text-muted-foreground mb-1", children: "Result" }),
|
|
901
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)("pre", { className: "rounded bg-muted p-2 overflow-x-auto text-xs", children: JSON.stringify(call.result, null, 2) })
|
|
902
|
-
] }),
|
|
903
|
-
call.startTime && call.endTime && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "text-muted-foreground", children: [
|
|
904
|
-
"Executed in ",
|
|
905
|
-
call.endTime - call.startTime,
|
|
906
|
-
"ms"
|
|
907
|
-
] })
|
|
908
|
-
] })
|
|
909
|
-
] }, call.id);
|
|
910
|
-
})
|
|
911
|
-
] });
|
|
912
|
-
});
|
|
913
858
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
914
859
|
if (prevProps.message !== nextProps.message) return false;
|
|
915
860
|
if (prevProps.isUser !== nextProps.isUser) return false;
|
|
@@ -921,11 +866,10 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
921
866
|
if (prevProps.enableCopy !== nextProps.enableCopy) return false;
|
|
922
867
|
if (prevProps.enableEdit !== nextProps.enableEdit) return false;
|
|
923
868
|
if (prevProps.enableRegenerate !== nextProps.enableRegenerate) return false;
|
|
924
|
-
if (prevProps.
|
|
869
|
+
if (prevProps.activityDisplay !== nextProps.activityDisplay) return false;
|
|
925
870
|
if (prevProps.compactMode !== nextProps.compactMode) return false;
|
|
926
871
|
if (prevProps.className !== nextProps.className) return false;
|
|
927
|
-
if (prevProps.
|
|
928
|
-
if (prevProps.thinkingLabel !== nextProps.thinkingLabel) return false;
|
|
872
|
+
if (prevProps.labels !== nextProps.labels) return false;
|
|
929
873
|
if (prevProps.showMoreLabel !== nextProps.showMoreLabel) return false;
|
|
930
874
|
if (prevProps.showLessLabel !== nextProps.showLessLabel) return false;
|
|
931
875
|
if (prevProps.collapseLongMessages !== nextProps.collapseLongMessages) return false;
|
|
@@ -940,7 +884,7 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
940
884
|
if (prevProps.assistantAvatar !== nextProps.assistantAvatar) return false;
|
|
941
885
|
return true;
|
|
942
886
|
};
|
|
943
|
-
var Message = (0,
|
|
887
|
+
var Message = (0, import_react2.memo)(({
|
|
944
888
|
message,
|
|
945
889
|
isUser,
|
|
946
890
|
userAvatar,
|
|
@@ -952,12 +896,11 @@ var Message = (0, import_react.memo)(({
|
|
|
952
896
|
enableCopy = true,
|
|
953
897
|
enableEdit = true,
|
|
954
898
|
enableRegenerate = true,
|
|
955
|
-
|
|
899
|
+
activityDisplay = "full",
|
|
956
900
|
compactMode = false,
|
|
957
901
|
onAction,
|
|
958
902
|
className = "",
|
|
959
|
-
|
|
960
|
-
thinkingLabel = "Thinking...",
|
|
903
|
+
labels,
|
|
961
904
|
showMoreLabel = "Show more",
|
|
962
905
|
showLessLabel = "Show less",
|
|
963
906
|
collapseLongMessages = false,
|
|
@@ -971,10 +914,10 @@ var Message = (0, import_react.memo)(({
|
|
|
971
914
|
isGrouped = false,
|
|
972
915
|
agentOptions = []
|
|
973
916
|
}) => {
|
|
974
|
-
const [isEditing, setIsEditing] = (0,
|
|
975
|
-
const [editContent, setEditContent] = (0,
|
|
976
|
-
const [showActions, setShowActions] = (0,
|
|
977
|
-
const [copied, setCopied] = (0,
|
|
917
|
+
const [isEditing, setIsEditing] = (0, import_react2.useState)(false);
|
|
918
|
+
const [editContent, setEditContent] = (0, import_react2.useState)(message.content);
|
|
919
|
+
const [showActions, setShowActions] = (0, import_react2.useState)(false);
|
|
920
|
+
const [copied, setCopied] = (0, import_react2.useState)(false);
|
|
978
921
|
const messageIsUser = isUser ?? message.role === "user";
|
|
979
922
|
const agentSender = !messageIsUser && message.senderAgentId ? agentOptions.find(
|
|
980
923
|
(a) => a.id === message.senderAgentId || a.name.toLowerCase() === (message.senderAgentId ?? "").toLowerCase() || a.name.toLowerCase() === (message.senderName ?? "").toLowerCase()
|
|
@@ -1034,20 +977,20 @@ var Message = (0, import_react.memo)(({
|
|
|
1034
977
|
minute: "2-digit"
|
|
1035
978
|
});
|
|
1036
979
|
};
|
|
1037
|
-
return /* @__PURE__ */ (0,
|
|
980
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
1038
981
|
"div",
|
|
1039
982
|
{
|
|
1040
983
|
className: `flex w-full flex-col ${className} max-w-[800px] mx-auto`,
|
|
1041
984
|
onMouseEnter: () => setShowActions(true),
|
|
1042
985
|
onMouseLeave: () => setShowActions(false),
|
|
1043
986
|
children: [
|
|
1044
|
-
!isGrouped && /* @__PURE__ */ (0,
|
|
1045
|
-
showAvatar && /* @__PURE__ */ (0,
|
|
1046
|
-
/* @__PURE__ */ (0,
|
|
1047
|
-
/* @__PURE__ */ (0,
|
|
1048
|
-
] }) : agentSender ? /* @__PURE__ */ (0,
|
|
1049
|
-
agentSender.avatarUrl ? /* @__PURE__ */ (0,
|
|
1050
|
-
/* @__PURE__ */ (0,
|
|
987
|
+
!isGrouped && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
988
|
+
showAvatar && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: messageIsUser ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
989
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarImage, { src: userAvatar, alt: userName }),
|
|
990
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarFallback, { className: "bg-primary text-primary-foreground", children: userName.charAt(0).toUpperCase() })
|
|
991
|
+
] }) : agentSender ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
992
|
+
agentSender.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarImage, { src: agentSender.avatarUrl, alt: agentSender.name }) : null,
|
|
993
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1051
994
|
AvatarFallback,
|
|
1052
995
|
{
|
|
1053
996
|
style: agentColor ? { backgroundColor: agentColor, color: "white" } : void 0,
|
|
@@ -1055,9 +998,9 @@ var Message = (0, import_react.memo)(({
|
|
|
1055
998
|
children: getAgentInitials(agentSender.name)
|
|
1056
999
|
}
|
|
1057
1000
|
)
|
|
1058
|
-
] }) : /* @__PURE__ */ (0,
|
|
1059
|
-
/* @__PURE__ */ (0,
|
|
1060
|
-
/* @__PURE__ */ (0,
|
|
1001
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_jsx_runtime8.Fragment, { children: assistantAvatar || /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
|
|
1002
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
1003
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1061
1004
|
"span",
|
|
1062
1005
|
{
|
|
1063
1006
|
className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
|
|
@@ -1065,13 +1008,13 @@ var Message = (0, import_react.memo)(({
|
|
|
1065
1008
|
children: messageIsUser ? userName : resolvedAssistantName
|
|
1066
1009
|
}
|
|
1067
1010
|
),
|
|
1068
|
-
showTimestamp && /* @__PURE__ */ (0,
|
|
1069
|
-
message.isEdited && /* @__PURE__ */ (0,
|
|
1011
|
+
showTimestamp && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
|
|
1012
|
+
message.isEdited && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
1070
1013
|
] })
|
|
1071
1014
|
] }),
|
|
1072
|
-
/* @__PURE__ */ (0,
|
|
1073
|
-
isEditing ? /* @__PURE__ */ (0,
|
|
1074
|
-
/* @__PURE__ */ (0,
|
|
1015
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `relative inline-flex flex-col overflow-hidden text-left ${messageIsUser ? "rounded-lg p-3 bg-primary text-primary-foreground ml-auto max-w-[85%]" : "max-w-full"}`, children: [
|
|
1016
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "space-y-2", children: [
|
|
1017
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1075
1018
|
Textarea,
|
|
1076
1019
|
{
|
|
1077
1020
|
value: editContent,
|
|
@@ -1080,40 +1023,37 @@ var Message = (0, import_react.memo)(({
|
|
|
1080
1023
|
autoFocus: true
|
|
1081
1024
|
}
|
|
1082
1025
|
),
|
|
1083
|
-
/* @__PURE__ */ (0,
|
|
1084
|
-
/* @__PURE__ */ (0,
|
|
1085
|
-
/* @__PURE__ */ (0,
|
|
1026
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "flex gap-2 justify-end", children: [
|
|
1027
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { variant: "outline", size: "sm", onClick: handleCancelEdit, children: [
|
|
1028
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.X, { className: "h-4 w-4 mr-1" }),
|
|
1086
1029
|
"Cancelar"
|
|
1087
1030
|
] }),
|
|
1088
|
-
/* @__PURE__ */ (0,
|
|
1089
|
-
/* @__PURE__ */ (0,
|
|
1031
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Button, { size: "sm", onClick: handleEdit, children: [
|
|
1032
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { className: "h-4 w-4 mr-1" }),
|
|
1090
1033
|
"Salvar"
|
|
1091
1034
|
] })
|
|
1092
1035
|
] })
|
|
1093
|
-
] }) : /* @__PURE__ */ (0,
|
|
1094
|
-
!messageIsUser &&
|
|
1095
|
-
|
|
1036
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
1037
|
+
!messageIsUser && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1038
|
+
AssistantActivity,
|
|
1096
1039
|
{
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1040
|
+
activity: message.activity,
|
|
1041
|
+
displayMode: activityDisplay,
|
|
1042
|
+
labels
|
|
1100
1043
|
}
|
|
1101
1044
|
),
|
|
1102
|
-
|
|
1103
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
1045
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1104
1046
|
StreamingText,
|
|
1105
1047
|
{
|
|
1106
1048
|
content: contentToRender,
|
|
1107
1049
|
isStreaming: message.isStreaming,
|
|
1108
|
-
thinkingLabel,
|
|
1109
1050
|
renderMarkdown: shouldRenderMarkdown,
|
|
1110
1051
|
markdown,
|
|
1111
1052
|
plainTextChunkChars: normalizedChunkChars,
|
|
1112
|
-
contentStyle
|
|
1113
|
-
hideThinkingIndicator: !!message.reasoning
|
|
1053
|
+
contentStyle
|
|
1114
1054
|
}
|
|
1115
1055
|
),
|
|
1116
|
-
canCollapseMessage && /* @__PURE__ */ (0,
|
|
1056
|
+
canCollapseMessage && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mt-3", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1117
1057
|
Button,
|
|
1118
1058
|
{
|
|
1119
1059
|
type: "button",
|
|
@@ -1125,47 +1065,47 @@ var Message = (0, import_react.memo)(({
|
|
|
1125
1065
|
children: isCollapsed ? showMoreLabel : showLessLabel
|
|
1126
1066
|
}
|
|
1127
1067
|
) }),
|
|
1128
|
-
message.attachments && message.attachments.length > 0 && /* @__PURE__ */ (0,
|
|
1068
|
+
message.attachments && message.attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "mt-3 space-y-2", children: message.attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(MediaRenderer, { attachment }, index)) })
|
|
1129
1069
|
] }),
|
|
1130
|
-
!isEditing && (showActions || copied) && /* @__PURE__ */ (0,
|
|
1131
|
-
enableCopy && /* @__PURE__ */ (0,
|
|
1132
|
-
/* @__PURE__ */ (0,
|
|
1070
|
+
!isEditing && (showActions || copied) && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: `absolute -top-2 flex gap-1 ${messageIsUser ? "-left-2" : "-right-2"}`, children: [
|
|
1071
|
+
enableCopy && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tooltip, { children: [
|
|
1072
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1133
1073
|
Button,
|
|
1134
1074
|
{
|
|
1135
1075
|
variant: "secondary",
|
|
1136
1076
|
size: "icon",
|
|
1137
1077
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1138
1078
|
onClick: handleCopy,
|
|
1139
|
-
children: copied ? /* @__PURE__ */ (0,
|
|
1079
|
+
children: copied ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Check, { className: "h-3 w-3 text-green-500" }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Copy, { className: "h-3 w-3" })
|
|
1140
1080
|
}
|
|
1141
1081
|
) }),
|
|
1142
|
-
/* @__PURE__ */ (0,
|
|
1082
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipContent, { children: copied ? "Copiado!" : "Copiar" })
|
|
1143
1083
|
] }),
|
|
1144
|
-
canEdit && /* @__PURE__ */ (0,
|
|
1145
|
-
/* @__PURE__ */ (0,
|
|
1084
|
+
canEdit && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tooltip, { children: [
|
|
1085
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1146
1086
|
Button,
|
|
1147
1087
|
{
|
|
1148
1088
|
variant: "secondary",
|
|
1149
1089
|
size: "icon",
|
|
1150
1090
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1151
1091
|
onClick: handleEdit,
|
|
1152
|
-
children: /* @__PURE__ */ (0,
|
|
1092
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.Edit, { className: "h-3 w-3" })
|
|
1153
1093
|
}
|
|
1154
1094
|
) }),
|
|
1155
|
-
/* @__PURE__ */ (0,
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipContent, { children: "Editar" })
|
|
1156
1096
|
] }),
|
|
1157
|
-
canRegenerate && /* @__PURE__ */ (0,
|
|
1158
|
-
/* @__PURE__ */ (0,
|
|
1097
|
+
canRegenerate && /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(Tooltip, { children: [
|
|
1098
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
1159
1099
|
Button,
|
|
1160
1100
|
{
|
|
1161
1101
|
variant: "secondary",
|
|
1162
1102
|
size: "icon",
|
|
1163
1103
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
1164
1104
|
onClick: handleRegenerate,
|
|
1165
|
-
children: /* @__PURE__ */ (0,
|
|
1105
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_lucide_react2.RotateCcw, { className: "h-3 w-3" })
|
|
1166
1106
|
}
|
|
1167
1107
|
) }),
|
|
1168
|
-
/* @__PURE__ */ (0,
|
|
1108
|
+
/* @__PURE__ */ (0, import_jsx_runtime8.jsx)(TooltipContent, { children: "Regenerar" })
|
|
1169
1109
|
] })
|
|
1170
1110
|
] })
|
|
1171
1111
|
] }) })
|
|
@@ -1175,12 +1115,12 @@ var Message = (0, import_react.memo)(({
|
|
|
1175
1115
|
}, arePropsEqual);
|
|
1176
1116
|
|
|
1177
1117
|
// src/components/chat/Sidebar.tsx
|
|
1178
|
-
var
|
|
1118
|
+
var import_react3 = require("react");
|
|
1179
1119
|
|
|
1180
1120
|
// src/components/ui/input.tsx
|
|
1181
|
-
var
|
|
1121
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
1182
1122
|
function Input({ className, type, ...props }) {
|
|
1183
|
-
return /* @__PURE__ */ (0,
|
|
1123
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
|
|
1184
1124
|
"input",
|
|
1185
1125
|
{
|
|
1186
1126
|
type,
|
|
@@ -1197,17 +1137,17 @@ function Input({ className, type, ...props }) {
|
|
|
1197
1137
|
}
|
|
1198
1138
|
|
|
1199
1139
|
// src/components/ui/sidebar.tsx
|
|
1200
|
-
var
|
|
1140
|
+
var React5 = __toESM(require("react"), 1);
|
|
1201
1141
|
var import_react_slot3 = require("@radix-ui/react-slot");
|
|
1202
1142
|
var import_class_variance_authority3 = require("class-variance-authority");
|
|
1203
|
-
var
|
|
1143
|
+
var import_lucide_react4 = require("lucide-react");
|
|
1204
1144
|
|
|
1205
1145
|
// src/hooks/use-mobile.ts
|
|
1206
|
-
var
|
|
1146
|
+
var React3 = __toESM(require("react"), 1);
|
|
1207
1147
|
var MOBILE_BREAKPOINT = 768;
|
|
1208
1148
|
function useIsMobile() {
|
|
1209
|
-
const [isMobile, setIsMobile] =
|
|
1210
|
-
|
|
1149
|
+
const [isMobile, setIsMobile] = React3.useState(void 0);
|
|
1150
|
+
React3.useEffect(() => {
|
|
1211
1151
|
const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
|
|
1212
1152
|
const onChange = () => {
|
|
1213
1153
|
setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
|
|
@@ -1221,14 +1161,14 @@ function useIsMobile() {
|
|
|
1221
1161
|
|
|
1222
1162
|
// src/components/ui/separator.tsx
|
|
1223
1163
|
var SeparatorPrimitive = __toESM(require("@radix-ui/react-separator"), 1);
|
|
1224
|
-
var
|
|
1164
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1225
1165
|
function Separator({
|
|
1226
1166
|
className,
|
|
1227
1167
|
orientation = "horizontal",
|
|
1228
1168
|
decorative = true,
|
|
1229
1169
|
...props
|
|
1230
1170
|
}) {
|
|
1231
|
-
return /* @__PURE__ */ (0,
|
|
1171
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
1232
1172
|
SeparatorPrimitive.Root,
|
|
1233
1173
|
{
|
|
1234
1174
|
"data-slot": "separator",
|
|
@@ -1244,41 +1184,41 @@ function Separator({
|
|
|
1244
1184
|
}
|
|
1245
1185
|
|
|
1246
1186
|
// src/components/ui/sheet.tsx
|
|
1247
|
-
var
|
|
1187
|
+
var React4 = __toESM(require("react"), 1);
|
|
1248
1188
|
var SheetPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1249
|
-
var
|
|
1250
|
-
var
|
|
1189
|
+
var import_lucide_react3 = require("lucide-react");
|
|
1190
|
+
var import_jsx_runtime11 = require("react/jsx-runtime");
|
|
1251
1191
|
function cleanupBodyStyles() {
|
|
1252
1192
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1253
1193
|
document.body.style.pointerEvents = "";
|
|
1254
1194
|
}
|
|
1255
1195
|
}
|
|
1256
1196
|
function Sheet({ open, onOpenChange, ...props }) {
|
|
1257
|
-
const prevOpenRef =
|
|
1258
|
-
|
|
1197
|
+
const prevOpenRef = React4.useRef(open);
|
|
1198
|
+
React4.useEffect(() => {
|
|
1259
1199
|
if (prevOpenRef.current === true && open === false) {
|
|
1260
1200
|
const timeout = setTimeout(cleanupBodyStyles, 350);
|
|
1261
1201
|
return () => clearTimeout(timeout);
|
|
1262
1202
|
}
|
|
1263
1203
|
prevOpenRef.current = open;
|
|
1264
1204
|
}, [open]);
|
|
1265
|
-
|
|
1205
|
+
React4.useEffect(() => {
|
|
1266
1206
|
return () => {
|
|
1267
1207
|
cleanupBodyStyles();
|
|
1268
1208
|
};
|
|
1269
1209
|
}, []);
|
|
1270
|
-
return /* @__PURE__ */ (0,
|
|
1210
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SheetPrimitive.Root, { "data-slot": "sheet", open, onOpenChange, ...props });
|
|
1271
1211
|
}
|
|
1272
1212
|
function SheetPortal({
|
|
1273
1213
|
...props
|
|
1274
1214
|
}) {
|
|
1275
|
-
return /* @__PURE__ */ (0,
|
|
1215
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SheetPrimitive.Portal, { "data-slot": "sheet-portal", ...props });
|
|
1276
1216
|
}
|
|
1277
1217
|
function SheetOverlay({
|
|
1278
1218
|
className,
|
|
1279
1219
|
...props
|
|
1280
1220
|
}) {
|
|
1281
|
-
return /* @__PURE__ */ (0,
|
|
1221
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1282
1222
|
SheetPrimitive.Overlay,
|
|
1283
1223
|
{
|
|
1284
1224
|
"data-slot": "sheet-overlay",
|
|
@@ -1299,9 +1239,9 @@ function SheetContent({
|
|
|
1299
1239
|
side = "right",
|
|
1300
1240
|
...props
|
|
1301
1241
|
}) {
|
|
1302
|
-
return /* @__PURE__ */ (0,
|
|
1303
|
-
/* @__PURE__ */ (0,
|
|
1304
|
-
/* @__PURE__ */ (0,
|
|
1242
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(SheetPortal, { children: [
|
|
1243
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(SheetOverlay, {}),
|
|
1244
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
|
|
1305
1245
|
SheetPrimitive.Content,
|
|
1306
1246
|
{
|
|
1307
1247
|
"data-slot": "sheet-content",
|
|
@@ -1317,9 +1257,9 @@ function SheetContent({
|
|
|
1317
1257
|
...props,
|
|
1318
1258
|
children: [
|
|
1319
1259
|
children,
|
|
1320
|
-
/* @__PURE__ */ (0,
|
|
1321
|
-
/* @__PURE__ */ (0,
|
|
1322
|
-
/* @__PURE__ */ (0,
|
|
1260
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(SheetPrimitive.Close, { className: "ring-offset-background focus:ring-ring data-[state=open]:bg-secondary absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none", children: [
|
|
1261
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_lucide_react3.XIcon, { className: "size-4" }),
|
|
1262
|
+
/* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1323
1263
|
] })
|
|
1324
1264
|
]
|
|
1325
1265
|
}
|
|
@@ -1327,7 +1267,7 @@ function SheetContent({
|
|
|
1327
1267
|
] });
|
|
1328
1268
|
}
|
|
1329
1269
|
function SheetHeader({ className, ...props }) {
|
|
1330
|
-
return /* @__PURE__ */ (0,
|
|
1270
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1331
1271
|
"div",
|
|
1332
1272
|
{
|
|
1333
1273
|
"data-slot": "sheet-header",
|
|
@@ -1340,7 +1280,7 @@ function SheetTitle({
|
|
|
1340
1280
|
className,
|
|
1341
1281
|
...props
|
|
1342
1282
|
}) {
|
|
1343
|
-
return /* @__PURE__ */ (0,
|
|
1283
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1344
1284
|
SheetPrimitive.Title,
|
|
1345
1285
|
{
|
|
1346
1286
|
"data-slot": "sheet-title",
|
|
@@ -1353,7 +1293,7 @@ function SheetDescription({
|
|
|
1353
1293
|
className,
|
|
1354
1294
|
...props
|
|
1355
1295
|
}) {
|
|
1356
|
-
return /* @__PURE__ */ (0,
|
|
1296
|
+
return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
|
|
1357
1297
|
SheetPrimitive.Description,
|
|
1358
1298
|
{
|
|
1359
1299
|
"data-slot": "sheet-description",
|
|
@@ -1364,9 +1304,9 @@ function SheetDescription({
|
|
|
1364
1304
|
}
|
|
1365
1305
|
|
|
1366
1306
|
// src/components/ui/skeleton.tsx
|
|
1367
|
-
var
|
|
1307
|
+
var import_jsx_runtime12 = require("react/jsx-runtime");
|
|
1368
1308
|
function Skeleton({ className, ...props }) {
|
|
1369
|
-
return /* @__PURE__ */ (0,
|
|
1309
|
+
return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
|
|
1370
1310
|
"div",
|
|
1371
1311
|
{
|
|
1372
1312
|
"data-slot": "skeleton",
|
|
@@ -1377,16 +1317,16 @@ function Skeleton({ className, ...props }) {
|
|
|
1377
1317
|
}
|
|
1378
1318
|
|
|
1379
1319
|
// src/components/ui/sidebar.tsx
|
|
1380
|
-
var
|
|
1320
|
+
var import_jsx_runtime13 = require("react/jsx-runtime");
|
|
1381
1321
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1382
1322
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1383
1323
|
var SIDEBAR_WIDTH = "16rem";
|
|
1384
1324
|
var SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
1385
1325
|
var SIDEBAR_WIDTH_ICON = "3rem";
|
|
1386
1326
|
var SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
1387
|
-
var SidebarContext =
|
|
1327
|
+
var SidebarContext = React5.createContext(null);
|
|
1388
1328
|
function useSidebar() {
|
|
1389
|
-
const context =
|
|
1329
|
+
const context = React5.useContext(SidebarContext);
|
|
1390
1330
|
if (!context) {
|
|
1391
1331
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
1392
1332
|
}
|
|
@@ -1402,10 +1342,10 @@ function SidebarProvider({
|
|
|
1402
1342
|
...props
|
|
1403
1343
|
}) {
|
|
1404
1344
|
const isMobile = useIsMobile();
|
|
1405
|
-
const [openMobile, setOpenMobile] =
|
|
1406
|
-
const [_open, _setOpen] =
|
|
1345
|
+
const [openMobile, setOpenMobile] = React5.useState(false);
|
|
1346
|
+
const [_open, _setOpen] = React5.useState(defaultOpen);
|
|
1407
1347
|
const open = openProp ?? _open;
|
|
1408
|
-
const setOpen =
|
|
1348
|
+
const setOpen = React5.useCallback(
|
|
1409
1349
|
(value) => {
|
|
1410
1350
|
const openState = typeof value === "function" ? value(open) : value;
|
|
1411
1351
|
if (setOpenProp) {
|
|
@@ -1417,10 +1357,10 @@ function SidebarProvider({
|
|
|
1417
1357
|
},
|
|
1418
1358
|
[setOpenProp, open]
|
|
1419
1359
|
);
|
|
1420
|
-
const toggleSidebar =
|
|
1360
|
+
const toggleSidebar = React5.useCallback(() => {
|
|
1421
1361
|
return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
|
|
1422
1362
|
}, [isMobile, setOpen, setOpenMobile]);
|
|
1423
|
-
|
|
1363
|
+
React5.useEffect(() => {
|
|
1424
1364
|
const handleKeyDown = (event) => {
|
|
1425
1365
|
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
1426
1366
|
event.preventDefault();
|
|
@@ -1431,7 +1371,7 @@ function SidebarProvider({
|
|
|
1431
1371
|
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
1432
1372
|
}, [toggleSidebar]);
|
|
1433
1373
|
const state = open ? "expanded" : "collapsed";
|
|
1434
|
-
const contextValue =
|
|
1374
|
+
const contextValue = React5.useMemo(
|
|
1435
1375
|
() => ({
|
|
1436
1376
|
state,
|
|
1437
1377
|
open,
|
|
@@ -1443,7 +1383,7 @@ function SidebarProvider({
|
|
|
1443
1383
|
}),
|
|
1444
1384
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
1445
1385
|
);
|
|
1446
|
-
return /* @__PURE__ */ (0,
|
|
1386
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1447
1387
|
"div",
|
|
1448
1388
|
{
|
|
1449
1389
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1471,7 +1411,7 @@ function Sidebar({
|
|
|
1471
1411
|
}) {
|
|
1472
1412
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1473
1413
|
if (collapsible === "none") {
|
|
1474
|
-
return /* @__PURE__ */ (0,
|
|
1414
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1475
1415
|
"div",
|
|
1476
1416
|
{
|
|
1477
1417
|
"data-slot": "sidebar",
|
|
@@ -1485,7 +1425,7 @@ function Sidebar({
|
|
|
1485
1425
|
);
|
|
1486
1426
|
}
|
|
1487
1427
|
if (isMobile) {
|
|
1488
|
-
return /* @__PURE__ */ (0,
|
|
1428
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1489
1429
|
SheetContent,
|
|
1490
1430
|
{
|
|
1491
1431
|
"data-sidebar": "sidebar",
|
|
@@ -1497,16 +1437,16 @@ function Sidebar({
|
|
|
1497
1437
|
},
|
|
1498
1438
|
side,
|
|
1499
1439
|
children: [
|
|
1500
|
-
/* @__PURE__ */ (0,
|
|
1501
|
-
/* @__PURE__ */ (0,
|
|
1502
|
-
/* @__PURE__ */ (0,
|
|
1440
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(SheetHeader, { className: "sr-only", children: [
|
|
1441
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SheetTitle, { children: "Sidebar" }),
|
|
1442
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1503
1443
|
] }),
|
|
1504
|
-
/* @__PURE__ */ (0,
|
|
1444
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "flex h-full w-full flex-col", children })
|
|
1505
1445
|
]
|
|
1506
1446
|
}
|
|
1507
1447
|
) });
|
|
1508
1448
|
}
|
|
1509
|
-
return /* @__PURE__ */ (0,
|
|
1449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1510
1450
|
"div",
|
|
1511
1451
|
{
|
|
1512
1452
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -1516,7 +1456,7 @@ function Sidebar({
|
|
|
1516
1456
|
"data-side": side,
|
|
1517
1457
|
"data-slot": "sidebar",
|
|
1518
1458
|
children: [
|
|
1519
|
-
/* @__PURE__ */ (0,
|
|
1459
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1520
1460
|
"div",
|
|
1521
1461
|
{
|
|
1522
1462
|
"data-slot": "sidebar-gap",
|
|
@@ -1528,7 +1468,7 @@ function Sidebar({
|
|
|
1528
1468
|
)
|
|
1529
1469
|
}
|
|
1530
1470
|
),
|
|
1531
|
-
/* @__PURE__ */ (0,
|
|
1471
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1532
1472
|
"div",
|
|
1533
1473
|
{
|
|
1534
1474
|
"data-slot": "sidebar-container",
|
|
@@ -1540,7 +1480,7 @@ function Sidebar({
|
|
|
1540
1480
|
className
|
|
1541
1481
|
),
|
|
1542
1482
|
...props,
|
|
1543
|
-
children: /* @__PURE__ */ (0,
|
|
1483
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1544
1484
|
"div",
|
|
1545
1485
|
{
|
|
1546
1486
|
"data-sidebar": "sidebar",
|
|
@@ -1561,7 +1501,7 @@ function SidebarTrigger({
|
|
|
1561
1501
|
...props
|
|
1562
1502
|
}) {
|
|
1563
1503
|
const { toggleSidebar } = useSidebar();
|
|
1564
|
-
return /* @__PURE__ */ (0,
|
|
1504
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
|
|
1565
1505
|
Button,
|
|
1566
1506
|
{
|
|
1567
1507
|
"data-sidebar": "trigger",
|
|
@@ -1575,15 +1515,15 @@ function SidebarTrigger({
|
|
|
1575
1515
|
},
|
|
1576
1516
|
...props,
|
|
1577
1517
|
children: [
|
|
1578
|
-
/* @__PURE__ */ (0,
|
|
1579
|
-
/* @__PURE__ */ (0,
|
|
1518
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(import_lucide_react4.PanelLeftIcon, {}),
|
|
1519
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1580
1520
|
]
|
|
1581
1521
|
}
|
|
1582
1522
|
);
|
|
1583
1523
|
}
|
|
1584
1524
|
function SidebarRail({ className, ...props }) {
|
|
1585
1525
|
const { toggleSidebar } = useSidebar();
|
|
1586
|
-
return /* @__PURE__ */ (0,
|
|
1526
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1587
1527
|
"button",
|
|
1588
1528
|
{
|
|
1589
1529
|
"data-sidebar": "rail",
|
|
@@ -1606,7 +1546,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
1606
1546
|
);
|
|
1607
1547
|
}
|
|
1608
1548
|
function SidebarInset({ className, ...props }) {
|
|
1609
|
-
return /* @__PURE__ */ (0,
|
|
1549
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1610
1550
|
"main",
|
|
1611
1551
|
{
|
|
1612
1552
|
"data-slot": "sidebar-inset",
|
|
@@ -1620,7 +1560,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
1620
1560
|
);
|
|
1621
1561
|
}
|
|
1622
1562
|
function SidebarHeader({ className, ...props }) {
|
|
1623
|
-
return /* @__PURE__ */ (0,
|
|
1563
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1624
1564
|
"div",
|
|
1625
1565
|
{
|
|
1626
1566
|
"data-slot": "sidebar-header",
|
|
@@ -1631,7 +1571,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
1631
1571
|
);
|
|
1632
1572
|
}
|
|
1633
1573
|
function SidebarFooter({ className, ...props }) {
|
|
1634
|
-
return /* @__PURE__ */ (0,
|
|
1574
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1635
1575
|
"div",
|
|
1636
1576
|
{
|
|
1637
1577
|
"data-slot": "sidebar-footer",
|
|
@@ -1642,7 +1582,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
1642
1582
|
);
|
|
1643
1583
|
}
|
|
1644
1584
|
function SidebarContent({ className, ...props }) {
|
|
1645
|
-
return /* @__PURE__ */ (0,
|
|
1585
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1646
1586
|
"div",
|
|
1647
1587
|
{
|
|
1648
1588
|
"data-slot": "sidebar-content",
|
|
@@ -1656,7 +1596,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
1656
1596
|
);
|
|
1657
1597
|
}
|
|
1658
1598
|
function SidebarGroup({ className, ...props }) {
|
|
1659
|
-
return /* @__PURE__ */ (0,
|
|
1599
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1660
1600
|
"div",
|
|
1661
1601
|
{
|
|
1662
1602
|
"data-slot": "sidebar-group",
|
|
@@ -1672,7 +1612,7 @@ function SidebarGroupLabel({
|
|
|
1672
1612
|
...props
|
|
1673
1613
|
}) {
|
|
1674
1614
|
const Comp = asChild ? import_react_slot3.Slot : "div";
|
|
1675
|
-
return /* @__PURE__ */ (0,
|
|
1615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1676
1616
|
Comp,
|
|
1677
1617
|
{
|
|
1678
1618
|
"data-slot": "sidebar-group-label",
|
|
@@ -1690,7 +1630,7 @@ function SidebarGroupContent({
|
|
|
1690
1630
|
className,
|
|
1691
1631
|
...props
|
|
1692
1632
|
}) {
|
|
1693
|
-
return /* @__PURE__ */ (0,
|
|
1633
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1694
1634
|
"div",
|
|
1695
1635
|
{
|
|
1696
1636
|
"data-slot": "sidebar-group-content",
|
|
@@ -1701,7 +1641,7 @@ function SidebarGroupContent({
|
|
|
1701
1641
|
);
|
|
1702
1642
|
}
|
|
1703
1643
|
function SidebarMenu({ className, ...props }) {
|
|
1704
|
-
return /* @__PURE__ */ (0,
|
|
1644
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1705
1645
|
"ul",
|
|
1706
1646
|
{
|
|
1707
1647
|
"data-slot": "sidebar-menu",
|
|
@@ -1712,7 +1652,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1712
1652
|
);
|
|
1713
1653
|
}
|
|
1714
1654
|
function SidebarMenuItem({ className, ...props }) {
|
|
1715
|
-
return /* @__PURE__ */ (0,
|
|
1655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1716
1656
|
"li",
|
|
1717
1657
|
{
|
|
1718
1658
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1753,7 +1693,7 @@ function SidebarMenuButton({
|
|
|
1753
1693
|
}) {
|
|
1754
1694
|
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
1755
1695
|
const { isMobile, state } = useSidebar();
|
|
1756
|
-
const button = /* @__PURE__ */ (0,
|
|
1696
|
+
const button = /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1757
1697
|
Comp,
|
|
1758
1698
|
{
|
|
1759
1699
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1772,9 +1712,9 @@ function SidebarMenuButton({
|
|
|
1772
1712
|
children: tooltip
|
|
1773
1713
|
};
|
|
1774
1714
|
}
|
|
1775
|
-
return /* @__PURE__ */ (0,
|
|
1776
|
-
/* @__PURE__ */ (0,
|
|
1777
|
-
/* @__PURE__ */ (0,
|
|
1715
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(Tooltip, { children: [
|
|
1716
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(TooltipTrigger, { asChild: true, children: button }),
|
|
1717
|
+
/* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1778
1718
|
TooltipContent,
|
|
1779
1719
|
{
|
|
1780
1720
|
side: "right",
|
|
@@ -1792,7 +1732,7 @@ function SidebarMenuAction({
|
|
|
1792
1732
|
...props
|
|
1793
1733
|
}) {
|
|
1794
1734
|
const Comp = asChild ? import_react_slot3.Slot : "button";
|
|
1795
|
-
return /* @__PURE__ */ (0,
|
|
1735
|
+
return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
|
|
1796
1736
|
Comp,
|
|
1797
1737
|
{
|
|
1798
1738
|
"data-slot": "sidebar-menu-action",
|
|
@@ -1814,10 +1754,10 @@ function SidebarMenuAction({
|
|
|
1814
1754
|
}
|
|
1815
1755
|
|
|
1816
1756
|
// src/components/ui/dialog.tsx
|
|
1817
|
-
var
|
|
1757
|
+
var React6 = __toESM(require("react"), 1);
|
|
1818
1758
|
var DialogPrimitive = __toESM(require("@radix-ui/react-dialog"), 1);
|
|
1819
|
-
var
|
|
1820
|
-
var
|
|
1759
|
+
var import_lucide_react5 = require("lucide-react");
|
|
1760
|
+
var import_jsx_runtime14 = require("react/jsx-runtime");
|
|
1821
1761
|
function cleanupBodyStyles2() {
|
|
1822
1762
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1823
1763
|
document.body.style.pointerEvents = "";
|
|
@@ -1828,36 +1768,36 @@ function Dialog({
|
|
|
1828
1768
|
onOpenChange,
|
|
1829
1769
|
...props
|
|
1830
1770
|
}) {
|
|
1831
|
-
const prevOpenRef =
|
|
1832
|
-
|
|
1771
|
+
const prevOpenRef = React6.useRef(open);
|
|
1772
|
+
React6.useEffect(() => {
|
|
1833
1773
|
if (prevOpenRef.current === true && open === false) {
|
|
1834
1774
|
const timeout = setTimeout(cleanupBodyStyles2, 250);
|
|
1835
1775
|
return () => clearTimeout(timeout);
|
|
1836
1776
|
}
|
|
1837
1777
|
prevOpenRef.current = open;
|
|
1838
1778
|
}, [open]);
|
|
1839
|
-
|
|
1779
|
+
React6.useEffect(() => {
|
|
1840
1780
|
return () => {
|
|
1841
1781
|
cleanupBodyStyles2();
|
|
1842
1782
|
};
|
|
1843
1783
|
}, []);
|
|
1844
|
-
return /* @__PURE__ */ (0,
|
|
1784
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
1845
1785
|
}
|
|
1846
1786
|
function DialogTrigger({
|
|
1847
1787
|
...props
|
|
1848
1788
|
}) {
|
|
1849
|
-
return /* @__PURE__ */ (0,
|
|
1789
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1850
1790
|
}
|
|
1851
1791
|
function DialogPortal({
|
|
1852
1792
|
...props
|
|
1853
1793
|
}) {
|
|
1854
|
-
return /* @__PURE__ */ (0,
|
|
1794
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1855
1795
|
}
|
|
1856
1796
|
function DialogOverlay({
|
|
1857
1797
|
className,
|
|
1858
1798
|
...props
|
|
1859
1799
|
}) {
|
|
1860
|
-
return /* @__PURE__ */ (0,
|
|
1800
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1861
1801
|
DialogPrimitive.Overlay,
|
|
1862
1802
|
{
|
|
1863
1803
|
"data-slot": "dialog-overlay",
|
|
@@ -1878,9 +1818,9 @@ function DialogContent({
|
|
|
1878
1818
|
showCloseButton = true,
|
|
1879
1819
|
...props
|
|
1880
1820
|
}) {
|
|
1881
|
-
return /* @__PURE__ */ (0,
|
|
1882
|
-
/* @__PURE__ */ (0,
|
|
1883
|
-
/* @__PURE__ */ (0,
|
|
1821
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1822
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DialogOverlay, {}),
|
|
1823
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1884
1824
|
DialogPrimitive.Content,
|
|
1885
1825
|
{
|
|
1886
1826
|
"data-slot": "dialog-content",
|
|
@@ -1892,14 +1832,14 @@ function DialogContent({
|
|
|
1892
1832
|
...props,
|
|
1893
1833
|
children: [
|
|
1894
1834
|
children,
|
|
1895
|
-
showCloseButton && /* @__PURE__ */ (0,
|
|
1835
|
+
showCloseButton && /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
|
|
1896
1836
|
DialogPrimitive.Close,
|
|
1897
1837
|
{
|
|
1898
1838
|
"data-slot": "dialog-close",
|
|
1899
1839
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1900
1840
|
children: [
|
|
1901
|
-
/* @__PURE__ */ (0,
|
|
1902
|
-
/* @__PURE__ */ (0,
|
|
1841
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)(import_lucide_react5.XIcon, {}),
|
|
1842
|
+
/* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "sr-only", children: "Close" })
|
|
1903
1843
|
]
|
|
1904
1844
|
}
|
|
1905
1845
|
)
|
|
@@ -1909,7 +1849,7 @@ function DialogContent({
|
|
|
1909
1849
|
] });
|
|
1910
1850
|
}
|
|
1911
1851
|
function DialogHeader({ className, ...props }) {
|
|
1912
|
-
return /* @__PURE__ */ (0,
|
|
1852
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1913
1853
|
"div",
|
|
1914
1854
|
{
|
|
1915
1855
|
"data-slot": "dialog-header",
|
|
@@ -1919,7 +1859,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1919
1859
|
);
|
|
1920
1860
|
}
|
|
1921
1861
|
function DialogFooter({ className, ...props }) {
|
|
1922
|
-
return /* @__PURE__ */ (0,
|
|
1862
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1923
1863
|
"div",
|
|
1924
1864
|
{
|
|
1925
1865
|
"data-slot": "dialog-footer",
|
|
@@ -1935,7 +1875,7 @@ function DialogTitle({
|
|
|
1935
1875
|
className,
|
|
1936
1876
|
...props
|
|
1937
1877
|
}) {
|
|
1938
|
-
return /* @__PURE__ */ (0,
|
|
1878
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1939
1879
|
DialogPrimitive.Title,
|
|
1940
1880
|
{
|
|
1941
1881
|
"data-slot": "dialog-title",
|
|
@@ -1948,7 +1888,7 @@ function DialogDescription({
|
|
|
1948
1888
|
className,
|
|
1949
1889
|
...props
|
|
1950
1890
|
}) {
|
|
1951
|
-
return /* @__PURE__ */ (0,
|
|
1891
|
+
return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
|
|
1952
1892
|
DialogPrimitive.Description,
|
|
1953
1893
|
{
|
|
1954
1894
|
"data-slot": "dialog-description",
|
|
@@ -1959,9 +1899,9 @@ function DialogDescription({
|
|
|
1959
1899
|
}
|
|
1960
1900
|
|
|
1961
1901
|
// src/components/ui/alert-dialog.tsx
|
|
1962
|
-
var
|
|
1902
|
+
var React7 = __toESM(require("react"), 1);
|
|
1963
1903
|
var AlertDialogPrimitive = __toESM(require("@radix-ui/react-alert-dialog"), 1);
|
|
1964
|
-
var
|
|
1904
|
+
var import_jsx_runtime15 = require("react/jsx-runtime");
|
|
1965
1905
|
function cleanupBodyStyles3() {
|
|
1966
1906
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1967
1907
|
document.body.style.pointerEvents = "";
|
|
@@ -1972,31 +1912,31 @@ function AlertDialog({
|
|
|
1972
1912
|
onOpenChange,
|
|
1973
1913
|
...props
|
|
1974
1914
|
}) {
|
|
1975
|
-
const prevOpenRef =
|
|
1976
|
-
|
|
1915
|
+
const prevOpenRef = React7.useRef(open);
|
|
1916
|
+
React7.useEffect(() => {
|
|
1977
1917
|
if (prevOpenRef.current === true && open === false) {
|
|
1978
1918
|
const timeout = setTimeout(cleanupBodyStyles3, 250);
|
|
1979
1919
|
return () => clearTimeout(timeout);
|
|
1980
1920
|
}
|
|
1981
1921
|
prevOpenRef.current = open;
|
|
1982
1922
|
}, [open]);
|
|
1983
|
-
|
|
1923
|
+
React7.useEffect(() => {
|
|
1984
1924
|
return () => {
|
|
1985
1925
|
cleanupBodyStyles3();
|
|
1986
1926
|
};
|
|
1987
1927
|
}, []);
|
|
1988
|
-
return /* @__PURE__ */ (0,
|
|
1928
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", open, onOpenChange, ...props });
|
|
1989
1929
|
}
|
|
1990
1930
|
function AlertDialogPortal({
|
|
1991
1931
|
...props
|
|
1992
1932
|
}) {
|
|
1993
|
-
return /* @__PURE__ */ (0,
|
|
1933
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
1994
1934
|
}
|
|
1995
1935
|
function AlertDialogOverlay({
|
|
1996
1936
|
className,
|
|
1997
1937
|
...props
|
|
1998
1938
|
}) {
|
|
1999
|
-
return /* @__PURE__ */ (0,
|
|
1939
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2000
1940
|
AlertDialogPrimitive.Overlay,
|
|
2001
1941
|
{
|
|
2002
1942
|
"data-slot": "alert-dialog-overlay",
|
|
@@ -2015,9 +1955,9 @@ function AlertDialogContent({
|
|
|
2015
1955
|
className,
|
|
2016
1956
|
...props
|
|
2017
1957
|
}) {
|
|
2018
|
-
return /* @__PURE__ */ (0,
|
|
2019
|
-
/* @__PURE__ */ (0,
|
|
2020
|
-
/* @__PURE__ */ (0,
|
|
1958
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(AlertDialogPortal, { children: [
|
|
1959
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(AlertDialogOverlay, {}),
|
|
1960
|
+
/* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2021
1961
|
AlertDialogPrimitive.Content,
|
|
2022
1962
|
{
|
|
2023
1963
|
"data-slot": "alert-dialog-content",
|
|
@@ -2034,7 +1974,7 @@ function AlertDialogHeader({
|
|
|
2034
1974
|
className,
|
|
2035
1975
|
...props
|
|
2036
1976
|
}) {
|
|
2037
|
-
return /* @__PURE__ */ (0,
|
|
1977
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2038
1978
|
"div",
|
|
2039
1979
|
{
|
|
2040
1980
|
"data-slot": "alert-dialog-header",
|
|
@@ -2047,7 +1987,7 @@ function AlertDialogFooter({
|
|
|
2047
1987
|
className,
|
|
2048
1988
|
...props
|
|
2049
1989
|
}) {
|
|
2050
|
-
return /* @__PURE__ */ (0,
|
|
1990
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2051
1991
|
"div",
|
|
2052
1992
|
{
|
|
2053
1993
|
"data-slot": "alert-dialog-footer",
|
|
@@ -2063,7 +2003,7 @@ function AlertDialogTitle({
|
|
|
2063
2003
|
className,
|
|
2064
2004
|
...props
|
|
2065
2005
|
}) {
|
|
2066
|
-
return /* @__PURE__ */ (0,
|
|
2006
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2067
2007
|
AlertDialogPrimitive.Title,
|
|
2068
2008
|
{
|
|
2069
2009
|
"data-slot": "alert-dialog-title",
|
|
@@ -2076,7 +2016,7 @@ function AlertDialogDescription({
|
|
|
2076
2016
|
className,
|
|
2077
2017
|
...props
|
|
2078
2018
|
}) {
|
|
2079
|
-
return /* @__PURE__ */ (0,
|
|
2019
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2080
2020
|
AlertDialogPrimitive.Description,
|
|
2081
2021
|
{
|
|
2082
2022
|
"data-slot": "alert-dialog-description",
|
|
@@ -2089,7 +2029,7 @@ function AlertDialogAction({
|
|
|
2089
2029
|
className,
|
|
2090
2030
|
...props
|
|
2091
2031
|
}) {
|
|
2092
|
-
return /* @__PURE__ */ (0,
|
|
2032
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2093
2033
|
AlertDialogPrimitive.Action,
|
|
2094
2034
|
{
|
|
2095
2035
|
className: cn(buttonVariants(), className),
|
|
@@ -2101,7 +2041,7 @@ function AlertDialogCancel({
|
|
|
2101
2041
|
className,
|
|
2102
2042
|
...props
|
|
2103
2043
|
}) {
|
|
2104
|
-
return /* @__PURE__ */ (0,
|
|
2044
|
+
return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
|
|
2105
2045
|
AlertDialogPrimitive.Cancel,
|
|
2106
2046
|
{
|
|
2107
2047
|
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
@@ -2112,17 +2052,17 @@ function AlertDialogCancel({
|
|
|
2112
2052
|
|
|
2113
2053
|
// src/components/ui/dropdown-menu.tsx
|
|
2114
2054
|
var DropdownMenuPrimitive = __toESM(require("@radix-ui/react-dropdown-menu"), 1);
|
|
2115
|
-
var
|
|
2116
|
-
var
|
|
2055
|
+
var import_lucide_react6 = require("lucide-react");
|
|
2056
|
+
var import_jsx_runtime16 = require("react/jsx-runtime");
|
|
2117
2057
|
function DropdownMenu({
|
|
2118
2058
|
...props
|
|
2119
2059
|
}) {
|
|
2120
|
-
return /* @__PURE__ */ (0,
|
|
2060
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
2121
2061
|
}
|
|
2122
2062
|
function DropdownMenuTrigger({
|
|
2123
2063
|
...props
|
|
2124
2064
|
}) {
|
|
2125
|
-
return /* @__PURE__ */ (0,
|
|
2065
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2126
2066
|
DropdownMenuPrimitive.Trigger,
|
|
2127
2067
|
{
|
|
2128
2068
|
"data-slot": "dropdown-menu-trigger",
|
|
@@ -2135,7 +2075,7 @@ function DropdownMenuContent({
|
|
|
2135
2075
|
sideOffset = 4,
|
|
2136
2076
|
...props
|
|
2137
2077
|
}) {
|
|
2138
|
-
return /* @__PURE__ */ (0,
|
|
2078
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2139
2079
|
DropdownMenuPrimitive.Content,
|
|
2140
2080
|
{
|
|
2141
2081
|
"data-slot": "dropdown-menu-content",
|
|
@@ -2154,7 +2094,7 @@ function DropdownMenuItem({
|
|
|
2154
2094
|
variant = "default",
|
|
2155
2095
|
...props
|
|
2156
2096
|
}) {
|
|
2157
|
-
return /* @__PURE__ */ (0,
|
|
2097
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2158
2098
|
DropdownMenuPrimitive.Item,
|
|
2159
2099
|
{
|
|
2160
2100
|
"data-slot": "dropdown-menu-item",
|
|
@@ -2173,7 +2113,7 @@ function DropdownMenuLabel({
|
|
|
2173
2113
|
inset,
|
|
2174
2114
|
...props
|
|
2175
2115
|
}) {
|
|
2176
|
-
return /* @__PURE__ */ (0,
|
|
2116
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2177
2117
|
DropdownMenuPrimitive.Label,
|
|
2178
2118
|
{
|
|
2179
2119
|
"data-slot": "dropdown-menu-label",
|
|
@@ -2190,7 +2130,7 @@ function DropdownMenuSeparator({
|
|
|
2190
2130
|
className,
|
|
2191
2131
|
...props
|
|
2192
2132
|
}) {
|
|
2193
|
-
return /* @__PURE__ */ (0,
|
|
2133
|
+
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
|
2194
2134
|
DropdownMenuPrimitive.Separator,
|
|
2195
2135
|
{
|
|
2196
2136
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -2201,11 +2141,11 @@ function DropdownMenuSeparator({
|
|
|
2201
2141
|
}
|
|
2202
2142
|
|
|
2203
2143
|
// src/components/chat/Sidebar.tsx
|
|
2204
|
-
var
|
|
2144
|
+
var import_lucide_react8 = require("lucide-react");
|
|
2205
2145
|
|
|
2206
2146
|
// src/components/chat/UserMenu.tsx
|
|
2207
|
-
var
|
|
2208
|
-
var
|
|
2147
|
+
var import_lucide_react7 = require("lucide-react");
|
|
2148
|
+
var import_jsx_runtime17 = require("react/jsx-runtime");
|
|
2209
2149
|
var getInitials = (name, email) => {
|
|
2210
2150
|
if (name) {
|
|
2211
2151
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -2240,27 +2180,27 @@ var UserMenu = ({
|
|
|
2240
2180
|
};
|
|
2241
2181
|
const displayName = getDisplayName(user, labels.guest);
|
|
2242
2182
|
const initials = getInitials(user?.name, user?.email);
|
|
2243
|
-
return /* @__PURE__ */ (0,
|
|
2244
|
-
/* @__PURE__ */ (0,
|
|
2183
|
+
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenu, { children: [
|
|
2184
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2245
2185
|
SidebarMenuButton,
|
|
2246
2186
|
{
|
|
2247
2187
|
size: "lg",
|
|
2248
2188
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
2249
2189
|
tooltip: displayName,
|
|
2250
2190
|
children: [
|
|
2251
|
-
/* @__PURE__ */ (0,
|
|
2252
|
-
user?.avatar && /* @__PURE__ */ (0,
|
|
2253
|
-
/* @__PURE__ */ (0,
|
|
2191
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2192
|
+
user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2193
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2254
2194
|
] }),
|
|
2255
|
-
/* @__PURE__ */ (0,
|
|
2256
|
-
/* @__PURE__ */ (0,
|
|
2257
|
-
user?.email && /* @__PURE__ */ (0,
|
|
2195
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
2196
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate font-medium", children: displayName }),
|
|
2197
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2258
2198
|
] }),
|
|
2259
|
-
/* @__PURE__ */ (0,
|
|
2199
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
2260
2200
|
]
|
|
2261
2201
|
}
|
|
2262
2202
|
) }),
|
|
2263
|
-
/* @__PURE__ */ (0,
|
|
2203
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2264
2204
|
DropdownMenuContent,
|
|
2265
2205
|
{
|
|
2266
2206
|
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg",
|
|
@@ -2268,72 +2208,72 @@ var UserMenu = ({
|
|
|
2268
2208
|
align: "end",
|
|
2269
2209
|
sideOffset: 4,
|
|
2270
2210
|
children: [
|
|
2271
|
-
/* @__PURE__ */ (0,
|
|
2272
|
-
/* @__PURE__ */ (0,
|
|
2273
|
-
user?.avatar && /* @__PURE__ */ (0,
|
|
2274
|
-
/* @__PURE__ */ (0,
|
|
2211
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
2212
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2213
|
+
user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2214
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2275
2215
|
] }),
|
|
2276
|
-
/* @__PURE__ */ (0,
|
|
2277
|
-
/* @__PURE__ */ (0,
|
|
2278
|
-
user?.email && /* @__PURE__ */ (0,
|
|
2216
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
2217
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate font-medium", children: displayName }),
|
|
2218
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2279
2219
|
] })
|
|
2280
2220
|
] }) }),
|
|
2281
|
-
/* @__PURE__ */ (0,
|
|
2282
|
-
callbacks?.onViewProfile && /* @__PURE__ */ (0,
|
|
2283
|
-
/* @__PURE__ */ (0,
|
|
2284
|
-
/* @__PURE__ */ (0,
|
|
2221
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}),
|
|
2222
|
+
callbacks?.onViewProfile && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
|
|
2223
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.User, { className: "mr-2 h-4 w-4" }),
|
|
2224
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: labels.profile })
|
|
2285
2225
|
] }),
|
|
2286
|
-
callbacks?.onOpenSettings && /* @__PURE__ */ (0,
|
|
2287
|
-
/* @__PURE__ */ (0,
|
|
2288
|
-
/* @__PURE__ */ (0,
|
|
2226
|
+
callbacks?.onOpenSettings && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
|
|
2227
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Settings, { className: "mr-2 h-4 w-4" }),
|
|
2228
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: labels.settings })
|
|
2289
2229
|
] }),
|
|
2290
2230
|
additionalItems,
|
|
2291
|
-
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ (0,
|
|
2292
|
-
/* @__PURE__ */ (0,
|
|
2293
|
-
/* @__PURE__ */ (0,
|
|
2231
|
+
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2232
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}),
|
|
2233
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2294
2234
|
DropdownMenuItem,
|
|
2295
2235
|
{
|
|
2296
2236
|
onClick: () => callbacks.onThemeChange?.("light"),
|
|
2297
2237
|
className: currentTheme === "light" ? "bg-accent" : "",
|
|
2298
2238
|
children: [
|
|
2299
|
-
/* @__PURE__ */ (0,
|
|
2300
|
-
/* @__PURE__ */ (0,
|
|
2239
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Sun, { className: "mr-2 h-4 w-4" }),
|
|
2240
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: labels.lightMode })
|
|
2301
2241
|
]
|
|
2302
2242
|
}
|
|
2303
2243
|
),
|
|
2304
|
-
/* @__PURE__ */ (0,
|
|
2244
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2305
2245
|
DropdownMenuItem,
|
|
2306
2246
|
{
|
|
2307
2247
|
onClick: () => callbacks.onThemeChange?.("dark"),
|
|
2308
2248
|
className: currentTheme === "dark" ? "bg-accent" : "",
|
|
2309
2249
|
children: [
|
|
2310
|
-
/* @__PURE__ */ (0,
|
|
2311
|
-
/* @__PURE__ */ (0,
|
|
2250
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Moon, { className: "mr-2 h-4 w-4" }),
|
|
2251
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: labels.darkMode })
|
|
2312
2252
|
]
|
|
2313
2253
|
}
|
|
2314
2254
|
),
|
|
2315
|
-
/* @__PURE__ */ (0,
|
|
2255
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2316
2256
|
DropdownMenuItem,
|
|
2317
2257
|
{
|
|
2318
2258
|
onClick: () => callbacks.onThemeChange?.("system"),
|
|
2319
2259
|
className: currentTheme === "system" ? "bg-accent" : "",
|
|
2320
2260
|
children: [
|
|
2321
|
-
/* @__PURE__ */ (0,
|
|
2322
|
-
/* @__PURE__ */ (0,
|
|
2261
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.Palette, { className: "mr-2 h-4 w-4" }),
|
|
2262
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: labels.systemTheme })
|
|
2323
2263
|
]
|
|
2324
2264
|
}
|
|
2325
2265
|
)
|
|
2326
2266
|
] }),
|
|
2327
|
-
callbacks?.onLogout && /* @__PURE__ */ (0,
|
|
2328
|
-
/* @__PURE__ */ (0,
|
|
2329
|
-
/* @__PURE__ */ (0,
|
|
2267
|
+
callbacks?.onLogout && /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
|
2268
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownMenuSeparator, {}),
|
|
2269
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
|
2330
2270
|
DropdownMenuItem,
|
|
2331
2271
|
{
|
|
2332
2272
|
onClick: callbacks.onLogout,
|
|
2333
2273
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10",
|
|
2334
2274
|
children: [
|
|
2335
|
-
/* @__PURE__ */ (0,
|
|
2336
|
-
/* @__PURE__ */ (0,
|
|
2275
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_lucide_react7.LogOut, { className: "mr-2 h-4 w-4" }),
|
|
2276
|
+
/* @__PURE__ */ (0, import_jsx_runtime17.jsx)("span", { children: labels.logout })
|
|
2337
2277
|
]
|
|
2338
2278
|
}
|
|
2339
2279
|
)
|
|
@@ -2345,26 +2285,26 @@ var UserMenu = ({
|
|
|
2345
2285
|
};
|
|
2346
2286
|
|
|
2347
2287
|
// src/components/chat/Sidebar.tsx
|
|
2348
|
-
var
|
|
2288
|
+
var import_jsx_runtime18 = require("react/jsx-runtime");
|
|
2349
2289
|
var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
2350
|
-
const [title, setTitle] = (0,
|
|
2351
|
-
const [isOpen, setIsOpen] = (0,
|
|
2290
|
+
const [title, setTitle] = (0, import_react3.useState)("");
|
|
2291
|
+
const [isOpen, setIsOpen] = (0, import_react3.useState)(false);
|
|
2352
2292
|
const handleCreate = () => {
|
|
2353
2293
|
onCreateThread(title.trim() || void 0);
|
|
2354
2294
|
setTitle("");
|
|
2355
2295
|
setIsOpen(false);
|
|
2356
2296
|
};
|
|
2357
|
-
return /* @__PURE__ */ (0,
|
|
2358
|
-
/* @__PURE__ */ (0,
|
|
2359
|
-
/* @__PURE__ */ (0,
|
|
2297
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2298
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Button, { className: "w-full justify-start", variant: "outline", children: [
|
|
2299
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Plus, { className: "mr-2 h-4 w-4" }),
|
|
2360
2300
|
config.labels?.newChat || "New Chat"
|
|
2361
2301
|
] }) }),
|
|
2362
|
-
/* @__PURE__ */ (0,
|
|
2363
|
-
/* @__PURE__ */ (0,
|
|
2364
|
-
/* @__PURE__ */ (0,
|
|
2365
|
-
/* @__PURE__ */ (0,
|
|
2302
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogContent, { children: [
|
|
2303
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogHeader, { children: [
|
|
2304
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
|
|
2305
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
2366
2306
|
] }),
|
|
2367
|
-
/* @__PURE__ */ (0,
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2368
2308
|
Input,
|
|
2369
2309
|
{
|
|
2370
2310
|
value: title,
|
|
@@ -2374,16 +2314,16 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2374
2314
|
autoFocus: true
|
|
2375
2315
|
}
|
|
2376
2316
|
),
|
|
2377
|
-
/* @__PURE__ */ (0,
|
|
2378
|
-
/* @__PURE__ */ (0,
|
|
2379
|
-
/* @__PURE__ */ (0,
|
|
2317
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DialogFooter, { children: [
|
|
2318
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
|
|
2319
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
|
|
2380
2320
|
] })
|
|
2381
2321
|
] })
|
|
2382
2322
|
] });
|
|
2383
2323
|
};
|
|
2384
2324
|
var ThreadInitialsIcon = ({ title }) => {
|
|
2385
2325
|
const initials = title?.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
2386
|
-
return /* @__PURE__ */ (0,
|
|
2326
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
|
|
2387
2327
|
};
|
|
2388
2328
|
var Sidebar2 = ({
|
|
2389
2329
|
threads,
|
|
@@ -2402,14 +2342,14 @@ var Sidebar2 = ({
|
|
|
2402
2342
|
userMenuAdditionalItems,
|
|
2403
2343
|
...props
|
|
2404
2344
|
}) => {
|
|
2405
|
-
const [searchQuery, setSearchQuery] = (0,
|
|
2406
|
-
const [showArchived, setShowArchived] = (0,
|
|
2407
|
-
const [deleteThreadId, setDeleteThreadId] = (0,
|
|
2408
|
-
const [editingThreadId, setEditingThreadId] = (0,
|
|
2409
|
-
const [editTitle, setEditTitle] = (0,
|
|
2410
|
-
const inputRef = (0,
|
|
2345
|
+
const [searchQuery, setSearchQuery] = (0, import_react3.useState)("");
|
|
2346
|
+
const [showArchived, setShowArchived] = (0, import_react3.useState)(false);
|
|
2347
|
+
const [deleteThreadId, setDeleteThreadId] = (0, import_react3.useState)(null);
|
|
2348
|
+
const [editingThreadId, setEditingThreadId] = (0, import_react3.useState)(null);
|
|
2349
|
+
const [editTitle, setEditTitle] = (0, import_react3.useState)("");
|
|
2350
|
+
const inputRef = (0, import_react3.useRef)(null);
|
|
2411
2351
|
const { setOpen } = useSidebar();
|
|
2412
|
-
(0,
|
|
2352
|
+
(0, import_react3.useEffect)(() => {
|
|
2413
2353
|
if (editingThreadId && inputRef.current) {
|
|
2414
2354
|
inputRef.current.focus();
|
|
2415
2355
|
inputRef.current.select();
|
|
@@ -2460,38 +2400,38 @@ var Sidebar2 = ({
|
|
|
2460
2400
|
const cancelEdit = () => {
|
|
2461
2401
|
setEditingThreadId(null);
|
|
2462
2402
|
};
|
|
2463
|
-
return /* @__PURE__ */ (0,
|
|
2464
|
-
/* @__PURE__ */ (0,
|
|
2465
|
-
/* @__PURE__ */ (0,
|
|
2466
|
-
/* @__PURE__ */ (0,
|
|
2467
|
-
/* @__PURE__ */ (0,
|
|
2468
|
-
/* @__PURE__ */ (0,
|
|
2469
|
-
config.branding?.subtitle && /* @__PURE__ */ (0,
|
|
2403
|
+
return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2404
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SidebarHeader, { children: [
|
|
2405
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2406
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Bot, { className: "h-4 w-4" }) }) }) }),
|
|
2407
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
2408
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
|
|
2409
|
+
config.branding?.subtitle && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2470
2410
|
] })
|
|
2471
2411
|
] }),
|
|
2472
|
-
onCreateThread && /* @__PURE__ */ (0,
|
|
2412
|
+
onCreateThread && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2473
2413
|
CreateThreadDialog,
|
|
2474
2414
|
{
|
|
2475
2415
|
config,
|
|
2476
2416
|
onCreateThread,
|
|
2477
|
-
trigger: /* @__PURE__ */ (0,
|
|
2417
|
+
trigger: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarMenu, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarMenuItem, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2478
2418
|
SidebarMenuButton,
|
|
2479
2419
|
{
|
|
2480
2420
|
size: "lg",
|
|
2481
2421
|
className: "w-full justify-start gap-2 border border-sidebar-border shadow-sm hover:bg-sidebar-accent hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:justify-center",
|
|
2482
2422
|
tooltip: config.labels?.newChat || "New Chat",
|
|
2483
2423
|
children: [
|
|
2484
|
-
/* @__PURE__ */ (0,
|
|
2485
|
-
/* @__PURE__ */ (0,
|
|
2424
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Plus, { className: "size-4" }),
|
|
2425
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
|
|
2486
2426
|
]
|
|
2487
2427
|
}
|
|
2488
2428
|
) }) })
|
|
2489
2429
|
}
|
|
2490
2430
|
),
|
|
2491
|
-
/* @__PURE__ */ (0,
|
|
2492
|
-
/* @__PURE__ */ (0,
|
|
2493
|
-
/* @__PURE__ */ (0,
|
|
2494
|
-
/* @__PURE__ */ (0,
|
|
2431
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "px-2 py-1 mt-4", children: [
|
|
2432
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
|
|
2433
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
|
|
2434
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2495
2435
|
Input,
|
|
2496
2436
|
{
|
|
2497
2437
|
className: "pl-8 h-8 bg-sidebar-accent/50 border-sidebar-border focus-visible:ring-1 focus-visible:ring-sidebar-ring",
|
|
@@ -2501,7 +2441,7 @@ var Sidebar2 = ({
|
|
|
2501
2441
|
}
|
|
2502
2442
|
)
|
|
2503
2443
|
] }),
|
|
2504
|
-
/* @__PURE__ */ (0,
|
|
2444
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2505
2445
|
Button,
|
|
2506
2446
|
{
|
|
2507
2447
|
variant: "ghost",
|
|
@@ -2509,13 +2449,13 @@ var Sidebar2 = ({
|
|
|
2509
2449
|
className: "h-7 w-7",
|
|
2510
2450
|
onClick: () => setOpen(true),
|
|
2511
2451
|
title: config.labels?.search || "Search",
|
|
2512
|
-
children: /* @__PURE__ */ (0,
|
|
2452
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Search, { className: "h-4 w-4" })
|
|
2513
2453
|
}
|
|
2514
2454
|
) })
|
|
2515
2455
|
] })
|
|
2516
2456
|
] }),
|
|
2517
|
-
/* @__PURE__ */ (0,
|
|
2518
|
-
threads.some((t) => t.isArchived) && /* @__PURE__ */ (0,
|
|
2457
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SidebarContent, { children: [
|
|
2458
|
+
threads.some((t) => t.isArchived) && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2519
2459
|
Button,
|
|
2520
2460
|
{
|
|
2521
2461
|
variant: "ghost",
|
|
@@ -2523,18 +2463,18 @@ var Sidebar2 = ({
|
|
|
2523
2463
|
onClick: () => setShowArchived(!showArchived),
|
|
2524
2464
|
className: "h-6 text-xs w-full justify-start text-muted-foreground",
|
|
2525
2465
|
children: [
|
|
2526
|
-
/* @__PURE__ */ (0,
|
|
2466
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Filter, { className: "mr-2 h-3 w-3" }),
|
|
2527
2467
|
showArchived ? config.labels?.hideArchived || "Hide Archived" : config.labels?.showArchived || "Show Archived"
|
|
2528
2468
|
]
|
|
2529
2469
|
}
|
|
2530
2470
|
) }),
|
|
2531
|
-
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0,
|
|
2532
|
-
/* @__PURE__ */ (0,
|
|
2533
|
-
/* @__PURE__ */ (0,
|
|
2534
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0,
|
|
2535
|
-
/* @__PURE__ */ (0,
|
|
2536
|
-
/* @__PURE__ */ (0,
|
|
2537
|
-
editingThreadId === thread.id ? /* @__PURE__ */ (0,
|
|
2471
|
+
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2472
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Plus, { className: "h-4 w-4 opacity-50" }) }),
|
|
2473
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|
|
2474
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SidebarGroup, { className: "mt-2", children: [
|
|
2475
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
|
|
2476
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarGroupContent, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SidebarMenuItem, { children: [
|
|
2477
|
+
editingThreadId === thread.id ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2538
2478
|
Input,
|
|
2539
2479
|
{
|
|
2540
2480
|
ref: inputRef,
|
|
@@ -2547,42 +2487,42 @@ var Sidebar2 = ({
|
|
|
2547
2487
|
onBlur: saveEdit,
|
|
2548
2488
|
className: "h-7 text-sm"
|
|
2549
2489
|
}
|
|
2550
|
-
) }) : /* @__PURE__ */ (0,
|
|
2490
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2551
2491
|
SidebarMenuButton,
|
|
2552
2492
|
{
|
|
2553
2493
|
isActive: currentThreadId === thread.id,
|
|
2554
2494
|
onClick: () => onSelectThread?.(thread.id),
|
|
2555
2495
|
tooltip: thread.title,
|
|
2556
2496
|
children: [
|
|
2557
|
-
/* @__PURE__ */ (0,
|
|
2558
|
-
/* @__PURE__ */ (0,
|
|
2559
|
-
thread.isArchived && /* @__PURE__ */ (0,
|
|
2497
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(ThreadInitialsIcon, { title: thread.title || "?" }),
|
|
2498
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col items-start gap-0.5 flex-1 min-w-0 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "truncate w-full", children: thread.title || "New Chat" }) }),
|
|
2499
|
+
thread.isArchived && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
|
|
2560
2500
|
]
|
|
2561
2501
|
}
|
|
2562
2502
|
),
|
|
2563
|
-
!editingThreadId && /* @__PURE__ */ (0,
|
|
2564
|
-
/* @__PURE__ */ (0,
|
|
2565
|
-
/* @__PURE__ */ (0,
|
|
2566
|
-
/* @__PURE__ */ (0,
|
|
2503
|
+
!editingThreadId && /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenu, { children: [
|
|
2504
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(SidebarMenuAction, { showOnHover: true, children: [
|
|
2505
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.MoreHorizontal, {}),
|
|
2506
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { className: "sr-only", children: "More" })
|
|
2567
2507
|
] }) }),
|
|
2568
|
-
/* @__PURE__ */ (0,
|
|
2569
|
-
/* @__PURE__ */ (0,
|
|
2570
|
-
/* @__PURE__ */ (0,
|
|
2571
|
-
/* @__PURE__ */ (0,
|
|
2508
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuContent, { className: "w-48", side: "right", align: "start", children: [
|
|
2509
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: () => startEditing(thread), children: [
|
|
2510
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2511
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: config.labels?.renameThread || "Rename" })
|
|
2572
2512
|
] }),
|
|
2573
|
-
/* @__PURE__ */ (0,
|
|
2574
|
-
/* @__PURE__ */ (0,
|
|
2575
|
-
/* @__PURE__ */ (0,
|
|
2513
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(DropdownMenuItem, { onClick: () => onArchiveThread?.(thread.id), children: [
|
|
2514
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Archive, { className: "mr-2 h-4 w-4" }),
|
|
2515
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2576
2516
|
] }),
|
|
2577
|
-
/* @__PURE__ */ (0,
|
|
2578
|
-
/* @__PURE__ */ (0,
|
|
2517
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DropdownMenuSeparator, {}),
|
|
2518
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
|
|
2579
2519
|
DropdownMenuItem,
|
|
2580
2520
|
{
|
|
2581
2521
|
onClick: () => setDeleteThreadId(thread.id),
|
|
2582
2522
|
className: "text-destructive focus:text-destructive",
|
|
2583
2523
|
children: [
|
|
2584
|
-
/* @__PURE__ */ (0,
|
|
2585
|
-
/* @__PURE__ */ (0,
|
|
2524
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_lucide_react8.Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2525
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2586
2526
|
]
|
|
2587
2527
|
}
|
|
2588
2528
|
)
|
|
@@ -2591,7 +2531,7 @@ var Sidebar2 = ({
|
|
|
2591
2531
|
] }, thread.id)) }) })
|
|
2592
2532
|
] }, group))
|
|
2593
2533
|
] }),
|
|
2594
|
-
/* @__PURE__ */ (0,
|
|
2534
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarFooter, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2595
2535
|
UserMenu,
|
|
2596
2536
|
{
|
|
2597
2537
|
user,
|
|
@@ -2602,15 +2542,15 @@ var Sidebar2 = ({
|
|
|
2602
2542
|
additionalItems: userMenuAdditionalItems
|
|
2603
2543
|
}
|
|
2604
2544
|
) }),
|
|
2605
|
-
/* @__PURE__ */ (0,
|
|
2606
|
-
deleteThreadId && /* @__PURE__ */ (0,
|
|
2607
|
-
/* @__PURE__ */ (0,
|
|
2608
|
-
/* @__PURE__ */ (0,
|
|
2609
|
-
/* @__PURE__ */ (0,
|
|
2545
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SidebarRail, {}),
|
|
2546
|
+
deleteThreadId && /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AlertDialogContent, { children: [
|
|
2547
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AlertDialogHeader, { children: [
|
|
2548
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2549
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2610
2550
|
] }),
|
|
2611
|
-
/* @__PURE__ */ (0,
|
|
2612
|
-
/* @__PURE__ */ (0,
|
|
2613
|
-
/* @__PURE__ */ (0,
|
|
2551
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(AlertDialogFooter, { children: [
|
|
2552
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2553
|
+
/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
|
|
2614
2554
|
AlertDialogAction,
|
|
2615
2555
|
{
|
|
2616
2556
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
@@ -2624,14 +2564,14 @@ var Sidebar2 = ({
|
|
|
2624
2564
|
};
|
|
2625
2565
|
|
|
2626
2566
|
// src/components/chat/ChatHeader.tsx
|
|
2627
|
-
var
|
|
2628
|
-
var
|
|
2567
|
+
var import_react5 = __toESM(require("react"), 1);
|
|
2568
|
+
var import_lucide_react10 = require("lucide-react");
|
|
2629
2569
|
|
|
2630
2570
|
// src/components/chat/AgentSelectors.tsx
|
|
2631
|
-
var
|
|
2632
|
-
var
|
|
2633
|
-
var
|
|
2634
|
-
var ParticipantsSelector = (0,
|
|
2571
|
+
var import_react4 = require("react");
|
|
2572
|
+
var import_lucide_react9 = require("lucide-react");
|
|
2573
|
+
var import_jsx_runtime19 = require("react/jsx-runtime");
|
|
2574
|
+
var ParticipantsSelector = (0, import_react4.memo)(({
|
|
2635
2575
|
agents,
|
|
2636
2576
|
participantIds,
|
|
2637
2577
|
onParticipantsChange,
|
|
@@ -2639,8 +2579,8 @@ var ParticipantsSelector = (0, import_react3.memo)(({
|
|
|
2639
2579
|
maxVisible = 3,
|
|
2640
2580
|
disabled = false
|
|
2641
2581
|
}) => {
|
|
2642
|
-
const agentsWithColors = (0,
|
|
2643
|
-
const selectedAgents = (0,
|
|
2582
|
+
const agentsWithColors = (0, import_react4.useMemo)(() => assignAgentColors(agents), [agents]);
|
|
2583
|
+
const selectedAgents = (0, import_react4.useMemo)(
|
|
2644
2584
|
() => agentsWithColors.filter((a) => participantIds.includes(a.id)),
|
|
2645
2585
|
[agentsWithColors, participantIds]
|
|
2646
2586
|
);
|
|
@@ -2658,19 +2598,19 @@ var ParticipantsSelector = (0, import_react3.memo)(({
|
|
|
2658
2598
|
};
|
|
2659
2599
|
const visibleAgents = selectedAgents.slice(0, maxVisible);
|
|
2660
2600
|
const hiddenCount = selectedAgents.length - maxVisible;
|
|
2661
|
-
return /* @__PURE__ */ (0,
|
|
2662
|
-
/* @__PURE__ */ (0,
|
|
2601
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenu, { children: [
|
|
2602
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2663
2603
|
Button,
|
|
2664
2604
|
{
|
|
2665
2605
|
variant: "ghost",
|
|
2666
2606
|
className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
|
|
2667
2607
|
disabled,
|
|
2668
2608
|
children: [
|
|
2669
|
-
/* @__PURE__ */ (0,
|
|
2670
|
-
/* @__PURE__ */ (0,
|
|
2671
|
-
/* @__PURE__ */ (0,
|
|
2672
|
-
/* @__PURE__ */ (0,
|
|
2673
|
-
/* @__PURE__ */ (0,
|
|
2609
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Users, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2610
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(import_jsx_runtime19.Fragment, { children: [
|
|
2611
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "flex -space-x-1.5", children: visibleAgents.map((agent) => /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: "h-5 w-5 border-2 border-background", children: [
|
|
2612
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2613
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2674
2614
|
AvatarFallback,
|
|
2675
2615
|
{
|
|
2676
2616
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2679,34 +2619,34 @@ var ParticipantsSelector = (0, import_react3.memo)(({
|
|
|
2679
2619
|
}
|
|
2680
2620
|
)
|
|
2681
2621
|
] }, agent.id)) }),
|
|
2682
|
-
hiddenCount > 0 && /* @__PURE__ */ (0,
|
|
2622
|
+
hiddenCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("span", { className: "text-xs text-muted-foreground", children: [
|
|
2683
2623
|
"+",
|
|
2684
2624
|
hiddenCount
|
|
2685
2625
|
] })
|
|
2686
|
-
] }) : /* @__PURE__ */ (0,
|
|
2687
|
-
/* @__PURE__ */ (0,
|
|
2626
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: label }) }),
|
|
2627
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.ChevronDown, { className: "h-3 w-3 opacity-50" })
|
|
2688
2628
|
]
|
|
2689
2629
|
}
|
|
2690
2630
|
) }),
|
|
2691
|
-
/* @__PURE__ */ (0,
|
|
2692
|
-
/* @__PURE__ */ (0,
|
|
2693
|
-
/* @__PURE__ */ (0,
|
|
2694
|
-
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ (0,
|
|
2631
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
|
|
2632
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
|
|
2633
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { children: "Participants" }),
|
|
2634
|
+
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
|
|
2695
2635
|
] }),
|
|
2696
|
-
/* @__PURE__ */ (0,
|
|
2636
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuSeparator, {}),
|
|
2697
2637
|
agentsWithColors.map((agent) => {
|
|
2698
2638
|
const isSelected = participantIds.includes(agent.id);
|
|
2699
2639
|
const isLastSelected = isSelected && participantIds.length === 1;
|
|
2700
|
-
return /* @__PURE__ */ (0,
|
|
2640
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2701
2641
|
DropdownMenuItem,
|
|
2702
2642
|
{
|
|
2703
2643
|
onClick: () => toggleParticipant(agent.id),
|
|
2704
2644
|
className: "flex items-center gap-3 p-2 cursor-pointer",
|
|
2705
2645
|
disabled: isLastSelected,
|
|
2706
2646
|
children: [
|
|
2707
|
-
/* @__PURE__ */ (0,
|
|
2708
|
-
/* @__PURE__ */ (0,
|
|
2709
|
-
/* @__PURE__ */ (0,
|
|
2647
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: "h-6 w-6", children: [
|
|
2648
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2649
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2710
2650
|
AvatarFallback,
|
|
2711
2651
|
{
|
|
2712
2652
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2715,11 +2655,11 @@ var ParticipantsSelector = (0, import_react3.memo)(({
|
|
|
2715
2655
|
}
|
|
2716
2656
|
)
|
|
2717
2657
|
] }),
|
|
2718
|
-
/* @__PURE__ */ (0,
|
|
2719
|
-
/* @__PURE__ */ (0,
|
|
2720
|
-
agent.description && /* @__PURE__ */ (0,
|
|
2658
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2659
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2660
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2721
2661
|
] }),
|
|
2722
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2662
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Check, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2723
2663
|
]
|
|
2724
2664
|
},
|
|
2725
2665
|
agent.id
|
|
@@ -2729,7 +2669,7 @@ var ParticipantsSelector = (0, import_react3.memo)(({
|
|
|
2729
2669
|
] });
|
|
2730
2670
|
});
|
|
2731
2671
|
ParticipantsSelector.displayName = "ParticipantsSelector";
|
|
2732
|
-
var TargetAgentSelector = (0,
|
|
2672
|
+
var TargetAgentSelector = (0, import_react4.memo)(({
|
|
2733
2673
|
agents,
|
|
2734
2674
|
targetAgentId,
|
|
2735
2675
|
onTargetChange,
|
|
@@ -2737,24 +2677,24 @@ var TargetAgentSelector = (0, import_react3.memo)(({
|
|
|
2737
2677
|
placeholder = "Select agent",
|
|
2738
2678
|
disabled = false
|
|
2739
2679
|
}) => {
|
|
2740
|
-
const agentsWithColors = (0,
|
|
2741
|
-
const selectedAgent = (0,
|
|
2680
|
+
const agentsWithColors = (0, import_react4.useMemo)(() => assignAgentColors(agents), [agents]);
|
|
2681
|
+
const selectedAgent = (0, import_react4.useMemo)(
|
|
2742
2682
|
() => agentsWithColors.find((a) => a.id === targetAgentId),
|
|
2743
2683
|
[agentsWithColors, targetAgentId]
|
|
2744
2684
|
);
|
|
2745
|
-
return /* @__PURE__ */ (0,
|
|
2746
|
-
/* @__PURE__ */ (0,
|
|
2685
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenu, { children: [
|
|
2686
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2747
2687
|
Button,
|
|
2748
2688
|
{
|
|
2749
2689
|
variant: "ghost",
|
|
2750
2690
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2751
2691
|
disabled,
|
|
2752
2692
|
children: [
|
|
2753
|
-
/* @__PURE__ */ (0,
|
|
2754
|
-
selectedAgent ? /* @__PURE__ */ (0,
|
|
2755
|
-
/* @__PURE__ */ (0,
|
|
2756
|
-
/* @__PURE__ */ (0,
|
|
2757
|
-
/* @__PURE__ */ (0,
|
|
2693
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.AtSign, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2694
|
+
selectedAgent ? /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2695
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: "h-5 w-5", children: [
|
|
2696
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2697
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2758
2698
|
AvatarFallback,
|
|
2759
2699
|
{
|
|
2760
2700
|
style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
|
|
@@ -2763,26 +2703,26 @@ var TargetAgentSelector = (0, import_react3.memo)(({
|
|
|
2763
2703
|
}
|
|
2764
2704
|
)
|
|
2765
2705
|
] }),
|
|
2766
|
-
/* @__PURE__ */ (0,
|
|
2767
|
-
] }) : /* @__PURE__ */ (0,
|
|
2768
|
-
/* @__PURE__ */ (0,
|
|
2706
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
|
|
2707
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2708
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
2769
2709
|
]
|
|
2770
2710
|
}
|
|
2771
2711
|
) }),
|
|
2772
|
-
/* @__PURE__ */ (0,
|
|
2773
|
-
/* @__PURE__ */ (0,
|
|
2774
|
-
/* @__PURE__ */ (0,
|
|
2712
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
|
|
2713
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuLabel, { children: label }),
|
|
2714
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(DropdownMenuSeparator, {}),
|
|
2775
2715
|
agentsWithColors.map((agent) => {
|
|
2776
2716
|
const isSelected = agent.id === targetAgentId;
|
|
2777
|
-
return /* @__PURE__ */ (0,
|
|
2717
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2778
2718
|
DropdownMenuItem,
|
|
2779
2719
|
{
|
|
2780
2720
|
onClick: () => onTargetChange(agent.id),
|
|
2781
2721
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2782
2722
|
children: [
|
|
2783
|
-
/* @__PURE__ */ (0,
|
|
2784
|
-
/* @__PURE__ */ (0,
|
|
2785
|
-
/* @__PURE__ */ (0,
|
|
2723
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2724
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2725
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2786
2726
|
AvatarFallback,
|
|
2787
2727
|
{
|
|
2788
2728
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2791,12 +2731,12 @@ var TargetAgentSelector = (0, import_react3.memo)(({
|
|
|
2791
2731
|
}
|
|
2792
2732
|
)
|
|
2793
2733
|
] }),
|
|
2794
|
-
/* @__PURE__ */ (0,
|
|
2795
|
-
/* @__PURE__ */ (0,
|
|
2796
|
-
/* @__PURE__ */ (0,
|
|
2797
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2734
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2735
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2736
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2737
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.Check, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2798
2738
|
] }),
|
|
2799
|
-
agent.description && /* @__PURE__ */ (0,
|
|
2739
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2800
2740
|
] })
|
|
2801
2741
|
]
|
|
2802
2742
|
},
|
|
@@ -2807,7 +2747,7 @@ var TargetAgentSelector = (0, import_react3.memo)(({
|
|
|
2807
2747
|
] });
|
|
2808
2748
|
});
|
|
2809
2749
|
TargetAgentSelector.displayName = "TargetAgentSelector";
|
|
2810
|
-
var AgentBadge = (0,
|
|
2750
|
+
var AgentBadge = (0, import_react4.memo)(({
|
|
2811
2751
|
agent,
|
|
2812
2752
|
onRemove,
|
|
2813
2753
|
showRemove = false,
|
|
@@ -2816,16 +2756,16 @@ var AgentBadge = (0, import_react3.memo)(({
|
|
|
2816
2756
|
const color = agent.color || getAgentColor(agent.id);
|
|
2817
2757
|
const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
2818
2758
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
2819
|
-
return /* @__PURE__ */ (0,
|
|
2759
|
+
return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(
|
|
2820
2760
|
Badge,
|
|
2821
2761
|
{
|
|
2822
2762
|
variant: "secondary",
|
|
2823
2763
|
className: "flex items-center gap-1.5 pr-1",
|
|
2824
2764
|
style: { borderColor: color, borderWidth: 1 },
|
|
2825
2765
|
children: [
|
|
2826
|
-
/* @__PURE__ */ (0,
|
|
2827
|
-
/* @__PURE__ */ (0,
|
|
2828
|
-
/* @__PURE__ */ (0,
|
|
2766
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsxs)(Avatar, { className: avatarSize, children: [
|
|
2767
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2768
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2829
2769
|
AvatarFallback,
|
|
2830
2770
|
{
|
|
2831
2771
|
style: { backgroundColor: color, color: "white" },
|
|
@@ -2834,8 +2774,8 @@ var AgentBadge = (0, import_react3.memo)(({
|
|
|
2834
2774
|
}
|
|
2835
2775
|
)
|
|
2836
2776
|
] }),
|
|
2837
|
-
/* @__PURE__ */ (0,
|
|
2838
|
-
showRemove && onRemove && /* @__PURE__ */ (0,
|
|
2777
|
+
/* @__PURE__ */ (0, import_jsx_runtime19.jsx)("span", { className: textSize, children: agent.name }),
|
|
2778
|
+
showRemove && onRemove && /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
|
|
2839
2779
|
Button,
|
|
2840
2780
|
{
|
|
2841
2781
|
variant: "ghost",
|
|
@@ -2845,7 +2785,7 @@ var AgentBadge = (0, import_react3.memo)(({
|
|
|
2845
2785
|
e.stopPropagation();
|
|
2846
2786
|
onRemove();
|
|
2847
2787
|
},
|
|
2848
|
-
children: /* @__PURE__ */ (0,
|
|
2788
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_lucide_react9.X, { className: "h-3 w-3" })
|
|
2849
2789
|
}
|
|
2850
2790
|
)
|
|
2851
2791
|
]
|
|
@@ -2855,7 +2795,7 @@ var AgentBadge = (0, import_react3.memo)(({
|
|
|
2855
2795
|
AgentBadge.displayName = "AgentBadge";
|
|
2856
2796
|
|
|
2857
2797
|
// src/components/chat/ChatHeader.tsx
|
|
2858
|
-
var
|
|
2798
|
+
var import_jsx_runtime20 = require("react/jsx-runtime");
|
|
2859
2799
|
var ChatHeader = ({
|
|
2860
2800
|
config,
|
|
2861
2801
|
currentThreadTitle,
|
|
@@ -2876,11 +2816,11 @@ var ChatHeader = ({
|
|
|
2876
2816
|
onParticipantsChange,
|
|
2877
2817
|
className = ""
|
|
2878
2818
|
}) => {
|
|
2879
|
-
const [isDarkMode, setIsDarkMode] =
|
|
2819
|
+
const [isDarkMode, setIsDarkMode] = import_react5.default.useState(() => {
|
|
2880
2820
|
if (typeof window === "undefined") return false;
|
|
2881
2821
|
return document.documentElement.classList.contains("dark");
|
|
2882
2822
|
});
|
|
2883
|
-
|
|
2823
|
+
import_react5.default.useEffect(() => {
|
|
2884
2824
|
const observer = new MutationObserver(() => {
|
|
2885
2825
|
setIsDarkMode(document.documentElement.classList.contains("dark"));
|
|
2886
2826
|
});
|
|
@@ -2926,19 +2866,19 @@ var ChatHeader = ({
|
|
|
2926
2866
|
};
|
|
2927
2867
|
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2928
2868
|
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2929
|
-
return /* @__PURE__ */ (0,
|
|
2869
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2930
2870
|
Card,
|
|
2931
2871
|
{
|
|
2932
2872
|
"data-chat-header": true,
|
|
2933
2873
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2934
2874
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2935
|
-
children: /* @__PURE__ */ (0,
|
|
2936
|
-
/* @__PURE__ */ (0,
|
|
2937
|
-
/* @__PURE__ */ (0,
|
|
2938
|
-
/* @__PURE__ */ (0,
|
|
2939
|
-
/* @__PURE__ */ (0,
|
|
2875
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(CardHeader, { className: "p-2", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2876
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2877
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Tooltip, { children: [
|
|
2878
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(SidebarTrigger, { className: "-ml-1" }) }),
|
|
2879
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2940
2880
|
] }),
|
|
2941
|
-
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ (0,
|
|
2881
|
+
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2942
2882
|
ParticipantsSelector,
|
|
2943
2883
|
{
|
|
2944
2884
|
agents: agentOptions,
|
|
@@ -2946,40 +2886,40 @@ var ChatHeader = ({
|
|
|
2946
2886
|
onParticipantsChange
|
|
2947
2887
|
}
|
|
2948
2888
|
),
|
|
2949
|
-
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ (0,
|
|
2950
|
-
/* @__PURE__ */ (0,
|
|
2889
|
+
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenu, { children: [
|
|
2890
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2951
2891
|
Button,
|
|
2952
2892
|
{
|
|
2953
2893
|
variant: "ghost",
|
|
2954
2894
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2955
2895
|
children: [
|
|
2956
|
-
selectedAgent?.avatarUrl ? /* @__PURE__ */ (0,
|
|
2957
|
-
/* @__PURE__ */ (0,
|
|
2958
|
-
/* @__PURE__ */ (0,
|
|
2896
|
+
selectedAgent?.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Avatar, { className: "h-5 w-5", children: [
|
|
2897
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2898
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2959
2899
|
] }) : null,
|
|
2960
|
-
/* @__PURE__ */ (0,
|
|
2961
|
-
/* @__PURE__ */ (0,
|
|
2900
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
2901
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.ChevronDown, { className: "h-4 w-4 opacity-50" })
|
|
2962
2902
|
]
|
|
2963
2903
|
}
|
|
2964
2904
|
) }),
|
|
2965
|
-
/* @__PURE__ */ (0,
|
|
2905
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
2966
2906
|
const isSelected = agent.id === selectedAgentId;
|
|
2967
|
-
return /* @__PURE__ */ (0,
|
|
2907
|
+
return /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
2968
2908
|
DropdownMenuItem,
|
|
2969
2909
|
{
|
|
2970
2910
|
onClick: () => onSelectAgent?.(agent.id),
|
|
2971
2911
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2972
2912
|
children: [
|
|
2973
|
-
agent.avatarUrl ? /* @__PURE__ */ (0,
|
|
2974
|
-
/* @__PURE__ */ (0,
|
|
2975
|
-
/* @__PURE__ */ (0,
|
|
2976
|
-
] }) : /* @__PURE__ */ (0,
|
|
2977
|
-
/* @__PURE__ */ (0,
|
|
2978
|
-
/* @__PURE__ */ (0,
|
|
2979
|
-
/* @__PURE__ */ (0,
|
|
2980
|
-
isSelected && /* @__PURE__ */ (0,
|
|
2913
|
+
agent.avatarUrl ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2914
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2915
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
2916
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Bot, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
2917
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
2918
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
2919
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2920
|
+
isSelected && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Check, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2981
2921
|
] }),
|
|
2982
|
-
agent.description && /* @__PURE__ */ (0,
|
|
2922
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2983
2923
|
] })
|
|
2984
2924
|
]
|
|
2985
2925
|
},
|
|
@@ -2987,59 +2927,59 @@ var ChatHeader = ({
|
|
|
2987
2927
|
);
|
|
2988
2928
|
}) })
|
|
2989
2929
|
] }),
|
|
2990
|
-
!showAgentSelector && isMobile && /* @__PURE__ */ (0,
|
|
2930
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
2991
2931
|
] }),
|
|
2992
|
-
/* @__PURE__ */ (0,
|
|
2993
|
-
/* @__PURE__ */ (0,
|
|
2994
|
-
showCustomComponentButton && config.customComponent && /* @__PURE__ */ (0,
|
|
2995
|
-
/* @__PURE__ */ (0,
|
|
2932
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "flex-1" }),
|
|
2933
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
2934
|
+
showCustomComponentButton && config.customComponent && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(Tooltip, { children: [
|
|
2935
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
|
|
2996
2936
|
Button,
|
|
2997
2937
|
{
|
|
2998
2938
|
variant: "ghost",
|
|
2999
2939
|
size: "icon",
|
|
3000
2940
|
className: "h-8 w-8",
|
|
3001
2941
|
onClick: onCustomComponentToggle,
|
|
3002
|
-
children: config.customComponent.icon || /* @__PURE__ */ (0,
|
|
2942
|
+
children: config.customComponent.icon || /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Menu, { className: "h-4 w-4" })
|
|
3003
2943
|
}
|
|
3004
2944
|
) }),
|
|
3005
|
-
/* @__PURE__ */ (0,
|
|
2945
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
3006
2946
|
] }),
|
|
3007
2947
|
config.headerActions,
|
|
3008
|
-
/* @__PURE__ */ (0,
|
|
3009
|
-
/* @__PURE__ */ (0,
|
|
3010
|
-
/* @__PURE__ */ (0,
|
|
3011
|
-
onNewThread && /* @__PURE__ */ (0,
|
|
3012
|
-
/* @__PURE__ */ (0,
|
|
3013
|
-
/* @__PURE__ */ (0,
|
|
2948
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenu, { children: [
|
|
2949
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
2950
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
2951
|
+
onNewThread && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2952
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
2953
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Plus, { className: "h-4 w-4 mr-2" }),
|
|
3014
2954
|
config.labels?.newThread || "New Thread"
|
|
3015
2955
|
] }),
|
|
3016
|
-
/* @__PURE__ */ (0,
|
|
2956
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuSeparator, {})
|
|
3017
2957
|
] }),
|
|
3018
|
-
onExportData && /* @__PURE__ */ (0,
|
|
3019
|
-
/* @__PURE__ */ (0,
|
|
2958
|
+
onExportData && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenuItem, { onClick: onExportData, children: [
|
|
2959
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Download, { className: "h-4 w-4 mr-2" }),
|
|
3020
2960
|
config.labels?.exportData || "Export Data"
|
|
3021
2961
|
] }),
|
|
3022
|
-
onImportData && /* @__PURE__ */ (0,
|
|
3023
|
-
/* @__PURE__ */ (0,
|
|
2962
|
+
onImportData && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
2963
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Upload, { className: "h-4 w-4 mr-2" }),
|
|
3024
2964
|
config.labels?.importData || "Import Data"
|
|
3025
2965
|
] }),
|
|
3026
|
-
(onExportData || onImportData) && /* @__PURE__ */ (0,
|
|
3027
|
-
/* @__PURE__ */ (0,
|
|
3028
|
-
/* @__PURE__ */ (0,
|
|
2966
|
+
(onExportData || onImportData) && /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuSeparator, {}),
|
|
2967
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2968
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Sun, { className: "h-4 w-4 mr-2" }),
|
|
3029
2969
|
config.labels?.lightMode || "Light Mode"
|
|
3030
|
-
] }) : /* @__PURE__ */ (0,
|
|
3031
|
-
/* @__PURE__ */ (0,
|
|
2970
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2971
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Moon, { className: "h-4 w-4 mr-2" }),
|
|
3032
2972
|
config.labels?.darkMode || "Dark Mode"
|
|
3033
2973
|
] }) }),
|
|
3034
|
-
onClearAll && /* @__PURE__ */ (0,
|
|
3035
|
-
/* @__PURE__ */ (0,
|
|
3036
|
-
/* @__PURE__ */ (0,
|
|
2974
|
+
onClearAll && /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_jsx_runtime20.Fragment, { children: [
|
|
2975
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(DropdownMenuSeparator, {}),
|
|
2976
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(
|
|
3037
2977
|
DropdownMenuItem,
|
|
3038
2978
|
{
|
|
3039
2979
|
onClick: onClearAll,
|
|
3040
2980
|
className: "text-destructive",
|
|
3041
2981
|
children: [
|
|
3042
|
-
/* @__PURE__ */ (0,
|
|
2982
|
+
/* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_lucide_react10.Trash2, { className: "h-4 w-4 mr-2" }),
|
|
3043
2983
|
config.labels?.clearAll || "Clear All"
|
|
3044
2984
|
]
|
|
3045
2985
|
}
|
|
@@ -3054,18 +2994,18 @@ var ChatHeader = ({
|
|
|
3054
2994
|
};
|
|
3055
2995
|
|
|
3056
2996
|
// src/components/chat/ChatInput.tsx
|
|
3057
|
-
var
|
|
2997
|
+
var import_react7 = __toESM(require("react"), 1);
|
|
3058
2998
|
|
|
3059
2999
|
// src/components/chat/UserContext.tsx
|
|
3060
|
-
var
|
|
3061
|
-
var
|
|
3062
|
-
var Ctx = (0,
|
|
3000
|
+
var import_react6 = require("react");
|
|
3001
|
+
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
3002
|
+
var Ctx = (0, import_react6.createContext)(void 0);
|
|
3063
3003
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
3064
|
-
const [ctx, setCtx] = (0,
|
|
3004
|
+
const [ctx, setCtx] = (0, import_react6.useState)(() => ({
|
|
3065
3005
|
updatedAt: Date.now(),
|
|
3066
3006
|
...initial ?? {}
|
|
3067
3007
|
}));
|
|
3068
|
-
(0,
|
|
3008
|
+
(0, import_react6.useEffect)(() => {
|
|
3069
3009
|
if (!initial) return;
|
|
3070
3010
|
setCtx((prev) => {
|
|
3071
3011
|
const keys = Object.keys(initial);
|
|
@@ -3074,21 +3014,21 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
3074
3014
|
return { ...prev, ...initial, updatedAt: Date.now() };
|
|
3075
3015
|
});
|
|
3076
3016
|
}, [initial]);
|
|
3077
|
-
const setPartial = (0,
|
|
3017
|
+
const setPartial = (0, import_react6.useCallback)((next) => {
|
|
3078
3018
|
setCtx((prev) => {
|
|
3079
3019
|
const partial = typeof next === "function" ? next(prev) : next;
|
|
3080
3020
|
return { ...prev, ...partial, updatedAt: Date.now() };
|
|
3081
3021
|
});
|
|
3082
3022
|
}, []);
|
|
3083
|
-
const value = (0,
|
|
3023
|
+
const value = (0, import_react6.useMemo)(() => ({
|
|
3084
3024
|
context: ctx,
|
|
3085
3025
|
setContext: setPartial,
|
|
3086
3026
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
3087
3027
|
}), [ctx, setPartial]);
|
|
3088
|
-
return /* @__PURE__ */ (0,
|
|
3028
|
+
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(Ctx.Provider, { value, children });
|
|
3089
3029
|
};
|
|
3090
3030
|
function useChatUserContext() {
|
|
3091
|
-
const v = (0,
|
|
3031
|
+
const v = (0, import_react6.useContext)(Ctx);
|
|
3092
3032
|
if (!v) throw new Error("useChatUserContext must be used within ChatUserContextProvider");
|
|
3093
3033
|
return v;
|
|
3094
3034
|
}
|
|
@@ -3419,13 +3359,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
|
|
|
3419
3359
|
|
|
3420
3360
|
// src/components/ui/progress.tsx
|
|
3421
3361
|
var ProgressPrimitive = __toESM(require("@radix-ui/react-progress"), 1);
|
|
3422
|
-
var
|
|
3362
|
+
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
3423
3363
|
function Progress({
|
|
3424
3364
|
className,
|
|
3425
3365
|
value,
|
|
3426
3366
|
...props
|
|
3427
3367
|
}) {
|
|
3428
|
-
return /* @__PURE__ */ (0,
|
|
3368
|
+
return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3429
3369
|
ProgressPrimitive.Root,
|
|
3430
3370
|
{
|
|
3431
3371
|
"data-slot": "progress",
|
|
@@ -3434,7 +3374,7 @@ function Progress({
|
|
|
3434
3374
|
className
|
|
3435
3375
|
),
|
|
3436
3376
|
...props,
|
|
3437
|
-
children: /* @__PURE__ */ (0,
|
|
3377
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
|
|
3438
3378
|
ProgressPrimitive.Indicator,
|
|
3439
3379
|
{
|
|
3440
3380
|
"data-slot": "progress-indicator",
|
|
@@ -3447,8 +3387,8 @@ function Progress({
|
|
|
3447
3387
|
}
|
|
3448
3388
|
|
|
3449
3389
|
// src/components/chat/VoiceComposer.tsx
|
|
3450
|
-
var
|
|
3451
|
-
var
|
|
3390
|
+
var import_lucide_react11 = require("lucide-react");
|
|
3391
|
+
var import_jsx_runtime23 = require("react/jsx-runtime");
|
|
3452
3392
|
var formatDuration = (durationMs) => {
|
|
3453
3393
|
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
3454
3394
|
const minutes = Math.floor(totalSeconds / 60);
|
|
@@ -3543,13 +3483,13 @@ var VoiceComposer = ({
|
|
|
3543
3483
|
}
|
|
3544
3484
|
onRecordAgain();
|
|
3545
3485
|
};
|
|
3546
|
-
return /* @__PURE__ */ (0,
|
|
3547
|
-
/* @__PURE__ */ (0,
|
|
3548
|
-
/* @__PURE__ */ (0,
|
|
3549
|
-
/* @__PURE__ */ (0,
|
|
3550
|
-
/* @__PURE__ */ (0,
|
|
3486
|
+
return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
|
|
3487
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
|
|
3488
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3489
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
|
|
3490
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
|
|
3551
3491
|
] }),
|
|
3552
|
-
/* @__PURE__ */ (0,
|
|
3492
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(
|
|
3553
3493
|
Button,
|
|
3554
3494
|
{
|
|
3555
3495
|
type: "button",
|
|
@@ -3559,14 +3499,14 @@ var VoiceComposer = ({
|
|
|
3559
3499
|
onClick: onExit,
|
|
3560
3500
|
disabled: disabled || isBusy,
|
|
3561
3501
|
children: [
|
|
3562
|
-
/* @__PURE__ */ (0,
|
|
3563
|
-
/* @__PURE__ */ (0,
|
|
3502
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Keyboard, { className: "h-4 w-4" }),
|
|
3503
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
|
|
3564
3504
|
]
|
|
3565
3505
|
}
|
|
3566
3506
|
)
|
|
3567
3507
|
] }),
|
|
3568
|
-
!isDraftLayout ? /* @__PURE__ */ (0,
|
|
3569
|
-
/* @__PURE__ */ (0,
|
|
3508
|
+
!isDraftLayout ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
|
|
3509
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3570
3510
|
Button,
|
|
3571
3511
|
{
|
|
3572
3512
|
type: "button",
|
|
@@ -3575,21 +3515,21 @@ var VoiceComposer = ({
|
|
|
3575
3515
|
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"}`,
|
|
3576
3516
|
onClick: isCapturing ? onStop : onStart,
|
|
3577
3517
|
disabled: disabled || isBusy,
|
|
3578
|
-
children: isBusy ? /* @__PURE__ */ (0,
|
|
3518
|
+
children: isBusy ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Square, { className: "h-7 w-7" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Mic, { className: "h-7 w-7" })
|
|
3579
3519
|
}
|
|
3580
3520
|
),
|
|
3581
|
-
/* @__PURE__ */ (0,
|
|
3582
|
-
/* @__PURE__ */ (0,
|
|
3583
|
-
/* @__PURE__ */ (0,
|
|
3584
|
-
/* @__PURE__ */ (0,
|
|
3585
|
-
/* @__PURE__ */ (0,
|
|
3521
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "w-full space-y-2", children: [
|
|
3522
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(Progress, { value: levelValue, className: "h-2" }),
|
|
3523
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
3524
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: formatDuration(durationMs) }),
|
|
3525
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
|
|
3586
3526
|
] })
|
|
3587
3527
|
] }),
|
|
3588
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0,
|
|
3589
|
-
] }) }) : /* @__PURE__ */ (0,
|
|
3590
|
-
/* @__PURE__ */ (0,
|
|
3591
|
-
/* @__PURE__ */ (0,
|
|
3592
|
-
/* @__PURE__ */ (0,
|
|
3528
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
|
|
3529
|
+
] }) }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
|
|
3530
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
|
|
3531
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("span", { children: formatDuration(durationMs) }),
|
|
3532
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3593
3533
|
Button,
|
|
3594
3534
|
{
|
|
3595
3535
|
type: "button",
|
|
@@ -3600,12 +3540,12 @@ var VoiceComposer = ({
|
|
|
3600
3540
|
disabled,
|
|
3601
3541
|
"aria-label": labels?.voiceDiscard || "Delete recording",
|
|
3602
3542
|
title: labels?.voiceDiscard || "Delete recording",
|
|
3603
|
-
children: /* @__PURE__ */ (0,
|
|
3543
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Trash2, { className: "h-4 w-4" })
|
|
3604
3544
|
}
|
|
3605
3545
|
)
|
|
3606
3546
|
] }),
|
|
3607
|
-
/* @__PURE__ */ (0,
|
|
3608
|
-
/* @__PURE__ */ (0,
|
|
3547
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
|
|
3548
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3609
3549
|
Button,
|
|
3610
3550
|
{
|
|
3611
3551
|
type: "button",
|
|
@@ -3614,12 +3554,12 @@ var VoiceComposer = ({
|
|
|
3614
3554
|
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"}`,
|
|
3615
3555
|
onClick: handleReviewOrbClick,
|
|
3616
3556
|
disabled: disabled || orbIsReviewBusy,
|
|
3617
|
-
children: orbIsReviewBusy ? /* @__PURE__ */ (0,
|
|
3557
|
+
children: orbIsReviewBusy ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Mic, { className: "h-7 w-7" })
|
|
3618
3558
|
}
|
|
3619
3559
|
),
|
|
3620
|
-
/* @__PURE__ */ (0,
|
|
3621
|
-
/* @__PURE__ */ (0,
|
|
3622
|
-
isCapturing && /* @__PURE__ */ (0,
|
|
3560
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "max-w-sm space-y-1 px-2", children: [
|
|
3561
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)("p", { className: "text-sm text-foreground", children: reviewHelperText }),
|
|
3562
|
+
isCapturing && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
|
|
3623
3563
|
"div",
|
|
3624
3564
|
{
|
|
3625
3565
|
className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
|
|
@@ -3628,27 +3568,27 @@ var VoiceComposer = ({
|
|
|
3628
3568
|
) })
|
|
3629
3569
|
] })
|
|
3630
3570
|
] }),
|
|
3631
|
-
attachment && /* @__PURE__ */ (0,
|
|
3632
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0,
|
|
3633
|
-
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ (0,
|
|
3634
|
-
/* @__PURE__ */ (0,
|
|
3635
|
-
isAutoSendActive && /* @__PURE__ */ (0,
|
|
3636
|
-
/* @__PURE__ */ (0,
|
|
3571
|
+
attachment && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
|
|
3572
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
|
|
3573
|
+
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("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) }) }),
|
|
3574
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
|
|
3575
|
+
isAutoSendActive && /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
|
|
3576
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.X, { className: "h-4 w-4" }),
|
|
3637
3577
|
labels?.voiceCancel || "Cancel"
|
|
3638
3578
|
] }),
|
|
3639
|
-
/* @__PURE__ */ (0,
|
|
3640
|
-
/* @__PURE__ */ (0,
|
|
3579
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
|
|
3580
|
+
/* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_lucide_react11.Send, { className: "h-4 w-4" }),
|
|
3641
3581
|
labels?.voiceSendNow || "Send now"
|
|
3642
3582
|
] })
|
|
3643
3583
|
] })
|
|
3644
3584
|
] }),
|
|
3645
|
-
errorMessage && /* @__PURE__ */ (0,
|
|
3585
|
+
errorMessage && /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
|
|
3646
3586
|
] });
|
|
3647
3587
|
};
|
|
3648
3588
|
|
|
3649
3589
|
// src/components/chat/ChatInput.tsx
|
|
3650
|
-
var
|
|
3651
|
-
var
|
|
3590
|
+
var import_lucide_react12 = require("lucide-react");
|
|
3591
|
+
var import_jsx_runtime24 = require("react/jsx-runtime");
|
|
3652
3592
|
function getActiveMentionMatch(value, caret) {
|
|
3653
3593
|
const prefix = value.slice(0, caret);
|
|
3654
3594
|
const match = /(^|\s)@([\w.-]*)$/.exec(prefix);
|
|
@@ -3672,7 +3612,7 @@ function resolveTargetFromMentions(value, agents) {
|
|
|
3672
3612
|
}
|
|
3673
3613
|
return null;
|
|
3674
3614
|
}
|
|
3675
|
-
var FileUploadItem = (0,
|
|
3615
|
+
var FileUploadItem = (0, import_react7.memo)(function FileUploadItem2({ file, progress, onCancel }) {
|
|
3676
3616
|
const guessTypeFromName = (name) => {
|
|
3677
3617
|
const ext = (name || "").split(".").pop()?.toLowerCase();
|
|
3678
3618
|
switch (ext) {
|
|
@@ -3700,10 +3640,10 @@ var FileUploadItem = (0, import_react6.memo)(function FileUploadItem2({ file, pr
|
|
|
3700
3640
|
};
|
|
3701
3641
|
const getFileIcon = (type, name) => {
|
|
3702
3642
|
const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
|
|
3703
|
-
if (t.startsWith("image/")) return /* @__PURE__ */ (0,
|
|
3704
|
-
if (t.startsWith("video/")) return /* @__PURE__ */ (0,
|
|
3705
|
-
if (t.startsWith("audio/")) return /* @__PURE__ */ (0,
|
|
3706
|
-
return /* @__PURE__ */ (0,
|
|
3643
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Image, { className: "h-4 w-4" });
|
|
3644
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Video, { className: "h-4 w-4" });
|
|
3645
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Mic, { className: "h-4 w-4" });
|
|
3646
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.FileText, { className: "h-4 w-4" });
|
|
3707
3647
|
};
|
|
3708
3648
|
const formatFileSize = (bytes) => {
|
|
3709
3649
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -3712,30 +3652,30 @@ var FileUploadItem = (0, import_react6.memo)(function FileUploadItem2({ file, pr
|
|
|
3712
3652
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
3713
3653
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3714
3654
|
};
|
|
3715
|
-
return /* @__PURE__ */ (0,
|
|
3655
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CardContent, { className: "p-3", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-3", children: [
|
|
3716
3656
|
getFileIcon(file.type, file.name),
|
|
3717
|
-
/* @__PURE__ */ (0,
|
|
3718
|
-
/* @__PURE__ */ (0,
|
|
3719
|
-
/* @__PURE__ */ (0,
|
|
3720
|
-
/* @__PURE__ */ (0,
|
|
3657
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
3658
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3659
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
3660
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Progress, { value: progress, className: "h-1 mt-1" })
|
|
3721
3661
|
] }),
|
|
3722
|
-
/* @__PURE__ */ (0,
|
|
3662
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3723
3663
|
Button,
|
|
3724
3664
|
{
|
|
3725
3665
|
variant: "ghost",
|
|
3726
3666
|
size: "icon",
|
|
3727
3667
|
className: "h-6 w-6",
|
|
3728
3668
|
onClick: onCancel,
|
|
3729
|
-
children: /* @__PURE__ */ (0,
|
|
3669
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { className: "h-3 w-3" })
|
|
3730
3670
|
}
|
|
3731
3671
|
)
|
|
3732
3672
|
] }) }) });
|
|
3733
3673
|
});
|
|
3734
|
-
var AttachmentPreview = (0,
|
|
3735
|
-
const [isPlaying, setIsPlaying] = (0,
|
|
3736
|
-
const [audioPlaybackSrc, setAudioPlaybackSrc] = (0,
|
|
3737
|
-
const audioRef = (0,
|
|
3738
|
-
(0,
|
|
3674
|
+
var AttachmentPreview = (0, import_react7.memo)(function AttachmentPreview2({ attachment, onRemove }) {
|
|
3675
|
+
const [isPlaying, setIsPlaying] = (0, import_react7.useState)(false);
|
|
3676
|
+
const [audioPlaybackSrc, setAudioPlaybackSrc] = (0, import_react7.useState)(attachment.dataUrl);
|
|
3677
|
+
const audioRef = (0, import_react7.useRef)(null);
|
|
3678
|
+
(0, import_react7.useEffect)(() => {
|
|
3739
3679
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
3740
3680
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
3741
3681
|
return;
|
|
@@ -3766,9 +3706,9 @@ var AttachmentPreview = (0, import_react6.memo)(function AttachmentPreview2({ at
|
|
|
3766
3706
|
const minutes = Math.floor(seconds / 60);
|
|
3767
3707
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
3768
3708
|
};
|
|
3769
|
-
return /* @__PURE__ */ (0,
|
|
3770
|
-
attachment.kind === "image" && /* @__PURE__ */ (0,
|
|
3771
|
-
/* @__PURE__ */ (0,
|
|
3709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Card, { className: "relative group", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(CardContent, { className: "p-2", children: [
|
|
3710
|
+
attachment.kind === "image" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
|
|
3711
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3772
3712
|
"img",
|
|
3773
3713
|
{
|
|
3774
3714
|
src: attachment.dataUrl,
|
|
@@ -3776,19 +3716,19 @@ var AttachmentPreview = (0, import_react6.memo)(function AttachmentPreview2({ at
|
|
|
3776
3716
|
className: "w-full h-20 object-cover rounded"
|
|
3777
3717
|
}
|
|
3778
3718
|
),
|
|
3779
|
-
/* @__PURE__ */ (0,
|
|
3719
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3780
3720
|
Button,
|
|
3781
3721
|
{
|
|
3782
3722
|
variant: "destructive",
|
|
3783
3723
|
size: "icon",
|
|
3784
3724
|
className: "h-6 w-6",
|
|
3785
3725
|
onClick: onRemove,
|
|
3786
|
-
children: /* @__PURE__ */ (0,
|
|
3726
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { className: "h-3 w-3" })
|
|
3787
3727
|
}
|
|
3788
3728
|
) })
|
|
3789
3729
|
] }),
|
|
3790
|
-
attachment.kind === "video" && /* @__PURE__ */ (0,
|
|
3791
|
-
/* @__PURE__ */ (0,
|
|
3730
|
+
attachment.kind === "video" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative", children: [
|
|
3731
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3792
3732
|
"video",
|
|
3793
3733
|
{
|
|
3794
3734
|
src: attachment.dataUrl,
|
|
@@ -3797,34 +3737,34 @@ var AttachmentPreview = (0, import_react6.memo)(function AttachmentPreview2({ at
|
|
|
3797
3737
|
muted: true
|
|
3798
3738
|
}
|
|
3799
3739
|
),
|
|
3800
|
-
/* @__PURE__ */ (0,
|
|
3740
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3801
3741
|
Button,
|
|
3802
3742
|
{
|
|
3803
3743
|
variant: "destructive",
|
|
3804
3744
|
size: "icon",
|
|
3805
3745
|
className: "h-6 w-6",
|
|
3806
3746
|
onClick: onRemove,
|
|
3807
|
-
children: /* @__PURE__ */ (0,
|
|
3747
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { className: "h-3 w-3" })
|
|
3808
3748
|
}
|
|
3809
3749
|
) }),
|
|
3810
|
-
/* @__PURE__ */ (0,
|
|
3750
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
|
|
3811
3751
|
] }),
|
|
3812
|
-
attachment.kind === "audio" && /* @__PURE__ */ (0,
|
|
3813
|
-
/* @__PURE__ */ (0,
|
|
3752
|
+
attachment.kind === "audio" && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex items-center gap-2 p-2", children: [
|
|
3753
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3814
3754
|
Button,
|
|
3815
3755
|
{
|
|
3816
3756
|
variant: "outline",
|
|
3817
3757
|
size: "icon",
|
|
3818
3758
|
className: "h-8 w-8",
|
|
3819
3759
|
onClick: handlePlayPause,
|
|
3820
|
-
children: isPlaying ? /* @__PURE__ */ (0,
|
|
3760
|
+
children: isPlaying ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Play, { className: "h-3 w-3" })
|
|
3821
3761
|
}
|
|
3822
3762
|
),
|
|
3823
|
-
/* @__PURE__ */ (0,
|
|
3824
|
-
/* @__PURE__ */ (0,
|
|
3825
|
-
/* @__PURE__ */ (0,
|
|
3763
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex-1", children: [
|
|
3764
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
|
|
3765
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
|
|
3826
3766
|
] }),
|
|
3827
|
-
/* @__PURE__ */ (0,
|
|
3767
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3828
3768
|
"audio",
|
|
3829
3769
|
{
|
|
3830
3770
|
ref: audioRef,
|
|
@@ -3832,21 +3772,21 @@ var AttachmentPreview = (0, import_react6.memo)(function AttachmentPreview2({ at
|
|
|
3832
3772
|
onPause: () => setIsPlaying(false),
|
|
3833
3773
|
onEnded: () => setIsPlaying(false),
|
|
3834
3774
|
preload: "metadata",
|
|
3835
|
-
children: /* @__PURE__ */ (0,
|
|
3775
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
3836
3776
|
}
|
|
3837
3777
|
),
|
|
3838
|
-
/* @__PURE__ */ (0,
|
|
3778
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
3839
3779
|
Button,
|
|
3840
3780
|
{
|
|
3841
3781
|
variant: "ghost",
|
|
3842
3782
|
size: "icon",
|
|
3843
3783
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3844
3784
|
onClick: onRemove,
|
|
3845
|
-
children: /* @__PURE__ */ (0,
|
|
3785
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.X, { className: "h-3 w-3" })
|
|
3846
3786
|
}
|
|
3847
3787
|
)
|
|
3848
3788
|
] }),
|
|
3849
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ (0,
|
|
3789
|
+
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("p", { className: "truncate", children: attachment.fileName }) })
|
|
3850
3790
|
] }) });
|
|
3851
3791
|
});
|
|
3852
3792
|
var resolveVoiceErrorMessage = (error, config) => {
|
|
@@ -3860,7 +3800,7 @@ var resolveVoiceErrorMessage = (error, config) => {
|
|
|
3860
3800
|
};
|
|
3861
3801
|
var clearVoiceTranscript = () => ({});
|
|
3862
3802
|
var resolveVoiceSegmentDuration = (segment) => segment.attachment.durationMs ?? 0;
|
|
3863
|
-
var ChatInput = (0,
|
|
3803
|
+
var ChatInput = (0, import_react7.memo)(function ChatInput2({
|
|
3864
3804
|
value,
|
|
3865
3805
|
onChange,
|
|
3866
3806
|
onSubmit,
|
|
@@ -3889,27 +3829,27 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
3889
3829
|
const voiceTranscriptMode = config?.voiceCompose?.transcriptMode ?? "final-only";
|
|
3890
3830
|
const voiceMaxRecordingMs = config?.voiceCompose?.maxRecordingMs;
|
|
3891
3831
|
const { setContext } = useChatUserContext();
|
|
3892
|
-
const [uploadProgress, setUploadProgress] = (0,
|
|
3893
|
-
const [isVoiceComposerOpen, setIsVoiceComposerOpen] = (0,
|
|
3832
|
+
const [uploadProgress, setUploadProgress] = (0, import_react7.useState)(/* @__PURE__ */ new Map());
|
|
3833
|
+
const [isVoiceComposerOpen, setIsVoiceComposerOpen] = (0, import_react7.useState)(
|
|
3894
3834
|
() => enableAudioRecording && voiceDefaultMode === "voice"
|
|
3895
3835
|
);
|
|
3896
|
-
const [voiceState, setVoiceState] = (0,
|
|
3897
|
-
const [voiceDraft, setVoiceDraft] = (0,
|
|
3898
|
-
const [voiceTranscript, setVoiceTranscript] = (0,
|
|
3899
|
-
const [voiceDurationMs, setVoiceDurationMs] = (0,
|
|
3900
|
-
const [voiceAudioLevel, setVoiceAudioLevel] = (0,
|
|
3901
|
-
const [voiceCountdownMs, setVoiceCountdownMs] = (0,
|
|
3902
|
-
const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = (0,
|
|
3903
|
-
const [voiceError, setVoiceError] = (0,
|
|
3904
|
-
const [activeMention, setActiveMention] = (0,
|
|
3905
|
-
const [activeMentionIndex, setActiveMentionIndex] = (0,
|
|
3906
|
-
const textareaRef = (0,
|
|
3907
|
-
const fileInputRef = (0,
|
|
3908
|
-
const voiceProviderRef = (0,
|
|
3909
|
-
const voiceDraftRef = (0,
|
|
3910
|
-
const voiceAppendBaseRef = (0,
|
|
3911
|
-
const voiceAppendBaseDurationRef = (0,
|
|
3912
|
-
const filteredMentionAgents =
|
|
3836
|
+
const [voiceState, setVoiceState] = (0, import_react7.useState)("idle");
|
|
3837
|
+
const [voiceDraft, setVoiceDraft] = (0, import_react7.useState)(null);
|
|
3838
|
+
const [voiceTranscript, setVoiceTranscript] = (0, import_react7.useState)(clearVoiceTranscript);
|
|
3839
|
+
const [voiceDurationMs, setVoiceDurationMs] = (0, import_react7.useState)(0);
|
|
3840
|
+
const [voiceAudioLevel, setVoiceAudioLevel] = (0, import_react7.useState)(0);
|
|
3841
|
+
const [voiceCountdownMs, setVoiceCountdownMs] = (0, import_react7.useState)(0);
|
|
3842
|
+
const [isVoiceAutoSendActive, setIsVoiceAutoSendActive] = (0, import_react7.useState)(false);
|
|
3843
|
+
const [voiceError, setVoiceError] = (0, import_react7.useState)(null);
|
|
3844
|
+
const [activeMention, setActiveMention] = (0, import_react7.useState)(null);
|
|
3845
|
+
const [activeMentionIndex, setActiveMentionIndex] = (0, import_react7.useState)(0);
|
|
3846
|
+
const textareaRef = (0, import_react7.useRef)(null);
|
|
3847
|
+
const fileInputRef = (0, import_react7.useRef)(null);
|
|
3848
|
+
const voiceProviderRef = (0, import_react7.useRef)(null);
|
|
3849
|
+
const voiceDraftRef = (0, import_react7.useRef)(null);
|
|
3850
|
+
const voiceAppendBaseRef = (0, import_react7.useRef)(null);
|
|
3851
|
+
const voiceAppendBaseDurationRef = (0, import_react7.useRef)(0);
|
|
3852
|
+
const filteredMentionAgents = import_react7.default.useMemo(() => {
|
|
3913
3853
|
if (!activeMention || mentionAgents.length === 0) return [];
|
|
3914
3854
|
const query = activeMention.query.trim().toLowerCase();
|
|
3915
3855
|
const rank = (agent) => {
|
|
@@ -3927,7 +3867,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
3927
3867
|
}).slice(0, 6);
|
|
3928
3868
|
}, [activeMention, mentionAgents]);
|
|
3929
3869
|
const isMentionMenuOpen = filteredMentionAgents.length > 0;
|
|
3930
|
-
const syncMentionState = (0,
|
|
3870
|
+
const syncMentionState = (0, import_react7.useCallback)((nextValue, nextCaret) => {
|
|
3931
3871
|
const caret = typeof nextCaret === "number" ? nextCaret : textareaRef.current?.selectionStart ?? nextValue.length;
|
|
3932
3872
|
const nextMatch = getActiveMentionMatch(nextValue, caret);
|
|
3933
3873
|
setActiveMention((prev) => {
|
|
@@ -3938,7 +3878,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
3938
3878
|
});
|
|
3939
3879
|
setActiveMentionIndex(0);
|
|
3940
3880
|
}, []);
|
|
3941
|
-
(0,
|
|
3881
|
+
(0, import_react7.useEffect)(() => {
|
|
3942
3882
|
return () => {
|
|
3943
3883
|
if (voiceProviderRef.current) {
|
|
3944
3884
|
void voiceProviderRef.current.destroy();
|
|
@@ -3946,10 +3886,10 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
3946
3886
|
}
|
|
3947
3887
|
};
|
|
3948
3888
|
}, []);
|
|
3949
|
-
(0,
|
|
3889
|
+
(0, import_react7.useEffect)(() => {
|
|
3950
3890
|
voiceDraftRef.current = voiceDraft;
|
|
3951
3891
|
}, [voiceDraft]);
|
|
3952
|
-
(0,
|
|
3892
|
+
(0, import_react7.useEffect)(() => {
|
|
3953
3893
|
if (!isMentionMenuOpen) {
|
|
3954
3894
|
setActiveMentionIndex(0);
|
|
3955
3895
|
return;
|
|
@@ -3958,7 +3898,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
3958
3898
|
(prev) => prev >= filteredMentionAgents.length ? 0 : prev
|
|
3959
3899
|
);
|
|
3960
3900
|
}, [filteredMentionAgents.length, isMentionMenuOpen]);
|
|
3961
|
-
const selectMentionAgent = (0,
|
|
3901
|
+
const selectMentionAgent = (0, import_react7.useCallback)((agent) => {
|
|
3962
3902
|
if (!activeMention) return;
|
|
3963
3903
|
const replacement = `@${agent.name} `;
|
|
3964
3904
|
const nextValue = value.slice(0, activeMention.start) + replacement + value.slice(activeMention.end);
|
|
@@ -4096,7 +4036,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4096
4036
|
}
|
|
4097
4037
|
e.target.value = "";
|
|
4098
4038
|
};
|
|
4099
|
-
const handleDrop = (0,
|
|
4039
|
+
const handleDrop = (0, import_react7.useCallback)(async (e) => {
|
|
4100
4040
|
e.preventDefault();
|
|
4101
4041
|
if (!enableFileUpload) return;
|
|
4102
4042
|
const files = Array.from(e.dataTransfer.files);
|
|
@@ -4109,10 +4049,10 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4109
4049
|
}
|
|
4110
4050
|
}
|
|
4111
4051
|
}, [attachments, enableFileUpload, maxAttachments, onAttachmentsChange]);
|
|
4112
|
-
const handleDragOver = (0,
|
|
4052
|
+
const handleDragOver = (0, import_react7.useCallback)((e) => {
|
|
4113
4053
|
e.preventDefault();
|
|
4114
4054
|
}, []);
|
|
4115
|
-
const resetVoiceComposerState = (0,
|
|
4055
|
+
const resetVoiceComposerState = (0, import_react7.useCallback)((nextState = "idle") => {
|
|
4116
4056
|
setVoiceState(nextState);
|
|
4117
4057
|
setVoiceDraft(null);
|
|
4118
4058
|
voiceDraftRef.current = null;
|
|
@@ -4125,11 +4065,11 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4125
4065
|
setIsVoiceAutoSendActive(false);
|
|
4126
4066
|
setVoiceError(null);
|
|
4127
4067
|
}, []);
|
|
4128
|
-
const armVoiceDraftForAppend = (0,
|
|
4068
|
+
const armVoiceDraftForAppend = (0, import_react7.useCallback)((segment) => {
|
|
4129
4069
|
voiceAppendBaseRef.current = segment;
|
|
4130
4070
|
voiceAppendBaseDurationRef.current = segment ? resolveVoiceSegmentDuration(segment) : 0;
|
|
4131
4071
|
}, []);
|
|
4132
|
-
const handleVoiceProviderStateChange = (0,
|
|
4072
|
+
const handleVoiceProviderStateChange = (0, import_react7.useCallback)((nextState) => {
|
|
4133
4073
|
if (voiceReviewMode === "armed" && (nextState === "waiting_for_speech" || nextState === "listening")) {
|
|
4134
4074
|
const currentDraft = voiceDraftRef.current;
|
|
4135
4075
|
if (currentDraft) {
|
|
@@ -4142,7 +4082,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4142
4082
|
}
|
|
4143
4083
|
setVoiceState(nextState);
|
|
4144
4084
|
}, [armVoiceDraftForAppend, voiceAutoSendDelayMs, voiceReviewMode]);
|
|
4145
|
-
const ensureVoiceProvider = (0,
|
|
4085
|
+
const ensureVoiceProvider = (0, import_react7.useCallback)(async () => {
|
|
4146
4086
|
if (voiceProviderRef.current) {
|
|
4147
4087
|
return voiceProviderRef.current;
|
|
4148
4088
|
}
|
|
@@ -4229,7 +4169,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4229
4169
|
voiceProviderRef.current = provider;
|
|
4230
4170
|
return provider;
|
|
4231
4171
|
}, [armVoiceDraftForAppend, config, handleVoiceProviderStateChange, voiceAutoSendDelayMs, voiceMaxRecordingMs, voiceReviewMode]);
|
|
4232
|
-
const closeVoiceComposer = (0,
|
|
4172
|
+
const closeVoiceComposer = (0, import_react7.useCallback)(async () => {
|
|
4233
4173
|
voiceAppendBaseRef.current = null;
|
|
4234
4174
|
voiceAppendBaseDurationRef.current = 0;
|
|
4235
4175
|
setIsVoiceComposerOpen(false);
|
|
@@ -4245,7 +4185,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4245
4185
|
await voiceProviderRef.current.cancel();
|
|
4246
4186
|
}
|
|
4247
4187
|
}, []);
|
|
4248
|
-
const startVoiceCapture = (0,
|
|
4188
|
+
const startVoiceCapture = (0, import_react7.useCallback)(async (appendToDraft = false) => {
|
|
4249
4189
|
if (disabled || isGenerating) {
|
|
4250
4190
|
return;
|
|
4251
4191
|
}
|
|
@@ -4294,7 +4234,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4294
4234
|
setVoiceState("error");
|
|
4295
4235
|
}
|
|
4296
4236
|
}, [disabled, isGenerating, ensureVoiceProvider, config]);
|
|
4297
|
-
const stopVoiceCapture = (0,
|
|
4237
|
+
const stopVoiceCapture = (0, import_react7.useCallback)(async () => {
|
|
4298
4238
|
if (!voiceProviderRef.current) return;
|
|
4299
4239
|
try {
|
|
4300
4240
|
await voiceProviderRef.current.stop();
|
|
@@ -4303,7 +4243,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4303
4243
|
setVoiceState("error");
|
|
4304
4244
|
}
|
|
4305
4245
|
}, [config]);
|
|
4306
|
-
const cancelVoiceCapture = (0,
|
|
4246
|
+
const cancelVoiceCapture = (0, import_react7.useCallback)(async () => {
|
|
4307
4247
|
voiceAppendBaseRef.current = null;
|
|
4308
4248
|
voiceAppendBaseDurationRef.current = 0;
|
|
4309
4249
|
if (voiceProviderRef.current) {
|
|
@@ -4311,7 +4251,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4311
4251
|
}
|
|
4312
4252
|
resetVoiceComposerState("idle");
|
|
4313
4253
|
}, [resetVoiceComposerState]);
|
|
4314
|
-
const finalizeVoiceComposerAfterSend = (0,
|
|
4254
|
+
const finalizeVoiceComposerAfterSend = (0, import_react7.useCallback)(() => {
|
|
4315
4255
|
if (voicePersistComposer) {
|
|
4316
4256
|
resetVoiceComposerState("idle");
|
|
4317
4257
|
setIsVoiceComposerOpen(true);
|
|
@@ -4319,7 +4259,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4319
4259
|
}
|
|
4320
4260
|
void closeVoiceComposer();
|
|
4321
4261
|
}, [voicePersistComposer, resetVoiceComposerState, closeVoiceComposer]);
|
|
4322
|
-
const sendVoiceDraft = (0,
|
|
4262
|
+
const sendVoiceDraft = (0, import_react7.useCallback)(() => {
|
|
4323
4263
|
void (async () => {
|
|
4324
4264
|
if (!voiceDraft || disabled || isGenerating) {
|
|
4325
4265
|
return;
|
|
@@ -4345,7 +4285,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4345
4285
|
onAttachmentsChange,
|
|
4346
4286
|
finalizeVoiceComposerAfterSend
|
|
4347
4287
|
]);
|
|
4348
|
-
const cancelVoiceAutoSend = (0,
|
|
4288
|
+
const cancelVoiceAutoSend = (0, import_react7.useCallback)(() => {
|
|
4349
4289
|
void (async () => {
|
|
4350
4290
|
if (voiceReviewMode === "armed" && voiceProviderRef.current) {
|
|
4351
4291
|
await voiceProviderRef.current.cancel();
|
|
@@ -4357,7 +4297,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4357
4297
|
setVoiceCountdownMs(0);
|
|
4358
4298
|
setIsVoiceAutoSendActive(false);
|
|
4359
4299
|
}, [armVoiceDraftForAppend, voiceReviewMode]);
|
|
4360
|
-
const pauseVoiceReview = (0,
|
|
4300
|
+
const pauseVoiceReview = (0, import_react7.useCallback)(async () => {
|
|
4361
4301
|
if (voiceState === "listening") {
|
|
4362
4302
|
await stopVoiceCapture();
|
|
4363
4303
|
return;
|
|
@@ -4369,7 +4309,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4369
4309
|
setVoiceAudioLevel(0);
|
|
4370
4310
|
setVoiceState("review");
|
|
4371
4311
|
}, [armVoiceDraftForAppend, stopVoiceCapture, voiceReviewMode, voiceState]);
|
|
4372
|
-
(0,
|
|
4312
|
+
(0, import_react7.useEffect)(() => {
|
|
4373
4313
|
if (!voiceDraft || voiceAutoSendDelayMs <= 0 || !isVoiceAutoSendActive) {
|
|
4374
4314
|
return;
|
|
4375
4315
|
}
|
|
@@ -4397,8 +4337,8 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4397
4337
|
};
|
|
4398
4338
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
4399
4339
|
const showVoiceComposer = enableAudioRecording && isVoiceComposerOpen;
|
|
4400
|
-
return /* @__PURE__ */ (0,
|
|
4401
|
-
uploadProgress.size > 0 && /* @__PURE__ */ (0,
|
|
4340
|
+
return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
|
|
4341
|
+
uploadProgress.size > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4402
4342
|
FileUploadItem,
|
|
4403
4343
|
{
|
|
4404
4344
|
file: { name: progress.fileName },
|
|
@@ -4413,7 +4353,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4413
4353
|
},
|
|
4414
4354
|
id
|
|
4415
4355
|
)) }),
|
|
4416
|
-
attachments.length > 0 && /* @__PURE__ */ (0,
|
|
4356
|
+
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4417
4357
|
AttachmentPreview,
|
|
4418
4358
|
{
|
|
4419
4359
|
attachment,
|
|
@@ -4421,7 +4361,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4421
4361
|
},
|
|
4422
4362
|
index
|
|
4423
4363
|
)) }),
|
|
4424
|
-
showVoiceComposer ? /* @__PURE__ */ (0,
|
|
4364
|
+
showVoiceComposer ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4425
4365
|
VoiceComposer,
|
|
4426
4366
|
{
|
|
4427
4367
|
state: voiceState,
|
|
@@ -4461,15 +4401,15 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4461
4401
|
void closeVoiceComposer();
|
|
4462
4402
|
}
|
|
4463
4403
|
}
|
|
4464
|
-
) }) : /* @__PURE__ */ (0,
|
|
4404
|
+
) }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4465
4405
|
"div",
|
|
4466
4406
|
{
|
|
4467
4407
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
4468
4408
|
onDrop: handleDrop,
|
|
4469
4409
|
onDragOver: handleDragOver,
|
|
4470
4410
|
children: [
|
|
4471
|
-
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0,
|
|
4472
|
-
/* @__PURE__ */ (0,
|
|
4411
|
+
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4412
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4473
4413
|
"input",
|
|
4474
4414
|
{
|
|
4475
4415
|
ref: fileInputRef,
|
|
@@ -4480,8 +4420,8 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4480
4420
|
className: "hidden"
|
|
4481
4421
|
}
|
|
4482
4422
|
),
|
|
4483
|
-
/* @__PURE__ */ (0,
|
|
4484
|
-
/* @__PURE__ */ (0,
|
|
4423
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
|
|
4424
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4485
4425
|
Button,
|
|
4486
4426
|
{
|
|
4487
4427
|
type: "button",
|
|
@@ -4494,14 +4434,14 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4494
4434
|
fileInputRef.current?.click();
|
|
4495
4435
|
},
|
|
4496
4436
|
disabled,
|
|
4497
|
-
children: /* @__PURE__ */ (0,
|
|
4437
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Paperclip, { className: "h-4 w-4" })
|
|
4498
4438
|
}
|
|
4499
4439
|
) }),
|
|
4500
|
-
/* @__PURE__ */ (0,
|
|
4440
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
4501
4441
|
] })
|
|
4502
4442
|
] }),
|
|
4503
|
-
/* @__PURE__ */ (0,
|
|
4504
|
-
/* @__PURE__ */ (0,
|
|
4443
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "relative flex-1", children: [
|
|
4444
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4505
4445
|
Textarea,
|
|
4506
4446
|
{
|
|
4507
4447
|
ref: textareaRef,
|
|
@@ -4525,7 +4465,7 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4525
4465
|
rows: 1
|
|
4526
4466
|
}
|
|
4527
4467
|
),
|
|
4528
|
-
isMentionMenuOpen && /* @__PURE__ */ (0,
|
|
4468
|
+
isMentionMenuOpen && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-md border bg-popover shadow-md", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "p-1", children: filteredMentionAgents.map((agent, index) => /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(
|
|
4529
4469
|
"button",
|
|
4530
4470
|
{
|
|
4531
4471
|
type: "button",
|
|
@@ -4535,15 +4475,15 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4535
4475
|
selectMentionAgent(agent);
|
|
4536
4476
|
},
|
|
4537
4477
|
children: [
|
|
4538
|
-
/* @__PURE__ */ (0,
|
|
4539
|
-
agent.description && /* @__PURE__ */ (0,
|
|
4478
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "font-medium", children: agent.name }),
|
|
4479
|
+
agent.description && /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("span", { className: "truncate text-xs text-muted-foreground", children: agent.description })
|
|
4540
4480
|
]
|
|
4541
4481
|
},
|
|
4542
4482
|
agent.id
|
|
4543
4483
|
)) }) })
|
|
4544
4484
|
] }),
|
|
4545
|
-
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ (0,
|
|
4546
|
-
/* @__PURE__ */ (0,
|
|
4485
|
+
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
|
|
4486
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4547
4487
|
Button,
|
|
4548
4488
|
{
|
|
4549
4489
|
type: "button",
|
|
@@ -4554,13 +4494,13 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4554
4494
|
void startVoiceCapture();
|
|
4555
4495
|
},
|
|
4556
4496
|
disabled: disabled || isGenerating,
|
|
4557
|
-
children: /* @__PURE__ */ (0,
|
|
4497
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Mic, { className: "h-4 w-4" })
|
|
4558
4498
|
}
|
|
4559
4499
|
) }),
|
|
4560
|
-
/* @__PURE__ */ (0,
|
|
4500
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipContent, { children: config?.labels?.voiceEnter })
|
|
4561
4501
|
] }),
|
|
4562
|
-
isGenerating ? /* @__PURE__ */ (0,
|
|
4563
|
-
/* @__PURE__ */ (0,
|
|
4502
|
+
isGenerating ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
|
|
4503
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4564
4504
|
Button,
|
|
4565
4505
|
{
|
|
4566
4506
|
type: "button",
|
|
@@ -4568,36 +4508,36 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4568
4508
|
size: "icon",
|
|
4569
4509
|
className: "h-10 w-10",
|
|
4570
4510
|
onClick: onStopGeneration,
|
|
4571
|
-
children: /* @__PURE__ */ (0,
|
|
4511
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Square, { className: "h-4 w-4" })
|
|
4572
4512
|
}
|
|
4573
4513
|
) }),
|
|
4574
|
-
/* @__PURE__ */ (0,
|
|
4575
|
-
] }) : /* @__PURE__ */ (0,
|
|
4576
|
-
/* @__PURE__ */ (0,
|
|
4514
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
4515
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(Tooltip, { children: [
|
|
4516
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
|
|
4577
4517
|
Button,
|
|
4578
4518
|
{
|
|
4579
4519
|
type: "submit",
|
|
4580
4520
|
size: "icon",
|
|
4581
4521
|
className: "h-10 w-10",
|
|
4582
4522
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
4583
|
-
children: disabled ? /* @__PURE__ */ (0,
|
|
4523
|
+
children: disabled ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_lucide_react12.Send, { className: "h-4 w-4" })
|
|
4584
4524
|
}
|
|
4585
4525
|
) }),
|
|
4586
|
-
/* @__PURE__ */ (0,
|
|
4526
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsx)(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
4587
4527
|
] })
|
|
4588
4528
|
]
|
|
4589
4529
|
}
|
|
4590
4530
|
) }),
|
|
4591
|
-
/* @__PURE__ */ (0,
|
|
4531
|
+
/* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "text-[10px] text-muted-foreground text-center", children: [
|
|
4592
4532
|
window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
|
|
4593
|
-
attachments.length > 0 && /* @__PURE__ */ (0,
|
|
4533
|
+
attachments.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4594
4534
|
" \u2022 ",
|
|
4595
4535
|
attachments.length,
|
|
4596
4536
|
"/",
|
|
4597
4537
|
maxAttachments,
|
|
4598
4538
|
" anexos"
|
|
4599
4539
|
] }),
|
|
4600
|
-
config?.labels?.footerLabel && /* @__PURE__ */ (0,
|
|
4540
|
+
config?.labels?.footerLabel && /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_jsx_runtime24.Fragment, { children: [
|
|
4601
4541
|
" \u2022 ",
|
|
4602
4542
|
config.labels.footerLabel
|
|
4603
4543
|
] })
|
|
@@ -4606,21 +4546,21 @@ var ChatInput = (0, import_react6.memo)(function ChatInput2({
|
|
|
4606
4546
|
});
|
|
4607
4547
|
|
|
4608
4548
|
// src/components/chat/UserProfile.tsx
|
|
4609
|
-
var
|
|
4549
|
+
var import_react8 = require("react");
|
|
4610
4550
|
|
|
4611
4551
|
// src/components/ui/scroll-area.tsx
|
|
4612
|
-
var
|
|
4552
|
+
var React13 = __toESM(require("react"), 1);
|
|
4613
4553
|
var ScrollAreaPrimitive = __toESM(require("@radix-ui/react-scroll-area"), 1);
|
|
4614
|
-
var
|
|
4615
|
-
var ScrollArea =
|
|
4616
|
-
return /* @__PURE__ */ (0,
|
|
4554
|
+
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
4555
|
+
var ScrollArea = React13.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4556
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
|
|
4617
4557
|
ScrollAreaPrimitive.Root,
|
|
4618
4558
|
{
|
|
4619
4559
|
"data-slot": "scroll-area",
|
|
4620
4560
|
className: cn("relative", className),
|
|
4621
4561
|
...props,
|
|
4622
4562
|
children: [
|
|
4623
|
-
/* @__PURE__ */ (0,
|
|
4563
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4624
4564
|
ScrollAreaPrimitive.Viewport,
|
|
4625
4565
|
{
|
|
4626
4566
|
ref,
|
|
@@ -4634,8 +4574,8 @@ var ScrollArea = React12.forwardRef(({ className, children, viewportClassName, o
|
|
|
4634
4574
|
children
|
|
4635
4575
|
}
|
|
4636
4576
|
),
|
|
4637
|
-
/* @__PURE__ */ (0,
|
|
4638
|
-
/* @__PURE__ */ (0,
|
|
4577
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ScrollBar, {}),
|
|
4578
|
+
/* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ScrollAreaPrimitive.Corner, {})
|
|
4639
4579
|
]
|
|
4640
4580
|
}
|
|
4641
4581
|
);
|
|
@@ -4646,7 +4586,7 @@ function ScrollBar({
|
|
|
4646
4586
|
orientation = "vertical",
|
|
4647
4587
|
...props
|
|
4648
4588
|
}) {
|
|
4649
|
-
return /* @__PURE__ */ (0,
|
|
4589
|
+
return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4650
4590
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4651
4591
|
{
|
|
4652
4592
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -4658,7 +4598,7 @@ function ScrollBar({
|
|
|
4658
4598
|
className
|
|
4659
4599
|
),
|
|
4660
4600
|
...props,
|
|
4661
|
-
children: /* @__PURE__ */ (0,
|
|
4601
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
|
|
4662
4602
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4663
4603
|
{
|
|
4664
4604
|
"data-slot": "scroll-area-thumb",
|
|
@@ -4670,8 +4610,8 @@ function ScrollBar({
|
|
|
4670
4610
|
}
|
|
4671
4611
|
|
|
4672
4612
|
// src/components/chat/UserProfile.tsx
|
|
4673
|
-
var
|
|
4674
|
-
var
|
|
4613
|
+
var import_lucide_react13 = require("lucide-react");
|
|
4614
|
+
var import_jsx_runtime26 = require("react/jsx-runtime");
|
|
4675
4615
|
var getInitials2 = (name, email) => {
|
|
4676
4616
|
if (name) {
|
|
4677
4617
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -4685,29 +4625,29 @@ var getFieldIcon = (type, key) => {
|
|
|
4685
4625
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4686
4626
|
switch (type) {
|
|
4687
4627
|
case "email":
|
|
4688
|
-
return /* @__PURE__ */ (0,
|
|
4628
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Mail, { className: iconClass });
|
|
4689
4629
|
case "phone":
|
|
4690
|
-
return /* @__PURE__ */ (0,
|
|
4630
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Phone, { className: iconClass });
|
|
4691
4631
|
case "url":
|
|
4692
|
-
return /* @__PURE__ */ (0,
|
|
4632
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Globe, { className: iconClass });
|
|
4693
4633
|
case "date":
|
|
4694
|
-
return /* @__PURE__ */ (0,
|
|
4634
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Calendar, { className: iconClass });
|
|
4695
4635
|
}
|
|
4696
4636
|
const lowerKey = key?.toLowerCase() || "";
|
|
4697
|
-
if (lowerKey.includes("follower")) return /* @__PURE__ */ (0,
|
|
4698
|
-
if (lowerKey.includes("following")) return /* @__PURE__ */ (0,
|
|
4699
|
-
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ (0,
|
|
4700
|
-
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ (0,
|
|
4701
|
-
if (lowerKey.includes("bio")) return /* @__PURE__ */ (0,
|
|
4702
|
-
if (lowerKey.includes("email")) return /* @__PURE__ */ (0,
|
|
4703
|
-
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ (0,
|
|
4704
|
-
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ (0,
|
|
4705
|
-
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ (0,
|
|
4706
|
-
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ (0,
|
|
4707
|
-
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ (0,
|
|
4708
|
-
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ (0,
|
|
4709
|
-
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ (0,
|
|
4710
|
-
return /* @__PURE__ */ (0,
|
|
4637
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Users, { className: iconClass });
|
|
4638
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.UserPlus, { className: iconClass });
|
|
4639
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Image, { className: iconClass });
|
|
4640
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.BadgeCheck, { className: iconClass });
|
|
4641
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.FileText, { className: iconClass });
|
|
4642
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Mail, { className: iconClass });
|
|
4643
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Phone, { className: iconClass });
|
|
4644
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.MapPin, { className: iconClass });
|
|
4645
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Building, { className: iconClass });
|
|
4646
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Briefcase, { className: iconClass });
|
|
4647
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Globe, { className: iconClass });
|
|
4648
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.AtSign, { className: iconClass });
|
|
4649
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Calendar, { className: iconClass });
|
|
4650
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.User, { className: iconClass });
|
|
4711
4651
|
};
|
|
4712
4652
|
var formatValue = (value, type, key) => {
|
|
4713
4653
|
if (value === null || value === void 0) return "-";
|
|
@@ -4741,15 +4681,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
4741
4681
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4742
4682
|
switch (category) {
|
|
4743
4683
|
case "preference":
|
|
4744
|
-
return /* @__PURE__ */ (0,
|
|
4684
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Heart, { className: iconClass });
|
|
4745
4685
|
case "fact":
|
|
4746
|
-
return /* @__PURE__ */ (0,
|
|
4686
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Info, { className: iconClass });
|
|
4747
4687
|
case "goal":
|
|
4748
|
-
return /* @__PURE__ */ (0,
|
|
4688
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Target, { className: iconClass });
|
|
4749
4689
|
case "context":
|
|
4750
|
-
return /* @__PURE__ */ (0,
|
|
4690
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Lightbulb, { className: iconClass });
|
|
4751
4691
|
default:
|
|
4752
|
-
return /* @__PURE__ */ (0,
|
|
4692
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Brain, { className: iconClass });
|
|
4753
4693
|
}
|
|
4754
4694
|
};
|
|
4755
4695
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -4780,10 +4720,10 @@ var UserProfile = ({
|
|
|
4780
4720
|
onDeleteMemory,
|
|
4781
4721
|
className
|
|
4782
4722
|
}) => {
|
|
4783
|
-
const [newMemoryContent, setNewMemoryContent] = (0,
|
|
4784
|
-
const [isAddingMemory, setIsAddingMemory] = (0,
|
|
4785
|
-
const [editingMemoryId, setEditingMemoryId] = (0,
|
|
4786
|
-
const [editingMemoryContent, setEditingMemoryContent] = (0,
|
|
4723
|
+
const [newMemoryContent, setNewMemoryContent] = (0, import_react8.useState)("");
|
|
4724
|
+
const [isAddingMemory, setIsAddingMemory] = (0, import_react8.useState)(false);
|
|
4725
|
+
const [editingMemoryId, setEditingMemoryId] = (0, import_react8.useState)(null);
|
|
4726
|
+
const [editingMemoryContent, setEditingMemoryContent] = (0, import_react8.useState)("");
|
|
4787
4727
|
const handleAddMemory = () => {
|
|
4788
4728
|
if (newMemoryContent.trim() && onAddMemory) {
|
|
4789
4729
|
onAddMemory(newMemoryContent.trim(), "other");
|
|
@@ -4819,66 +4759,66 @@ var UserProfile = ({
|
|
|
4819
4759
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
4820
4760
|
const initials = getInitials2(user?.name, user?.email);
|
|
4821
4761
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
4822
|
-
return /* @__PURE__ */ (0,
|
|
4762
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4823
4763
|
SheetContent,
|
|
4824
4764
|
{
|
|
4825
4765
|
side: "right",
|
|
4826
4766
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
4827
4767
|
children: [
|
|
4828
|
-
/* @__PURE__ */ (0,
|
|
4829
|
-
/* @__PURE__ */ (0,
|
|
4830
|
-
/* @__PURE__ */ (0,
|
|
4831
|
-
/* @__PURE__ */ (0,
|
|
4832
|
-
user?.avatar && /* @__PURE__ */ (0,
|
|
4833
|
-
/* @__PURE__ */ (0,
|
|
4768
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(SheetTitle, { children: labels.title }) }) }),
|
|
4769
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "p-6 space-y-6", children: [
|
|
4770
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
4771
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
4772
|
+
user?.avatar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
4773
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
4834
4774
|
] }),
|
|
4835
|
-
/* @__PURE__ */ (0,
|
|
4836
|
-
/* @__PURE__ */ (0,
|
|
4837
|
-
user?.email && /* @__PURE__ */ (0,
|
|
4775
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "w-full px-2", children: [
|
|
4776
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
4777
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
4838
4778
|
] })
|
|
4839
4779
|
] }),
|
|
4840
|
-
/* @__PURE__ */ (0,
|
|
4841
|
-
/* @__PURE__ */ (0,
|
|
4842
|
-
/* @__PURE__ */ (0,
|
|
4843
|
-
/* @__PURE__ */ (0,
|
|
4844
|
-
/* @__PURE__ */ (0,
|
|
4845
|
-
/* @__PURE__ */ (0,
|
|
4846
|
-
/* @__PURE__ */ (0,
|
|
4847
|
-
/* @__PURE__ */ (0,
|
|
4848
|
-
/* @__PURE__ */ (0,
|
|
4780
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Separator, {}),
|
|
4781
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-3", children: [
|
|
4782
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
4783
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-2", children: [
|
|
4784
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4785
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4786
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
4787
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
4788
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
4849
4789
|
] })
|
|
4850
4790
|
] }),
|
|
4851
|
-
user?.email && /* @__PURE__ */ (0,
|
|
4852
|
-
/* @__PURE__ */ (0,
|
|
4853
|
-
/* @__PURE__ */ (0,
|
|
4854
|
-
/* @__PURE__ */ (0,
|
|
4855
|
-
/* @__PURE__ */ (0,
|
|
4791
|
+
user?.email && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4792
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4793
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
4794
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
4795
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
4856
4796
|
] })
|
|
4857
4797
|
] }),
|
|
4858
|
-
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ (0,
|
|
4859
|
-
/* @__PURE__ */ (0,
|
|
4860
|
-
/* @__PURE__ */ (0,
|
|
4861
|
-
/* @__PURE__ */ (0,
|
|
4862
|
-
/* @__PURE__ */ (0,
|
|
4798
|
+
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4799
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.User, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4800
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
4801
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
4802
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
4863
4803
|
] })
|
|
4864
4804
|
] })
|
|
4865
4805
|
] })
|
|
4866
4806
|
] }),
|
|
4867
|
-
normalizedFields.length > 0 && /* @__PURE__ */ (0,
|
|
4868
|
-
/* @__PURE__ */ (0,
|
|
4869
|
-
/* @__PURE__ */ (0,
|
|
4870
|
-
/* @__PURE__ */ (0,
|
|
4871
|
-
/* @__PURE__ */ (0,
|
|
4807
|
+
normalizedFields.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
|
|
4808
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Separator, {}),
|
|
4809
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-3", children: [
|
|
4810
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
4811
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
4872
4812
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
4873
|
-
return /* @__PURE__ */ (0,
|
|
4813
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4874
4814
|
"div",
|
|
4875
4815
|
{
|
|
4876
4816
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
4877
4817
|
children: [
|
|
4878
|
-
/* @__PURE__ */ (0,
|
|
4879
|
-
/* @__PURE__ */ (0,
|
|
4880
|
-
/* @__PURE__ */ (0,
|
|
4881
|
-
/* @__PURE__ */ (0,
|
|
4818
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
4819
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
4820
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
4821
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: cn(
|
|
4882
4822
|
"text-sm font-medium",
|
|
4883
4823
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
4884
4824
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -4890,26 +4830,26 @@ var UserProfile = ({
|
|
|
4890
4830
|
}) })
|
|
4891
4831
|
] })
|
|
4892
4832
|
] }),
|
|
4893
|
-
/* @__PURE__ */ (0,
|
|
4894
|
-
/* @__PURE__ */ (0,
|
|
4895
|
-
/* @__PURE__ */ (0,
|
|
4896
|
-
/* @__PURE__ */ (0,
|
|
4897
|
-
/* @__PURE__ */ (0,
|
|
4833
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Separator, {}),
|
|
4834
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-3", children: [
|
|
4835
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
4836
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
4837
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Brain, { className: "h-4 w-4" }),
|
|
4898
4838
|
labels.memories
|
|
4899
4839
|
] }),
|
|
4900
|
-
onAddMemory && /* @__PURE__ */ (0,
|
|
4840
|
+
onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4901
4841
|
Button,
|
|
4902
4842
|
{
|
|
4903
4843
|
variant: "ghost",
|
|
4904
4844
|
size: "sm",
|
|
4905
4845
|
className: "h-7 px-2",
|
|
4906
4846
|
onClick: () => setIsAddingMemory(true),
|
|
4907
|
-
children: /* @__PURE__ */ (0,
|
|
4847
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Plus, { className: "h-4 w-4" })
|
|
4908
4848
|
}
|
|
4909
4849
|
)
|
|
4910
4850
|
] }),
|
|
4911
|
-
isAddingMemory && onAddMemory && /* @__PURE__ */ (0,
|
|
4912
|
-
/* @__PURE__ */ (0,
|
|
4851
|
+
isAddingMemory && onAddMemory && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-2", children: [
|
|
4852
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4913
4853
|
Input,
|
|
4914
4854
|
{
|
|
4915
4855
|
value: newMemoryContent,
|
|
@@ -4926,24 +4866,24 @@ var UserProfile = ({
|
|
|
4926
4866
|
autoFocus: true
|
|
4927
4867
|
}
|
|
4928
4868
|
),
|
|
4929
|
-
/* @__PURE__ */ (0,
|
|
4869
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
4930
4870
|
] }),
|
|
4931
|
-
/* @__PURE__ */ (0,
|
|
4871
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
|
|
4932
4872
|
const isEditing = editingMemoryId === memory.id;
|
|
4933
|
-
return /* @__PURE__ */ (0,
|
|
4873
|
+
return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4934
4874
|
"div",
|
|
4935
4875
|
{
|
|
4936
4876
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
4937
4877
|
children: [
|
|
4938
|
-
/* @__PURE__ */ (0,
|
|
4939
|
-
/* @__PURE__ */ (0,
|
|
4940
|
-
/* @__PURE__ */ (0,
|
|
4941
|
-
/* @__PURE__ */ (0,
|
|
4942
|
-
/* @__PURE__ */ (0,
|
|
4943
|
-
/* @__PURE__ */ (0,
|
|
4878
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Bot, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
|
|
4879
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
4880
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
4881
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
4882
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
4883
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
4944
4884
|
] }),
|
|
4945
|
-
isEditing ? /* @__PURE__ */ (0,
|
|
4946
|
-
/* @__PURE__ */ (0,
|
|
4885
|
+
isEditing ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "space-y-2", children: [
|
|
4886
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4947
4887
|
Textarea,
|
|
4948
4888
|
{
|
|
4949
4889
|
value: editingMemoryContent,
|
|
@@ -4960,8 +4900,8 @@ var UserProfile = ({
|
|
|
4960
4900
|
}
|
|
4961
4901
|
}
|
|
4962
4902
|
),
|
|
4963
|
-
/* @__PURE__ */ (0,
|
|
4964
|
-
/* @__PURE__ */ (0,
|
|
4903
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1 justify-end", children: [
|
|
4904
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4965
4905
|
Button,
|
|
4966
4906
|
{
|
|
4967
4907
|
variant: "ghost",
|
|
@@ -4969,12 +4909,12 @@ var UserProfile = ({
|
|
|
4969
4909
|
className: "h-7 px-2",
|
|
4970
4910
|
onClick: handleCancelEdit,
|
|
4971
4911
|
children: [
|
|
4972
|
-
/* @__PURE__ */ (0,
|
|
4912
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.X, { className: "h-3.5 w-3.5 mr-1" }),
|
|
4973
4913
|
"Cancelar"
|
|
4974
4914
|
]
|
|
4975
4915
|
}
|
|
4976
4916
|
),
|
|
4977
|
-
/* @__PURE__ */ (0,
|
|
4917
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
|
|
4978
4918
|
Button,
|
|
4979
4919
|
{
|
|
4980
4920
|
size: "sm",
|
|
@@ -4982,33 +4922,33 @@ var UserProfile = ({
|
|
|
4982
4922
|
onClick: handleSaveEdit,
|
|
4983
4923
|
disabled: !editingMemoryContent.trim(),
|
|
4984
4924
|
children: [
|
|
4985
|
-
/* @__PURE__ */ (0,
|
|
4925
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Check, { className: "h-3.5 w-3.5 mr-1" }),
|
|
4986
4926
|
"Salvar"
|
|
4987
4927
|
]
|
|
4988
4928
|
}
|
|
4989
4929
|
)
|
|
4990
4930
|
] })
|
|
4991
|
-
] }) : /* @__PURE__ */ (0,
|
|
4931
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "text-sm break-words", children: memory.content })
|
|
4992
4932
|
] }),
|
|
4993
|
-
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ (0,
|
|
4994
|
-
onUpdateMemory && /* @__PURE__ */ (0,
|
|
4933
|
+
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
4934
|
+
onUpdateMemory && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
4995
4935
|
Button,
|
|
4996
4936
|
{
|
|
4997
4937
|
variant: "ghost",
|
|
4998
4938
|
size: "icon",
|
|
4999
4939
|
className: "h-7 w-7",
|
|
5000
4940
|
onClick: () => handleStartEdit(memory),
|
|
5001
|
-
children: /* @__PURE__ */ (0,
|
|
4941
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5002
4942
|
}
|
|
5003
4943
|
),
|
|
5004
|
-
onDeleteMemory && /* @__PURE__ */ (0,
|
|
4944
|
+
onDeleteMemory && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5005
4945
|
Button,
|
|
5006
4946
|
{
|
|
5007
4947
|
variant: "ghost",
|
|
5008
4948
|
size: "icon",
|
|
5009
4949
|
className: "h-7 w-7",
|
|
5010
4950
|
onClick: () => onDeleteMemory(memory.id),
|
|
5011
|
-
children: /* @__PURE__ */ (0,
|
|
4951
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_lucide_react13.Trash2, { className: "h-3.5 w-3.5 text-destructive" })
|
|
5012
4952
|
}
|
|
5013
4953
|
)
|
|
5014
4954
|
] })
|
|
@@ -5019,8 +4959,8 @@ var UserProfile = ({
|
|
|
5019
4959
|
}) })
|
|
5020
4960
|
] })
|
|
5021
4961
|
] }) }),
|
|
5022
|
-
/* @__PURE__ */ (0,
|
|
5023
|
-
onEditProfile && /* @__PURE__ */ (0,
|
|
4962
|
+
/* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
4963
|
+
onEditProfile && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5024
4964
|
Button,
|
|
5025
4965
|
{
|
|
5026
4966
|
variant: "outline",
|
|
@@ -5029,7 +4969,7 @@ var UserProfile = ({
|
|
|
5029
4969
|
children: "Edit Profile"
|
|
5030
4970
|
}
|
|
5031
4971
|
),
|
|
5032
|
-
onLogout && /* @__PURE__ */ (0,
|
|
4972
|
+
onLogout && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
|
|
5033
4973
|
Button,
|
|
5034
4974
|
{
|
|
5035
4975
|
variant: "destructive",
|
|
@@ -5045,8 +4985,8 @@ var UserProfile = ({
|
|
|
5045
4985
|
};
|
|
5046
4986
|
|
|
5047
4987
|
// src/components/chat/ChatUI.tsx
|
|
5048
|
-
var
|
|
5049
|
-
var
|
|
4988
|
+
var import_lucide_react14 = require("lucide-react");
|
|
4989
|
+
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5050
4990
|
function getMessageSpeakerKey(message) {
|
|
5051
4991
|
if (!message) return null;
|
|
5052
4992
|
if (message.role === "assistant") {
|
|
@@ -5087,12 +5027,12 @@ var ChatUI = ({
|
|
|
5087
5027
|
initialInput,
|
|
5088
5028
|
onInitialInputConsumed
|
|
5089
5029
|
}) => {
|
|
5090
|
-
const config = (0,
|
|
5030
|
+
const config = (0, import_react9.useMemo)(
|
|
5091
5031
|
() => mergeConfig(defaultChatConfig, userConfig),
|
|
5092
5032
|
[userConfig]
|
|
5093
5033
|
);
|
|
5094
|
-
const [isMobile, setIsMobile] = (0,
|
|
5095
|
-
const [isUserProfileOpen, setIsUserProfileOpen] = (0,
|
|
5034
|
+
const [isMobile, setIsMobile] = (0, import_react9.useState)(false);
|
|
5035
|
+
const [isUserProfileOpen, setIsUserProfileOpen] = (0, import_react9.useState)(false);
|
|
5096
5036
|
let userContext;
|
|
5097
5037
|
try {
|
|
5098
5038
|
const contextValue = useChatUserContext();
|
|
@@ -5106,10 +5046,10 @@ var ChatUI = ({
|
|
|
5106
5046
|
}
|
|
5107
5047
|
return false;
|
|
5108
5048
|
};
|
|
5109
|
-
const [inputValue, setInputValue] = (0,
|
|
5110
|
-
const [attachments, setAttachments] = (0,
|
|
5111
|
-
const [expandedMessageIds, setExpandedMessageIds] = (0,
|
|
5112
|
-
const [state, setState] = (0,
|
|
5049
|
+
const [inputValue, setInputValue] = (0, import_react9.useState)("");
|
|
5050
|
+
const [attachments, setAttachments] = (0, import_react9.useState)([]);
|
|
5051
|
+
const [expandedMessageIds, setExpandedMessageIds] = (0, import_react9.useState)({});
|
|
5052
|
+
const [state, setState] = (0, import_react9.useState)({
|
|
5113
5053
|
isRecording: false,
|
|
5114
5054
|
selectedThreadId: currentThreadId,
|
|
5115
5055
|
isAtBottom: true,
|
|
@@ -5121,42 +5061,42 @@ var ChatUI = ({
|
|
|
5121
5061
|
isSidebarCollapsed: false
|
|
5122
5062
|
// No longer used for main sidebar
|
|
5123
5063
|
});
|
|
5124
|
-
(0,
|
|
5064
|
+
(0, import_react9.useEffect)(() => {
|
|
5125
5065
|
if (currentThreadId !== state.selectedThreadId) {
|
|
5126
5066
|
setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
|
|
5127
5067
|
}
|
|
5128
5068
|
}, [currentThreadId]);
|
|
5129
|
-
const initialInputApplied = (0,
|
|
5130
|
-
const initialInputConsumedRef = (0,
|
|
5131
|
-
(0,
|
|
5069
|
+
const initialInputApplied = (0, import_react9.useRef)(false);
|
|
5070
|
+
const initialInputConsumedRef = (0, import_react9.useRef)(false);
|
|
5071
|
+
(0, import_react9.useEffect)(() => {
|
|
5132
5072
|
if (initialInput && !initialInputApplied.current) {
|
|
5133
5073
|
setInputValue(initialInput);
|
|
5134
5074
|
initialInputApplied.current = true;
|
|
5135
5075
|
}
|
|
5136
5076
|
}, [initialInput]);
|
|
5137
|
-
const scrollAreaRef = (0,
|
|
5138
|
-
const prependSnapshotRef = (0,
|
|
5139
|
-
const stateRef = (0,
|
|
5140
|
-
const inputValueRef = (0,
|
|
5141
|
-
const attachmentsRef = (0,
|
|
5142
|
-
(0,
|
|
5077
|
+
const scrollAreaRef = (0, import_react9.useRef)(null);
|
|
5078
|
+
const prependSnapshotRef = (0, import_react9.useRef)(null);
|
|
5079
|
+
const stateRef = (0, import_react9.useRef)(state);
|
|
5080
|
+
const inputValueRef = (0, import_react9.useRef)(inputValue);
|
|
5081
|
+
const attachmentsRef = (0, import_react9.useRef)(attachments);
|
|
5082
|
+
(0, import_react9.useEffect)(() => {
|
|
5143
5083
|
stateRef.current = state;
|
|
5144
5084
|
}, [state]);
|
|
5145
|
-
(0,
|
|
5085
|
+
(0, import_react9.useEffect)(() => {
|
|
5146
5086
|
inputValueRef.current = inputValue;
|
|
5147
5087
|
}, [inputValue]);
|
|
5148
|
-
(0,
|
|
5088
|
+
(0, import_react9.useEffect)(() => {
|
|
5149
5089
|
attachmentsRef.current = attachments;
|
|
5150
5090
|
}, [attachments]);
|
|
5151
|
-
const [isCustomMounted, setIsCustomMounted] = (0,
|
|
5152
|
-
const [isCustomVisible, setIsCustomVisible] = (0,
|
|
5091
|
+
const [isCustomMounted, setIsCustomMounted] = (0, import_react9.useState)(false);
|
|
5092
|
+
const [isCustomVisible, setIsCustomVisible] = (0, import_react9.useState)(false);
|
|
5153
5093
|
const virtualizer = (0, import_react_virtual.useVirtualizer)({
|
|
5154
5094
|
count: messages.length,
|
|
5155
5095
|
getScrollElement: () => scrollAreaRef.current,
|
|
5156
5096
|
estimateSize: () => 100,
|
|
5157
5097
|
overscan: 5
|
|
5158
5098
|
});
|
|
5159
|
-
const createStateCallback = (0,
|
|
5099
|
+
const createStateCallback = (0, import_react9.useCallback)(
|
|
5160
5100
|
(setter) => ({
|
|
5161
5101
|
setState: (newState) => setter?.(newState),
|
|
5162
5102
|
getState: () => ({
|
|
@@ -5168,7 +5108,7 @@ var ChatUI = ({
|
|
|
5168
5108
|
[]
|
|
5169
5109
|
// No dependencies - uses refs for latest state
|
|
5170
5110
|
);
|
|
5171
|
-
(0,
|
|
5111
|
+
(0, import_react9.useEffect)(() => {
|
|
5172
5112
|
const checkMobile = () => {
|
|
5173
5113
|
setIsMobile(globalThis.innerWidth < 1024);
|
|
5174
5114
|
};
|
|
@@ -5176,7 +5116,7 @@ var ChatUI = ({
|
|
|
5176
5116
|
globalThis.addEventListener("resize", checkMobile);
|
|
5177
5117
|
return () => globalThis.removeEventListener("resize", checkMobile);
|
|
5178
5118
|
}, []);
|
|
5179
|
-
(0,
|
|
5119
|
+
(0, import_react9.useEffect)(() => {
|
|
5180
5120
|
if (!isMobile || !config.customComponent?.component) return;
|
|
5181
5121
|
if (state.showSidebar) {
|
|
5182
5122
|
setIsCustomMounted(true);
|
|
@@ -5187,8 +5127,8 @@ var ChatUI = ({
|
|
|
5187
5127
|
return () => clearTimeout(t);
|
|
5188
5128
|
}
|
|
5189
5129
|
}, [state.showSidebar, isMobile, config.customComponent]);
|
|
5190
|
-
const prevMessageCountRef = (0,
|
|
5191
|
-
(0,
|
|
5130
|
+
const prevMessageCountRef = (0, import_react9.useRef)(0);
|
|
5131
|
+
(0, import_react9.useEffect)(() => {
|
|
5192
5132
|
if (messages.length === 0) {
|
|
5193
5133
|
prevMessageCountRef.current = 0;
|
|
5194
5134
|
return;
|
|
@@ -5218,13 +5158,13 @@ var ChatUI = ({
|
|
|
5218
5158
|
}
|
|
5219
5159
|
});
|
|
5220
5160
|
}, [messages, state.isAtBottom, virtualizer]);
|
|
5221
|
-
(0,
|
|
5161
|
+
(0, import_react9.useEffect)(() => {
|
|
5222
5162
|
virtualizer.measure();
|
|
5223
5163
|
}, [expandedMessageIds, virtualizer]);
|
|
5224
|
-
(0,
|
|
5164
|
+
(0, import_react9.useEffect)(() => {
|
|
5225
5165
|
prependSnapshotRef.current = null;
|
|
5226
5166
|
}, [currentThreadId]);
|
|
5227
|
-
(0,
|
|
5167
|
+
(0, import_react9.useEffect)(() => {
|
|
5228
5168
|
const snapshot = prependSnapshotRef.current;
|
|
5229
5169
|
if (!snapshot) return;
|
|
5230
5170
|
if (messages.length <= snapshot.messageCount) {
|
|
@@ -5250,7 +5190,7 @@ var ChatUI = ({
|
|
|
5250
5190
|
});
|
|
5251
5191
|
});
|
|
5252
5192
|
}, [messages, isLoadingOlderMessages, virtualizer]);
|
|
5253
|
-
const requestOlderMessages = (0,
|
|
5193
|
+
const requestOlderMessages = (0, import_react9.useCallback)(() => {
|
|
5254
5194
|
if (!onLoadOlderMessages || !hasMoreMessagesBefore || isLoadingOlderMessages) return;
|
|
5255
5195
|
const viewport = scrollAreaRef.current;
|
|
5256
5196
|
prependSnapshotRef.current = viewport ? {
|
|
@@ -5261,7 +5201,7 @@ var ChatUI = ({
|
|
|
5261
5201
|
} : null;
|
|
5262
5202
|
onLoadOlderMessages();
|
|
5263
5203
|
}, [hasMoreMessagesBefore, isLoadingOlderMessages, messages, onLoadOlderMessages]);
|
|
5264
|
-
(0,
|
|
5204
|
+
(0, import_react9.useEffect)(() => {
|
|
5265
5205
|
const validMessageIds = new Set(messages.map((message) => message.id));
|
|
5266
5206
|
setExpandedMessageIds((prev) => {
|
|
5267
5207
|
const activeIds = Object.keys(prev);
|
|
@@ -5276,7 +5216,7 @@ var ChatUI = ({
|
|
|
5276
5216
|
return next;
|
|
5277
5217
|
});
|
|
5278
5218
|
}, [messages]);
|
|
5279
|
-
const handleScroll = (0,
|
|
5219
|
+
const handleScroll = (0, import_react9.useCallback)((e) => {
|
|
5280
5220
|
const { scrollTop, scrollHeight, clientHeight } = e.currentTarget;
|
|
5281
5221
|
const isAtBottom = scrollHeight - scrollTop - clientHeight < 50;
|
|
5282
5222
|
const isNearTop = scrollTop < 120;
|
|
@@ -5288,7 +5228,7 @@ var ChatUI = ({
|
|
|
5288
5228
|
return { ...prev, isAtBottom };
|
|
5289
5229
|
});
|
|
5290
5230
|
}, [hasMoreMessagesBefore, isLoadingOlderMessages, requestOlderMessages]);
|
|
5291
|
-
const handleSendMessage = (0,
|
|
5231
|
+
const handleSendMessage = (0, import_react9.useCallback)((content, messageAttachments = []) => {
|
|
5292
5232
|
if (!content.trim() && messageAttachments.length === 0) return;
|
|
5293
5233
|
callbacks.onSendMessage?.(content, messageAttachments, createStateCallback());
|
|
5294
5234
|
if (initialInputApplied.current && !initialInputConsumedRef.current) {
|
|
@@ -5298,7 +5238,7 @@ var ChatUI = ({
|
|
|
5298
5238
|
setInputValue("");
|
|
5299
5239
|
setAttachments([]);
|
|
5300
5240
|
}, [callbacks, createStateCallback, onInitialInputConsumed]);
|
|
5301
|
-
const handleMessageAction = (0,
|
|
5241
|
+
const handleMessageAction = (0, import_react9.useCallback)((event) => {
|
|
5302
5242
|
const { action, messageId, content } = event;
|
|
5303
5243
|
switch (action) {
|
|
5304
5244
|
case "copy":
|
|
@@ -5317,7 +5257,7 @@ var ChatUI = ({
|
|
|
5317
5257
|
break;
|
|
5318
5258
|
}
|
|
5319
5259
|
}, [callbacks, createStateCallback]);
|
|
5320
|
-
const handleToggleMessageExpansion = (0,
|
|
5260
|
+
const handleToggleMessageExpansion = (0, import_react9.useCallback)((messageId) => {
|
|
5321
5261
|
setExpandedMessageIds((prev) => {
|
|
5322
5262
|
if (prev[messageId]) {
|
|
5323
5263
|
const next = { ...prev };
|
|
@@ -5330,44 +5270,44 @@ var ChatUI = ({
|
|
|
5330
5270
|
};
|
|
5331
5271
|
});
|
|
5332
5272
|
}, []);
|
|
5333
|
-
const handleCreateThread = (0,
|
|
5273
|
+
const handleCreateThread = (0, import_react9.useCallback)((title) => {
|
|
5334
5274
|
callbacks.onCreateThread?.(title, createStateCallback());
|
|
5335
5275
|
}, [callbacks, createStateCallback]);
|
|
5336
|
-
const handleSelectThread = (0,
|
|
5276
|
+
const handleSelectThread = (0, import_react9.useCallback)((threadId) => {
|
|
5337
5277
|
callbacks.onSelectThread?.(threadId, createStateCallback());
|
|
5338
5278
|
}, [callbacks, createStateCallback]);
|
|
5339
|
-
const handleRenameThread = (0,
|
|
5279
|
+
const handleRenameThread = (0, import_react9.useCallback)((threadId, newTitle) => {
|
|
5340
5280
|
callbacks.onRenameThread?.(threadId, newTitle, createStateCallback());
|
|
5341
5281
|
}, [callbacks, createStateCallback]);
|
|
5342
|
-
const handleDeleteThread = (0,
|
|
5282
|
+
const handleDeleteThread = (0, import_react9.useCallback)((threadId) => {
|
|
5343
5283
|
callbacks.onDeleteThread?.(threadId, createStateCallback());
|
|
5344
5284
|
}, [callbacks, createStateCallback]);
|
|
5345
|
-
const handleArchiveThread = (0,
|
|
5285
|
+
const handleArchiveThread = (0, import_react9.useCallback)((threadId) => {
|
|
5346
5286
|
callbacks.onArchiveThread?.(threadId, createStateCallback());
|
|
5347
5287
|
}, [callbacks, createStateCallback]);
|
|
5348
|
-
const closeSidebar = (0,
|
|
5288
|
+
const closeSidebar = (0, import_react9.useCallback)(() => {
|
|
5349
5289
|
setState((prev) => ({ ...prev, showSidebar: false }));
|
|
5350
5290
|
}, []);
|
|
5351
|
-
const handleCustomComponentToggle = (0,
|
|
5291
|
+
const handleCustomComponentToggle = (0, import_react9.useCallback)(() => {
|
|
5352
5292
|
setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
|
|
5353
5293
|
}, []);
|
|
5354
|
-
const sidebarUser = (0,
|
|
5294
|
+
const sidebarUser = (0, import_react9.useMemo)(() => user ? {
|
|
5355
5295
|
id: user.id,
|
|
5356
5296
|
name: user.name,
|
|
5357
5297
|
email: user.email,
|
|
5358
5298
|
avatar: user.avatar
|
|
5359
5299
|
} : null, [user?.id, user?.name, user?.email, user?.avatar]);
|
|
5360
|
-
const handleViewProfile = (0,
|
|
5300
|
+
const handleViewProfile = (0, import_react9.useCallback)(() => {
|
|
5361
5301
|
setIsUserProfileOpen(true);
|
|
5362
5302
|
callbacks.onViewProfile?.();
|
|
5363
5303
|
}, [callbacks.onViewProfile]);
|
|
5364
|
-
const sidebarUserMenuCallbacks = (0,
|
|
5304
|
+
const sidebarUserMenuCallbacks = (0, import_react9.useMemo)(() => ({
|
|
5365
5305
|
onViewProfile: handleViewProfile,
|
|
5366
5306
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5367
5307
|
onThemeChange: callbacks.onThemeChange,
|
|
5368
5308
|
onLogout: callbacks.onLogout
|
|
5369
5309
|
}), [handleViewProfile, callbacks.onOpenSettings, callbacks.onThemeChange, callbacks.onLogout]);
|
|
5370
|
-
const renderCustomComponent = (0,
|
|
5310
|
+
const renderCustomComponent = (0, import_react9.useCallback)(() => {
|
|
5371
5311
|
const component = config?.customComponent?.component;
|
|
5372
5312
|
if (!component) return null;
|
|
5373
5313
|
if (typeof component === "function") {
|
|
@@ -5375,16 +5315,16 @@ var ChatUI = ({
|
|
|
5375
5315
|
}
|
|
5376
5316
|
return component;
|
|
5377
5317
|
}, [config?.customComponent?.component, closeSidebar, isMobile]);
|
|
5378
|
-
const SuggestionIconComponents = [
|
|
5318
|
+
const SuggestionIconComponents = [import_lucide_react14.MessageSquare, import_lucide_react14.Lightbulb, import_lucide_react14.Zap, import_lucide_react14.HelpCircle];
|
|
5379
5319
|
const renderSuggestions = () => {
|
|
5380
5320
|
if (messages.length > 0 || !suggestions.length) return null;
|
|
5381
|
-
return /* @__PURE__ */ (0,
|
|
5382
|
-
/* @__PURE__ */ (0,
|
|
5383
|
-
/* @__PURE__ */ (0,
|
|
5384
|
-
/* @__PURE__ */ (0,
|
|
5385
|
-
/* @__PURE__ */ (0,
|
|
5321
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
5322
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-center mb-8", children: [
|
|
5323
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Sparkles, { className: "w-7 h-7 text-primary" }) }),
|
|
5324
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
5325
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
5386
5326
|
] }),
|
|
5387
|
-
/* @__PURE__ */ (0,
|
|
5327
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5388
5328
|
"button",
|
|
5389
5329
|
{
|
|
5390
5330
|
type: "button",
|
|
@@ -5393,10 +5333,10 @@ var ChatUI = ({
|
|
|
5393
5333
|
children: [
|
|
5394
5334
|
(() => {
|
|
5395
5335
|
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
5396
|
-
return /* @__PURE__ */ (0,
|
|
5336
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("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__ */ (0, import_jsx_runtime27.jsx)(IconComponent, { className: "h-4 w-4" }) });
|
|
5397
5337
|
})(),
|
|
5398
|
-
/* @__PURE__ */ (0,
|
|
5399
|
-
/* @__PURE__ */ (0,
|
|
5338
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
|
|
5339
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.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" })
|
|
5400
5340
|
]
|
|
5401
5341
|
},
|
|
5402
5342
|
index
|
|
@@ -5407,41 +5347,41 @@ var ChatUI = ({
|
|
|
5407
5347
|
const items = messageSuggestions?.[messageId];
|
|
5408
5348
|
if (!items || items.length === 0) return null;
|
|
5409
5349
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5410
|
-
return /* @__PURE__ */ (0,
|
|
5350
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`, children: items.map((suggestion, index) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5411
5351
|
"button",
|
|
5412
5352
|
{
|
|
5413
5353
|
type: "button",
|
|
5414
5354
|
onClick: () => handleSendMessage(suggestion),
|
|
5415
5355
|
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",
|
|
5416
5356
|
children: [
|
|
5417
|
-
/* @__PURE__ */ (0,
|
|
5418
|
-
/* @__PURE__ */ (0,
|
|
5357
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5358
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5419
5359
|
]
|
|
5420
5360
|
},
|
|
5421
5361
|
`${messageId}-suggestion-${index}`
|
|
5422
5362
|
)) });
|
|
5423
5363
|
};
|
|
5424
|
-
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ (0,
|
|
5364
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5425
5365
|
const isUserRow = index % 2 === 1;
|
|
5426
|
-
return /* @__PURE__ */ (0,
|
|
5366
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5427
5367
|
"div",
|
|
5428
5368
|
{
|
|
5429
5369
|
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
5430
5370
|
children: [
|
|
5431
|
-
!isUserRow && /* @__PURE__ */ (0,
|
|
5432
|
-
/* @__PURE__ */ (0,
|
|
5433
|
-
/* @__PURE__ */ (0,
|
|
5434
|
-
/* @__PURE__ */ (0,
|
|
5435
|
-
/* @__PURE__ */ (0,
|
|
5371
|
+
!isUserRow && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
5372
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
5373
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Skeleton, { className: "h-4 w-24" }),
|
|
5374
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Skeleton, { className: "h-4 w-full" }),
|
|
5375
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Skeleton, { className: "h-4 w-[85%]" })
|
|
5436
5376
|
] }),
|
|
5437
|
-
isUserRow && /* @__PURE__ */ (0,
|
|
5377
|
+
isUserRow && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
5438
5378
|
]
|
|
5439
5379
|
},
|
|
5440
5380
|
`message-skeleton-${index}`
|
|
5441
5381
|
);
|
|
5442
5382
|
}) });
|
|
5443
5383
|
const isMultiAgentMode = config.agentSelector?.mode === "multi";
|
|
5444
|
-
const messageProps = (0,
|
|
5384
|
+
const messageProps = (0, import_react9.useMemo)(() => ({
|
|
5445
5385
|
userAvatar: user?.avatar,
|
|
5446
5386
|
userName: user?.name,
|
|
5447
5387
|
assistantAvatar: assistant?.avatar,
|
|
@@ -5451,11 +5391,10 @@ var ChatUI = ({
|
|
|
5451
5391
|
enableCopy: config.features.enableMessageCopy,
|
|
5452
5392
|
enableEdit: config.features.enableMessageEditing,
|
|
5453
5393
|
enableRegenerate: config.features.enableRegeneration,
|
|
5454
|
-
|
|
5394
|
+
activityDisplay: config.features.activityDisplay,
|
|
5455
5395
|
compactMode: config.ui.compactMode,
|
|
5456
5396
|
onAction: handleMessageAction,
|
|
5457
|
-
|
|
5458
|
-
thinkingLabel: config.labels.thinking,
|
|
5397
|
+
labels: config.labels,
|
|
5459
5398
|
showMoreLabel: config.labels.showMoreMessage,
|
|
5460
5399
|
showLessLabel: config.labels.showLessMessage,
|
|
5461
5400
|
collapseLongMessages: config.ui.collapseLongMessages,
|
|
@@ -5479,9 +5418,8 @@ var ChatUI = ({
|
|
|
5479
5418
|
config.features.enableMessageCopy,
|
|
5480
5419
|
config.features.enableMessageEditing,
|
|
5481
5420
|
config.features.enableRegeneration,
|
|
5482
|
-
config.features.
|
|
5483
|
-
config.labels
|
|
5484
|
-
config.labels.thinking,
|
|
5421
|
+
config.features.activityDisplay,
|
|
5422
|
+
config.labels,
|
|
5485
5423
|
config.labels.showMoreMessage,
|
|
5486
5424
|
config.labels.showLessMessage,
|
|
5487
5425
|
config.ui.collapseLongMessages,
|
|
@@ -5496,8 +5434,8 @@ var ChatUI = ({
|
|
|
5496
5434
|
const shouldShowAgentSelector = Boolean(
|
|
5497
5435
|
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5498
5436
|
);
|
|
5499
|
-
return /* @__PURE__ */ (0,
|
|
5500
|
-
/* @__PURE__ */ (0,
|
|
5437
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
|
|
5438
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5501
5439
|
Sidebar2,
|
|
5502
5440
|
{
|
|
5503
5441
|
threads,
|
|
@@ -5514,8 +5452,8 @@ var ChatUI = ({
|
|
|
5514
5452
|
showThemeOptions: !!callbacks.onThemeChange
|
|
5515
5453
|
}
|
|
5516
5454
|
),
|
|
5517
|
-
/* @__PURE__ */ (0,
|
|
5518
|
-
/* @__PURE__ */ (0,
|
|
5455
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(SidebarInset, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5456
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5519
5457
|
ChatHeader,
|
|
5520
5458
|
{
|
|
5521
5459
|
config,
|
|
@@ -5533,9 +5471,9 @@ var ChatUI = ({
|
|
|
5533
5471
|
onParticipantsChange
|
|
5534
5472
|
}
|
|
5535
5473
|
),
|
|
5536
|
-
/* @__PURE__ */ (0,
|
|
5537
|
-
/* @__PURE__ */ (0,
|
|
5538
|
-
/* @__PURE__ */ (0,
|
|
5474
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5475
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5476
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5539
5477
|
ScrollArea,
|
|
5540
5478
|
{
|
|
5541
5479
|
ref: scrollAreaRef,
|
|
@@ -5543,8 +5481,8 @@ var ChatUI = ({
|
|
|
5543
5481
|
viewportClassName: "p-4 overscroll-contain",
|
|
5544
5482
|
onScrollCapture: handleScroll,
|
|
5545
5483
|
style: { contain: "strict" },
|
|
5546
|
-
children: /* @__PURE__ */ (0,
|
|
5547
|
-
messages.length > 0 && /* @__PURE__ */ (0,
|
|
5484
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "max-w-4xl mx-auto pb-4", children: [
|
|
5485
|
+
messages.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex justify-center py-2", children: isLoadingOlderMessages ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("span", { className: "text-xs text-muted-foreground", children: config.labels.loadingOlderMessages }) : hasMoreMessagesBefore ? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5548
5486
|
"button",
|
|
5549
5487
|
{
|
|
5550
5488
|
type: "button",
|
|
@@ -5553,7 +5491,7 @@ var ChatUI = ({
|
|
|
5553
5491
|
children: config.labels.loadOlderMessages
|
|
5554
5492
|
}
|
|
5555
5493
|
) : null }),
|
|
5556
|
-
isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ (0,
|
|
5494
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : messages.length === 0 ? renderSuggestions() : /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5557
5495
|
"div",
|
|
5558
5496
|
{
|
|
5559
5497
|
style: {
|
|
@@ -5565,7 +5503,7 @@ var ChatUI = ({
|
|
|
5565
5503
|
const message = messages[virtualRow.index];
|
|
5566
5504
|
const prevMessage = virtualRow.index > 0 ? messages[virtualRow.index - 1] : null;
|
|
5567
5505
|
const isGrouped = prevMessage !== null && prevMessage.role === message.role && getMessageSpeakerKey(prevMessage) === getMessageSpeakerKey(message);
|
|
5568
|
-
return /* @__PURE__ */ (0,
|
|
5506
|
+
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5569
5507
|
"div",
|
|
5570
5508
|
{
|
|
5571
5509
|
"data-index": virtualRow.index,
|
|
@@ -5577,8 +5515,8 @@ var ChatUI = ({
|
|
|
5577
5515
|
width: "100%",
|
|
5578
5516
|
transform: `translateY(${virtualRow.start}px)`
|
|
5579
5517
|
},
|
|
5580
|
-
children: /* @__PURE__ */ (0,
|
|
5581
|
-
/* @__PURE__ */ (0,
|
|
5518
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: virtualRow.index === 0 ? "" : isGrouped ? "pt-2" : "pt-4", children: [
|
|
5519
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5582
5520
|
Message,
|
|
5583
5521
|
{
|
|
5584
5522
|
message,
|
|
@@ -5598,8 +5536,8 @@ var ChatUI = ({
|
|
|
5598
5536
|
] })
|
|
5599
5537
|
}
|
|
5600
5538
|
),
|
|
5601
|
-
/* @__PURE__ */ (0,
|
|
5602
|
-
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ (0,
|
|
5539
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5540
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "px-4 pt-1", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5603
5541
|
TargetAgentSelector,
|
|
5604
5542
|
{
|
|
5605
5543
|
agents: participantIds && participantIds.length > 0 ? agentOptions.filter((a) => participantIds.includes(a.id)) : agentOptions,
|
|
@@ -5609,7 +5547,7 @@ var ChatUI = ({
|
|
|
5609
5547
|
disabled: isGenerating
|
|
5610
5548
|
}
|
|
5611
5549
|
) }),
|
|
5612
|
-
/* @__PURE__ */ (0,
|
|
5550
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5613
5551
|
ChatInput,
|
|
5614
5552
|
{
|
|
5615
5553
|
value: inputValue,
|
|
@@ -5638,12 +5576,12 @@ var ChatUI = ({
|
|
|
5638
5576
|
)
|
|
5639
5577
|
] })
|
|
5640
5578
|
] }),
|
|
5641
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0,
|
|
5579
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5642
5580
|
"div",
|
|
5643
5581
|
{
|
|
5644
5582
|
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5645
5583
|
style: { width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0 },
|
|
5646
|
-
children: state.showSidebar && /* @__PURE__ */ (0,
|
|
5584
|
+
children: state.showSidebar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5647
5585
|
"div",
|
|
5648
5586
|
{
|
|
5649
5587
|
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
@@ -5655,8 +5593,8 @@ var ChatUI = ({
|
|
|
5655
5593
|
)
|
|
5656
5594
|
] })
|
|
5657
5595
|
] }) }),
|
|
5658
|
-
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ (0,
|
|
5659
|
-
/* @__PURE__ */ (0,
|
|
5596
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "fixed inset-0 z-50", children: [
|
|
5597
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5660
5598
|
"div",
|
|
5661
5599
|
{
|
|
5662
5600
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -5664,16 +5602,16 @@ var ChatUI = ({
|
|
|
5664
5602
|
onClick: closeSidebar
|
|
5665
5603
|
}
|
|
5666
5604
|
),
|
|
5667
|
-
/* @__PURE__ */ (0,
|
|
5605
|
+
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5668
5606
|
"div",
|
|
5669
5607
|
{
|
|
5670
5608
|
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"}`,
|
|
5671
5609
|
style: { willChange: "transform" },
|
|
5672
|
-
children: /* @__PURE__ */ (0,
|
|
5610
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5673
5611
|
}
|
|
5674
5612
|
)
|
|
5675
5613
|
] }),
|
|
5676
|
-
isUserProfileOpen && /* @__PURE__ */ (0,
|
|
5614
|
+
isUserProfileOpen && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5677
5615
|
UserProfile,
|
|
5678
5616
|
{
|
|
5679
5617
|
isOpen: isUserProfileOpen,
|
|
@@ -5694,290 +5632,12 @@ var ChatUI = ({
|
|
|
5694
5632
|
)
|
|
5695
5633
|
] }) }) });
|
|
5696
5634
|
};
|
|
5697
|
-
|
|
5698
|
-
// src/components/chat/ThreadManager.tsx
|
|
5699
|
-
var import_react9 = require("react");
|
|
5700
|
-
var import_lucide_react14 = require("lucide-react");
|
|
5701
|
-
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5702
|
-
var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
|
|
5703
|
-
const [isEditing, setIsEditing] = (0, import_react9.useState)(false);
|
|
5704
|
-
const [editTitle, setEditTitle] = (0, import_react9.useState)(thread.title);
|
|
5705
|
-
const inputRef = (0, import_react9.useRef)(null);
|
|
5706
|
-
(0, import_react9.useEffect)(() => {
|
|
5707
|
-
if (isEditing && inputRef.current) {
|
|
5708
|
-
inputRef.current.focus();
|
|
5709
|
-
inputRef.current.select();
|
|
5710
|
-
}
|
|
5711
|
-
}, [isEditing]);
|
|
5712
|
-
const handleSaveEdit = () => {
|
|
5713
|
-
const trimmedTitle = editTitle.trim();
|
|
5714
|
-
if (trimmedTitle && trimmedTitle !== thread.title) {
|
|
5715
|
-
onRename(trimmedTitle);
|
|
5716
|
-
}
|
|
5717
|
-
setIsEditing(false);
|
|
5718
|
-
};
|
|
5719
|
-
const handleCancelEdit = () => {
|
|
5720
|
-
setEditTitle(thread.title);
|
|
5721
|
-
setIsEditing(false);
|
|
5722
|
-
};
|
|
5723
|
-
const handleKeyDown = (e) => {
|
|
5724
|
-
if (e.key === "Enter") {
|
|
5725
|
-
handleSaveEdit();
|
|
5726
|
-
} else if (e.key === "Escape") {
|
|
5727
|
-
handleCancelEdit();
|
|
5728
|
-
}
|
|
5729
|
-
};
|
|
5730
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(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__ */ (0, import_jsx_runtime27.jsx)(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
|
|
5731
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2", children: [
|
|
5732
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5733
|
-
Input,
|
|
5734
|
-
{
|
|
5735
|
-
ref: inputRef,
|
|
5736
|
-
value: editTitle,
|
|
5737
|
-
onChange: (e) => setEditTitle(e.target.value),
|
|
5738
|
-
onKeyDown: handleKeyDown,
|
|
5739
|
-
onBlur: handleSaveEdit,
|
|
5740
|
-
className: "h-8 text-sm",
|
|
5741
|
-
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
|
|
5742
|
-
}
|
|
5743
|
-
),
|
|
5744
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Check, { className: "h-3 w-3" }) }),
|
|
5745
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.X, { className: "h-3 w-3" }) })
|
|
5746
|
-
] }) : /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5747
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
|
|
5748
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
5749
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5750
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Hash, { className: "h-3 w-3" }),
|
|
5751
|
-
thread.messageCount,
|
|
5752
|
-
" msgs"
|
|
5753
|
-
] }),
|
|
5754
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
|
|
5755
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center gap-1", children: [
|
|
5756
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Calendar, { className: "h-3 w-3" }),
|
|
5757
|
-
formatDate(thread.updatedAt, config?.labels)
|
|
5758
|
-
] }),
|
|
5759
|
-
thread.isArchived && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(import_jsx_runtime27.Fragment, { children: [
|
|
5760
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Separator, { orientation: "vertical", className: "h-3" }),
|
|
5761
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
5762
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Archive, { className: "h-2 w-2 mr-1" }),
|
|
5763
|
-
config?.labels?.archiveThread || "Archived"
|
|
5764
|
-
] })
|
|
5765
|
-
] })
|
|
5766
|
-
] })
|
|
5767
|
-
] }) }),
|
|
5768
|
-
!isEditing && /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenu, { children: [
|
|
5769
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.MoreVertical, { className: "h-3 w-3" }) }) }),
|
|
5770
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuContent, { align: "end", children: [
|
|
5771
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
|
|
5772
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Edit2, { className: "h-4 w-4 mr-2" }),
|
|
5773
|
-
config?.labels?.renameThread || "Rename"
|
|
5774
|
-
] }),
|
|
5775
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuItem, { onClick: onArchive, children: [
|
|
5776
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Archive, { className: "h-4 w-4 mr-2" }),
|
|
5777
|
-
thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
|
|
5778
|
-
] }),
|
|
5779
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DropdownMenuSeparator, {}),
|
|
5780
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
|
|
5781
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Trash2, { className: "h-4 w-4 mr-2" }),
|
|
5782
|
-
config?.labels?.deleteThread || "Delete"
|
|
5783
|
-
] })
|
|
5784
|
-
] })
|
|
5785
|
-
] })
|
|
5786
|
-
] }) }) });
|
|
5787
|
-
};
|
|
5788
|
-
var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
5789
|
-
const [title, setTitle] = (0, import_react9.useState)("");
|
|
5790
|
-
const [isOpen, setIsOpen] = (0, import_react9.useState)(false);
|
|
5791
|
-
const handleCreate = () => {
|
|
5792
|
-
onCreateThread(title.trim() || void 0);
|
|
5793
|
-
setTitle("");
|
|
5794
|
-
setIsOpen(false);
|
|
5795
|
-
};
|
|
5796
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
5797
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTrigger, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Button, { variant: "outline", className: "w-full", children: [
|
|
5798
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Plus, { className: "h-4 w-4 mr-2" }),
|
|
5799
|
-
config?.labels?.createNewThread || "New Conversation"
|
|
5800
|
-
] }) }),
|
|
5801
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogContent, { children: [
|
|
5802
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogHeader, { children: [
|
|
5803
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
|
|
5804
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
5805
|
-
] }),
|
|
5806
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5807
|
-
Input,
|
|
5808
|
-
{
|
|
5809
|
-
value: title,
|
|
5810
|
-
onChange: (e) => setTitle(e.target.value),
|
|
5811
|
-
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name (optional)",
|
|
5812
|
-
onKeyDown: (e) => e.key === "Enter" && handleCreate(),
|
|
5813
|
-
autoFocus: true
|
|
5814
|
-
}
|
|
5815
|
-
),
|
|
5816
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(DialogFooter, { children: [
|
|
5817
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
|
|
5818
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
|
|
5819
|
-
] })
|
|
5820
|
-
] })
|
|
5821
|
-
] });
|
|
5822
|
-
};
|
|
5823
|
-
var ThreadManager = ({
|
|
5824
|
-
threads,
|
|
5825
|
-
currentThreadId,
|
|
5826
|
-
config,
|
|
5827
|
-
onCreateThread,
|
|
5828
|
-
onSelectThread,
|
|
5829
|
-
onRenameThread,
|
|
5830
|
-
onDeleteThread,
|
|
5831
|
-
onArchiveThread,
|
|
5832
|
-
isOpen = false,
|
|
5833
|
-
onClose,
|
|
5834
|
-
className = ""
|
|
5835
|
-
}) => {
|
|
5836
|
-
const [searchQuery, setSearchQuery] = (0, import_react9.useState)("");
|
|
5837
|
-
const [showArchived, setShowArchived] = (0, import_react9.useState)(false);
|
|
5838
|
-
const [deleteThreadId, setDeleteThreadId] = (0, import_react9.useState)(null);
|
|
5839
|
-
const filteredThreads = threads.filter((thread) => {
|
|
5840
|
-
const title = (thread.title ?? "").toString();
|
|
5841
|
-
const matchesSearch = title.toLowerCase().includes(searchQuery.toLowerCase());
|
|
5842
|
-
const matchesArchiveFilter = showArchived || !thread.isArchived;
|
|
5843
|
-
return matchesSearch && matchesArchiveFilter;
|
|
5844
|
-
});
|
|
5845
|
-
const groupedThreads = filteredThreads.reduce((groups, thread) => {
|
|
5846
|
-
const date = new Date(thread.updatedAt);
|
|
5847
|
-
const today = /* @__PURE__ */ new Date();
|
|
5848
|
-
const yesterday = new Date(today.getTime() - 24 * 60 * 60 * 1e3);
|
|
5849
|
-
let groupKey;
|
|
5850
|
-
if (date.toDateString() === today.toDateString()) {
|
|
5851
|
-
groupKey = config?.labels?.today || "Today";
|
|
5852
|
-
} else if (date.toDateString() === yesterday.toDateString()) {
|
|
5853
|
-
groupKey = config?.labels?.yesterday || "Yesterday";
|
|
5854
|
-
} else {
|
|
5855
|
-
groupKey = date.toLocaleDateString("en-US", {
|
|
5856
|
-
weekday: "long",
|
|
5857
|
-
day: "2-digit",
|
|
5858
|
-
month: "long"
|
|
5859
|
-
});
|
|
5860
|
-
}
|
|
5861
|
-
if (!groups[groupKey]) {
|
|
5862
|
-
groups[groupKey] = [];
|
|
5863
|
-
}
|
|
5864
|
-
groups[groupKey].push(thread);
|
|
5865
|
-
return groups;
|
|
5866
|
-
}, {});
|
|
5867
|
-
const handleDeleteThread = (threadId) => {
|
|
5868
|
-
onDeleteThread?.(threadId);
|
|
5869
|
-
setDeleteThreadId(null);
|
|
5870
|
-
};
|
|
5871
|
-
if (!isOpen) return null;
|
|
5872
|
-
return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TooltipProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
|
|
5873
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Card, { className: "h-full border-0 rounded-none", children: [
|
|
5874
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CardHeader, { className: "border-b", children: [
|
|
5875
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5876
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CardTitle, { className: "flex items-center gap-2", children: [
|
|
5877
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.MessageSquare, { className: "h-5 w-5" }),
|
|
5878
|
-
config?.labels?.newChat || "Conversations"
|
|
5879
|
-
] }),
|
|
5880
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.X, { className: "h-4 w-4" }) })
|
|
5881
|
-
] }),
|
|
5882
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "space-y-3", children: [
|
|
5883
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "relative", children: [
|
|
5884
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Search, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
5885
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5886
|
-
Input,
|
|
5887
|
-
{
|
|
5888
|
-
placeholder: config?.labels?.search || "Search conversations...",
|
|
5889
|
-
value: searchQuery,
|
|
5890
|
-
onChange: (e) => setSearchQuery(e.target.value),
|
|
5891
|
-
className: "pl-9"
|
|
5892
|
-
}
|
|
5893
|
-
)
|
|
5894
|
-
] }),
|
|
5895
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex items-center justify-between", children: [
|
|
5896
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
|
|
5897
|
-
Button,
|
|
5898
|
-
{
|
|
5899
|
-
variant: "outline",
|
|
5900
|
-
size: "sm",
|
|
5901
|
-
onClick: () => setShowArchived(!showArchived),
|
|
5902
|
-
className: "text-xs",
|
|
5903
|
-
children: [
|
|
5904
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.Filter, { className: "h-3 w-3 mr-1" }),
|
|
5905
|
-
showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
|
|
5906
|
-
]
|
|
5907
|
-
}
|
|
5908
|
-
),
|
|
5909
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
5910
|
-
filteredThreads.length,
|
|
5911
|
-
" / ",
|
|
5912
|
-
threads.length
|
|
5913
|
-
] })
|
|
5914
|
-
] })
|
|
5915
|
-
] })
|
|
5916
|
-
] }),
|
|
5917
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(CardContent, { className: "p-0 flex-1", children: [
|
|
5918
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CreateThreadDialog2, { onCreateThread, config }) }),
|
|
5919
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-center py-8 text-muted-foreground", children: [
|
|
5920
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_lucide_react14.MessageSquare, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
|
|
5921
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
|
|
5922
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { children: [
|
|
5923
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
|
|
5924
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5925
|
-
ThreadItem,
|
|
5926
|
-
{
|
|
5927
|
-
thread,
|
|
5928
|
-
isActive: currentThreadId === thread.id,
|
|
5929
|
-
config,
|
|
5930
|
-
onSelect: () => onSelectThread?.(thread.id),
|
|
5931
|
-
onRename: (newTitle) => onRenameThread?.(thread.id, newTitle),
|
|
5932
|
-
onDelete: () => setDeleteThreadId(thread.id),
|
|
5933
|
-
onArchive: () => onArchiveThread?.(thread.id)
|
|
5934
|
-
},
|
|
5935
|
-
thread.id
|
|
5936
|
-
)) })
|
|
5937
|
-
] }, group)) }) })
|
|
5938
|
-
] })
|
|
5939
|
-
] }) }),
|
|
5940
|
-
deleteThreadId && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AlertDialogContent, { children: [
|
|
5941
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AlertDialogHeader, { children: [
|
|
5942
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
5943
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
5944
|
-
] }),
|
|
5945
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(AlertDialogFooter, { children: [
|
|
5946
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
|
|
5947
|
-
/* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
|
|
5948
|
-
AlertDialogAction,
|
|
5949
|
-
{
|
|
5950
|
-
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
5951
|
-
className: "bg-destructive text-destructive-foreground hover:bg-destructive/90",
|
|
5952
|
-
children: config?.labels?.deleteThread || "Delete"
|
|
5953
|
-
}
|
|
5954
|
-
)
|
|
5955
|
-
] })
|
|
5956
|
-
] }) })
|
|
5957
|
-
] }) });
|
|
5958
|
-
};
|
|
5959
5635
|
// Annotate the CommonJS export names for ESM import in node:
|
|
5960
5636
|
0 && (module.exports = {
|
|
5961
|
-
|
|
5962
|
-
ChatHeader,
|
|
5963
|
-
ChatInput,
|
|
5637
|
+
AssistantActivity,
|
|
5964
5638
|
ChatUI,
|
|
5965
5639
|
ChatUserContextProvider,
|
|
5966
|
-
Message,
|
|
5967
|
-
ParticipantsSelector,
|
|
5968
|
-
Sidebar,
|
|
5969
|
-
TargetAgentSelector,
|
|
5970
|
-
ThreadManager,
|
|
5971
|
-
UserMenu,
|
|
5972
|
-
UserProfile,
|
|
5973
|
-
assignAgentColors,
|
|
5974
|
-
chatUtils,
|
|
5975
|
-
cn,
|
|
5976
|
-
createObjectUrlFromDataUrl,
|
|
5977
5640
|
defaultChatConfig,
|
|
5978
|
-
formatDate,
|
|
5979
|
-
getAgentColor,
|
|
5980
|
-
getAgentInitials,
|
|
5981
5641
|
mergeConfig,
|
|
5982
5642
|
useChatUserContext
|
|
5983
5643
|
});
|