@copilotz/chat-ui 0.7.1 → 0.7.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +714 -743
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +69 -26
- package/dist/index.d.ts +69 -26
- package/dist/index.js +842 -873
- package/dist/index.js.map +1 -1
- package/dist/styles.css +24 -60
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// src/components/chat/ChatUI.tsx
|
|
2
2
|
import {
|
|
3
3
|
useCallback as useCallback4,
|
|
4
|
-
useEffect as
|
|
5
|
-
useMemo as
|
|
4
|
+
useEffect as useEffect10,
|
|
5
|
+
useMemo as useMemo5,
|
|
6
6
|
useRef as useRef6,
|
|
7
7
|
useState as useState9
|
|
8
8
|
} from "react";
|
|
@@ -88,12 +88,13 @@ var defaultChatConfig = {
|
|
|
88
88
|
footerLabel: "Assistant can make mistakes. Check the AI results.",
|
|
89
89
|
daysAgo: "days ago",
|
|
90
90
|
inputHelpText: "Press Enter to send, Shift+Enter to add a new line.",
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
91
|
+
activityThinkingActive: "Thinking",
|
|
92
|
+
activityThinkingComplete: "Thought through request",
|
|
93
|
+
activityToolActive: "Using {{tool}}",
|
|
94
|
+
activityToolComplete: "Used {{tool}}",
|
|
95
|
+
activityToolFailed: "{{tool}} failed",
|
|
96
|
+
activityAnsweringActive: "Preparing response",
|
|
97
|
+
activityAnsweringComplete: "Prepared response",
|
|
97
98
|
activityShowDetails: "Show details",
|
|
98
99
|
activityHideDetails: "Hide details",
|
|
99
100
|
defaultThreadName: "Main Thread",
|
|
@@ -109,7 +110,8 @@ var defaultChatConfig = {
|
|
|
109
110
|
enableMessageEditing: true,
|
|
110
111
|
enableMessageCopy: true,
|
|
111
112
|
enableRegeneration: true,
|
|
112
|
-
|
|
113
|
+
showActivity: true,
|
|
114
|
+
showActivityDetails: true,
|
|
113
115
|
maxAttachments: 4,
|
|
114
116
|
maxFileSize: 10 * 1024 * 1024
|
|
115
117
|
// 10MB
|
|
@@ -181,55 +183,11 @@ function mergeConfig(_baseConfig, userConfig) {
|
|
|
181
183
|
}
|
|
182
184
|
|
|
183
185
|
// src/components/chat/Message.tsx
|
|
184
|
-
import React2, { useState as useState2, useMemo
|
|
186
|
+
import React2, { useState as useState2, useMemo, useEffect, memo as memo2 } from "react";
|
|
185
187
|
import ReactMarkdown from "react-markdown";
|
|
186
188
|
import remarkGfm from "remark-gfm";
|
|
187
189
|
import rehypeHighlight from "rehype-highlight";
|
|
188
190
|
|
|
189
|
-
// src/lib/chatUtils.ts
|
|
190
|
-
var AGENT_COLORS = [
|
|
191
|
-
"#6366f1",
|
|
192
|
-
// indigo
|
|
193
|
-
"#8b5cf6",
|
|
194
|
-
// violet
|
|
195
|
-
"#ec4899",
|
|
196
|
-
// pink
|
|
197
|
-
"#f59e0b",
|
|
198
|
-
// amber
|
|
199
|
-
"#10b981",
|
|
200
|
-
// emerald
|
|
201
|
-
"#3b82f6",
|
|
202
|
-
// blue
|
|
203
|
-
"#ef4444",
|
|
204
|
-
// red
|
|
205
|
-
"#14b8a6",
|
|
206
|
-
// teal
|
|
207
|
-
"#f97316",
|
|
208
|
-
// orange
|
|
209
|
-
"#84cc16"
|
|
210
|
-
// lime
|
|
211
|
-
];
|
|
212
|
-
function getAgentColor(agentId) {
|
|
213
|
-
let hash = 0;
|
|
214
|
-
for (let i = 0; i < agentId.length; i++) {
|
|
215
|
-
hash = (hash << 5) - hash + agentId.charCodeAt(i) | 0;
|
|
216
|
-
}
|
|
217
|
-
return AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length];
|
|
218
|
-
}
|
|
219
|
-
function getAgentInitials(name) {
|
|
220
|
-
const parts = name.trim().split(/\s+/);
|
|
221
|
-
if (parts.length >= 2) {
|
|
222
|
-
return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
223
|
-
}
|
|
224
|
-
return name.slice(0, 2).toUpperCase();
|
|
225
|
-
}
|
|
226
|
-
function assignAgentColors(agents) {
|
|
227
|
-
return agents.map((agent) => ({
|
|
228
|
-
...agent,
|
|
229
|
-
color: agent.color || getAgentColor(agent.id)
|
|
230
|
-
}));
|
|
231
|
-
}
|
|
232
|
-
|
|
233
191
|
// src/components/ui/button.tsx
|
|
234
192
|
import { Slot } from "@radix-ui/react-slot";
|
|
235
193
|
import { cva } from "class-variance-authority";
|
|
@@ -304,59 +262,10 @@ function Button({
|
|
|
304
262
|
);
|
|
305
263
|
}
|
|
306
264
|
|
|
307
|
-
// src/components/ui/avatar.tsx
|
|
308
|
-
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
309
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
310
|
-
function Avatar({
|
|
311
|
-
className,
|
|
312
|
-
...props
|
|
313
|
-
}) {
|
|
314
|
-
return /* @__PURE__ */ jsx2(
|
|
315
|
-
AvatarPrimitive.Root,
|
|
316
|
-
{
|
|
317
|
-
"data-slot": "avatar",
|
|
318
|
-
className: cn(
|
|
319
|
-
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
320
|
-
className
|
|
321
|
-
),
|
|
322
|
-
...props
|
|
323
|
-
}
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
function AvatarImage({
|
|
327
|
-
className,
|
|
328
|
-
...props
|
|
329
|
-
}) {
|
|
330
|
-
return /* @__PURE__ */ jsx2(
|
|
331
|
-
AvatarPrimitive.Image,
|
|
332
|
-
{
|
|
333
|
-
"data-slot": "avatar-image",
|
|
334
|
-
className: cn("aspect-square size-full", className),
|
|
335
|
-
...props
|
|
336
|
-
}
|
|
337
|
-
);
|
|
338
|
-
}
|
|
339
|
-
function AvatarFallback({
|
|
340
|
-
className,
|
|
341
|
-
...props
|
|
342
|
-
}) {
|
|
343
|
-
return /* @__PURE__ */ jsx2(
|
|
344
|
-
AvatarPrimitive.Fallback,
|
|
345
|
-
{
|
|
346
|
-
"data-slot": "avatar-fallback",
|
|
347
|
-
className: cn(
|
|
348
|
-
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
349
|
-
className
|
|
350
|
-
),
|
|
351
|
-
...props
|
|
352
|
-
}
|
|
353
|
-
);
|
|
354
|
-
}
|
|
355
|
-
|
|
356
265
|
// src/components/ui/badge.tsx
|
|
357
266
|
import { Slot as Slot2 } from "@radix-ui/react-slot";
|
|
358
267
|
import { cva as cva2 } from "class-variance-authority";
|
|
359
|
-
import { jsx as
|
|
268
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
360
269
|
var badgeVariants = cva2(
|
|
361
270
|
"inline-flex items-center justify-center rounded-md border px-2 py-0.5 text-xs font-medium w-fit whitespace-nowrap shrink-0 [&>svg]:size-3 gap-1 [&>svg]:pointer-events-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive transition-[color,box-shadow] overflow-hidden",
|
|
362
271
|
{
|
|
@@ -380,7 +289,7 @@ function Badge({
|
|
|
380
289
|
...props
|
|
381
290
|
}) {
|
|
382
291
|
const Comp = asChild ? Slot2 : "span";
|
|
383
|
-
return /* @__PURE__ */
|
|
292
|
+
return /* @__PURE__ */ jsx2(
|
|
384
293
|
Comp,
|
|
385
294
|
{
|
|
386
295
|
"data-slot": "badge",
|
|
@@ -391,9 +300,9 @@ function Badge({
|
|
|
391
300
|
}
|
|
392
301
|
|
|
393
302
|
// src/components/ui/textarea.tsx
|
|
394
|
-
import { jsx as
|
|
303
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
395
304
|
function Textarea({ className, ...props }) {
|
|
396
|
-
return /* @__PURE__ */
|
|
305
|
+
return /* @__PURE__ */ jsx3(
|
|
397
306
|
"textarea",
|
|
398
307
|
{
|
|
399
308
|
"data-slot": "textarea",
|
|
@@ -408,12 +317,12 @@ function Textarea({ className, ...props }) {
|
|
|
408
317
|
|
|
409
318
|
// src/components/ui/tooltip.tsx
|
|
410
319
|
import * as TooltipPrimitive from "@radix-ui/react-tooltip";
|
|
411
|
-
import { jsx as
|
|
320
|
+
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
412
321
|
function TooltipProvider({
|
|
413
322
|
delayDuration = 0,
|
|
414
323
|
...props
|
|
415
324
|
}) {
|
|
416
|
-
return /* @__PURE__ */
|
|
325
|
+
return /* @__PURE__ */ jsx4(
|
|
417
326
|
TooltipPrimitive.Provider,
|
|
418
327
|
{
|
|
419
328
|
"data-slot": "tooltip-provider",
|
|
@@ -425,12 +334,12 @@ function TooltipProvider({
|
|
|
425
334
|
function Tooltip({
|
|
426
335
|
...props
|
|
427
336
|
}) {
|
|
428
|
-
return /* @__PURE__ */
|
|
337
|
+
return /* @__PURE__ */ jsx4(TooltipProvider, { children: /* @__PURE__ */ jsx4(TooltipPrimitive.Root, { "data-slot": "tooltip", ...props }) });
|
|
429
338
|
}
|
|
430
339
|
function TooltipTrigger({
|
|
431
340
|
...props
|
|
432
341
|
}) {
|
|
433
|
-
return /* @__PURE__ */
|
|
342
|
+
return /* @__PURE__ */ jsx4(TooltipPrimitive.Trigger, { "data-slot": "tooltip-trigger", ...props });
|
|
434
343
|
}
|
|
435
344
|
function TooltipContent({
|
|
436
345
|
className,
|
|
@@ -438,7 +347,7 @@ function TooltipContent({
|
|
|
438
347
|
children,
|
|
439
348
|
...props
|
|
440
349
|
}) {
|
|
441
|
-
return /* @__PURE__ */
|
|
350
|
+
return /* @__PURE__ */ jsx4(TooltipPrimitive.Portal, { children: /* @__PURE__ */ jsxs(
|
|
442
351
|
TooltipPrimitive.Content,
|
|
443
352
|
{
|
|
444
353
|
"data-slot": "tooltip-content",
|
|
@@ -450,233 +359,267 @@ function TooltipContent({
|
|
|
450
359
|
...props,
|
|
451
360
|
children: [
|
|
452
361
|
children,
|
|
453
|
-
/* @__PURE__ */
|
|
362
|
+
/* @__PURE__ */ jsx4(TooltipPrimitive.Arrow, { className: "bg-primary fill-primary z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px]" })
|
|
454
363
|
]
|
|
455
364
|
}
|
|
456
365
|
) });
|
|
457
366
|
}
|
|
458
367
|
|
|
459
368
|
// src/components/chat/AssistantActivity.tsx
|
|
460
|
-
import { memo,
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
function Card({ className, ...props }) {
|
|
465
|
-
return /* @__PURE__ */ jsx6(
|
|
466
|
-
"div",
|
|
467
|
-
{
|
|
468
|
-
"data-slot": "card",
|
|
469
|
-
className: cn(
|
|
470
|
-
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
471
|
-
className
|
|
472
|
-
),
|
|
473
|
-
...props
|
|
474
|
-
}
|
|
475
|
-
);
|
|
476
|
-
}
|
|
477
|
-
function CardHeader({ className, ...props }) {
|
|
478
|
-
return /* @__PURE__ */ jsx6(
|
|
479
|
-
"div",
|
|
480
|
-
{
|
|
481
|
-
"data-slot": "card-header",
|
|
482
|
-
className: cn(
|
|
483
|
-
"@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",
|
|
484
|
-
className
|
|
485
|
-
),
|
|
486
|
-
...props
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
function CardContent({ className, ...props }) {
|
|
491
|
-
return /* @__PURE__ */ jsx6(
|
|
492
|
-
"div",
|
|
493
|
-
{
|
|
494
|
-
"data-slot": "card-content",
|
|
495
|
-
className: cn("px-6", className),
|
|
496
|
-
...props
|
|
497
|
-
}
|
|
498
|
-
);
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
// src/components/ui/collapsible.tsx
|
|
502
|
-
import * as CollapsiblePrimitive from "@radix-ui/react-collapsible";
|
|
503
|
-
var Collapsible = CollapsiblePrimitive.Root;
|
|
504
|
-
var CollapsibleTrigger2 = CollapsiblePrimitive.CollapsibleTrigger;
|
|
505
|
-
var CollapsibleContent2 = CollapsiblePrimitive.CollapsibleContent;
|
|
506
|
-
|
|
507
|
-
// src/components/chat/AssistantActivity.tsx
|
|
508
|
-
import { Brain, ChevronDown, ChevronRight, LoaderCircle, Sparkles, Wrench } from "lucide-react";
|
|
509
|
-
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
510
|
-
var ROOT_SPACING_CLASS = "mb-4 w-full max-w-full min-w-0";
|
|
511
|
-
var ACTION_SLOT_CLASS = "inline-flex h-9 min-w-[132px] items-center justify-end px-2 text-xs";
|
|
369
|
+
import { memo, useState } from "react";
|
|
370
|
+
import { CheckCircle2, ChevronDown, ChevronRight, CircleAlert, LoaderCircle, Wrench, Brain, Sparkles } from "lucide-react";
|
|
371
|
+
import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
372
|
+
var ROOT_CLASS = "mb-4 w-full max-w-full min-w-0";
|
|
512
373
|
var interpolate = (template, replacements) => Object.entries(replacements).reduce(
|
|
513
374
|
(output, [key, value]) => output.replaceAll(`{{${key}}}`, String(value ?? "")),
|
|
514
375
|
template
|
|
515
376
|
);
|
|
516
|
-
var
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
});
|
|
523
|
-
}
|
|
524
|
-
if (
|
|
525
|
-
return interpolate(labels?.
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
}
|
|
529
|
-
return labels?.activityUsingTools || "Using tools...";
|
|
377
|
+
var hasActiveItem = (activity) => activity.items.some((item) => item.status === "active");
|
|
378
|
+
var hasDetails = (item) => Boolean(item.details?.reasoning || item.details?.toolCall || item.details?.result !== void 0 || item.details?.error);
|
|
379
|
+
var resolveActivityLabel = (item, labels) => {
|
|
380
|
+
const tool = item.toolName || item.details?.toolCall?.name || "tool";
|
|
381
|
+
if (item.kind === "tool") {
|
|
382
|
+
if (item.status === "failed") {
|
|
383
|
+
return interpolate(labels?.activityToolFailed || "{{tool}} failed", { tool });
|
|
384
|
+
}
|
|
385
|
+
if (item.status === "complete") {
|
|
386
|
+
return interpolate(labels?.activityToolComplete || "Used {{tool}}", { tool });
|
|
387
|
+
}
|
|
388
|
+
return interpolate(labels?.activityToolActive || "Using {{tool}}", { tool });
|
|
530
389
|
}
|
|
531
|
-
if (
|
|
532
|
-
return labels?.
|
|
390
|
+
if (item.kind === "answering") {
|
|
391
|
+
return item.status === "active" ? labels?.activityAnsweringActive || "Preparing response" : labels?.activityAnsweringComplete || "Prepared response";
|
|
533
392
|
}
|
|
534
|
-
|
|
535
|
-
return labels?.activityWorking || "Working...";
|
|
536
|
-
}
|
|
537
|
-
return labels?.activityThinking || "Thinking...";
|
|
393
|
+
return item.status === "active" ? labels?.activityThinkingActive || "Thinking" : labels?.activityThinkingComplete || "Thought through request";
|
|
538
394
|
};
|
|
539
|
-
var
|
|
540
|
-
if (
|
|
541
|
-
|
|
542
|
-
}
|
|
543
|
-
if (
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
variant: "secondary",
|
|
548
|
-
className: "bg-emerald-500/10 text-emerald-700 dark:text-emerald-300",
|
|
549
|
-
children: "done"
|
|
550
|
-
}
|
|
551
|
-
);
|
|
552
|
-
}
|
|
553
|
-
if (toolCall.status === "running") {
|
|
554
|
-
return /* @__PURE__ */ jsx7(Badge, { variant: "secondary", className: "bg-primary/10 text-primary", children: "running" });
|
|
555
|
-
}
|
|
556
|
-
return /* @__PURE__ */ jsx7(Badge, { variant: "secondary", children: "pending" });
|
|
395
|
+
var ActivityIcon = ({ item }) => {
|
|
396
|
+
if (item.status === "active") return /* @__PURE__ */ jsx5(LoaderCircle, { className: "h-4 w-4 animate-spin text-primary" });
|
|
397
|
+
if (item.status === "failed") return /* @__PURE__ */ jsx5(CircleAlert, { className: "h-4 w-4 text-destructive" });
|
|
398
|
+
if (item.status === "complete") return /* @__PURE__ */ jsx5(CheckCircle2, { className: "h-4 w-4 text-muted-foreground" });
|
|
399
|
+
if (item.kind === "tool") return /* @__PURE__ */ jsx5(Wrench, { className: "h-4 w-4 text-muted-foreground" });
|
|
400
|
+
if (item.kind === "answering") return /* @__PURE__ */ jsx5(Sparkles, { className: "h-4 w-4 text-muted-foreground" });
|
|
401
|
+
if (item.kind === "thinking") return /* @__PURE__ */ jsx5(Brain, { className: "h-4 w-4 text-muted-foreground" });
|
|
402
|
+
return /* @__PURE__ */ jsx5(CheckCircle2, { className: "h-4 w-4 text-muted-foreground" });
|
|
557
403
|
};
|
|
558
|
-
var ActivitySummaryCard = memo(function ActivitySummaryCard2({
|
|
559
|
-
activity,
|
|
560
|
-
labels
|
|
561
|
-
}) {
|
|
562
|
-
const label = useMemo(() => resolveSummaryLabel(activity, labels), [activity, labels]);
|
|
563
|
-
const isActive = activity.isActive;
|
|
564
|
-
const icon = activity.summary.kind === "using_tools" ? /* @__PURE__ */ jsx7(Wrench, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : activity.summary.kind === "preparing_answer" ? /* @__PURE__ */ jsx7(Sparkles, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") }) : /* @__PURE__ */ jsx7(Brain, { className: cn("h-4 w-4 shrink-0", isActive ? "text-primary" : "text-muted-foreground") });
|
|
565
|
-
return /* @__PURE__ */ jsxs2(
|
|
566
|
-
"div",
|
|
567
|
-
{
|
|
568
|
-
className: cn(
|
|
569
|
-
"flex w-full min-w-0 items-center gap-2 rounded-lg border px-3 py-2 text-sm transition-colors",
|
|
570
|
-
isActive ? "border-primary/30 bg-primary/5 text-foreground" : "border-border/60 bg-muted/20 text-muted-foreground"
|
|
571
|
-
),
|
|
572
|
-
children: [
|
|
573
|
-
icon,
|
|
574
|
-
/* @__PURE__ */ jsx7("span", { className: "min-w-0 flex-1 truncate", children: label }),
|
|
575
|
-
isActive && /* @__PURE__ */ jsx7(LoaderCircle, { className: "h-4 w-4 shrink-0 animate-spin text-primary" })
|
|
576
|
-
]
|
|
577
|
-
}
|
|
578
|
-
);
|
|
579
|
-
});
|
|
580
|
-
var ActivitySummaryRow = memo(function ActivitySummaryRow2({
|
|
581
|
-
activity,
|
|
582
|
-
labels,
|
|
583
|
-
hasDetails,
|
|
584
|
-
open
|
|
585
|
-
}) {
|
|
586
|
-
return /* @__PURE__ */ jsxs2("div", { className: "grid w-full min-w-0 grid-cols-[minmax(0,1fr)_auto] items-center gap-2", children: [
|
|
587
|
-
/* @__PURE__ */ jsx7("div", { className: "min-w-0", children: /* @__PURE__ */ jsx7(ActivitySummaryCard, { activity, labels }) }),
|
|
588
|
-
hasDetails ? /* @__PURE__ */ jsx7(CollapsibleTrigger2, { asChild: true, children: /* @__PURE__ */ jsxs2(Button, { variant: "ghost", size: "sm", className: cn(ACTION_SLOT_CLASS, "shrink-0 text-muted-foreground"), children: [
|
|
589
|
-
open ? labels?.activityHideDetails || "Hide details" : labels?.activityShowDetails || "Show details",
|
|
590
|
-
open ? /* @__PURE__ */ jsx7(ChevronDown, { className: "ml-1 h-3.5 w-3.5" }) : /* @__PURE__ */ jsx7(ChevronRight, { className: "ml-1 h-3.5 w-3.5" })
|
|
591
|
-
] }) }) : /* @__PURE__ */ jsxs2("div", { "aria-hidden": "true", className: cn(ACTION_SLOT_CLASS, "pointer-events-none invisible shrink-0"), children: [
|
|
592
|
-
labels?.activityShowDetails || "Show details",
|
|
593
|
-
/* @__PURE__ */ jsx7(ChevronRight, { className: "ml-1 h-3.5 w-3.5" })
|
|
594
|
-
] })
|
|
595
|
-
] });
|
|
596
|
-
});
|
|
597
404
|
var ActivityDetails = memo(function ActivityDetails2({
|
|
598
|
-
|
|
405
|
+
item
|
|
599
406
|
}) {
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
/* @__PURE__ */ jsx7("div", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Tools" }),
|
|
607
|
-
activity.toolCalls.map((toolCall) => /* @__PURE__ */ jsx7(Card, { className: "border-border/60 bg-background/70", children: /* @__PURE__ */ jsxs2(CardContent, { className: "space-y-2 px-3 py-3", children: [
|
|
608
|
-
/* @__PURE__ */ jsxs2("div", { className: "flex items-center justify-between gap-3", children: [
|
|
609
|
-
/* @__PURE__ */ jsx7("div", { className: "min-w-0", children: /* @__PURE__ */ jsx7("div", { className: "truncate text-sm font-medium", children: toolCall.name }) }),
|
|
610
|
-
getStatusBadge(toolCall)
|
|
611
|
-
] }),
|
|
612
|
-
/* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
613
|
-
/* @__PURE__ */ jsxs2("div", { children: [
|
|
614
|
-
/* @__PURE__ */ jsx7("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Args" }),
|
|
615
|
-
/* @__PURE__ */ jsx7("pre", { className: "overflow-x-auto rounded-md bg-muted/70 p-2 text-xs text-muted-foreground", children: JSON.stringify(toolCall.arguments, null, 2) })
|
|
616
|
-
] }),
|
|
617
|
-
typeof toolCall.result !== "undefined" && /* @__PURE__ */ jsxs2("div", { children: [
|
|
618
|
-
/* @__PURE__ */ jsx7("div", { className: "mb-1 text-[11px] font-medium uppercase tracking-wide text-muted-foreground", children: "Result" }),
|
|
619
|
-
/* @__PURE__ */ jsx7("pre", { className: "overflow-x-auto rounded-md bg-muted/70 p-2 text-xs text-muted-foreground", children: JSON.stringify(toolCall.result, null, 2) })
|
|
620
|
-
] })
|
|
621
|
-
] })
|
|
622
|
-
] }) }, toolCall.id))
|
|
623
|
-
] })
|
|
407
|
+
const toolCall = item.details?.toolCall;
|
|
408
|
+
return /* @__PURE__ */ jsxs2("div", { className: "space-y-3 pb-1 pl-7 pt-2 text-sm text-muted-foreground", children: [
|
|
409
|
+
item.details?.reasoning && /* @__PURE__ */ jsx5("div", { className: "whitespace-pre-wrap break-words leading-6", children: item.details.reasoning }),
|
|
410
|
+
item.details?.error && /* @__PURE__ */ jsx5("div", { className: "text-destructive", children: item.details.error }),
|
|
411
|
+
toolCall && /* @__PURE__ */ jsx5("pre", { className: "overflow-x-auto rounded-md bg-muted/60 p-2 text-xs", children: JSON.stringify(toolCall.arguments, null, 2) }),
|
|
412
|
+
item.details?.result !== void 0 && /* @__PURE__ */ jsx5("pre", { className: "overflow-x-auto rounded-md bg-muted/60 p-2 text-xs", children: JSON.stringify(item.details.result, null, 2) })
|
|
624
413
|
] });
|
|
625
414
|
});
|
|
626
415
|
var ActivitySkeleton = memo(function ActivitySkeleton2() {
|
|
627
|
-
return /* @__PURE__ */
|
|
416
|
+
return /* @__PURE__ */ jsx5("div", { className: ROOT_CLASS, children: /* @__PURE__ */ jsxs2("div", { className: "flex w-full min-w-0 items-center gap-3 rounded-md border border-border/50 bg-muted/20 px-3 py-2", children: [
|
|
628
417
|
/* @__PURE__ */ jsxs2("div", { className: "flex items-center gap-1.5", children: [
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
/* @__PURE__ */
|
|
631
|
-
/* @__PURE__ */
|
|
418
|
+
/* @__PURE__ */ jsx5("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-primary/80" }),
|
|
419
|
+
/* @__PURE__ */ jsx5("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-primary/60 [animation-delay:120ms]" }),
|
|
420
|
+
/* @__PURE__ */ jsx5("span", { className: "inline-block h-2 w-2 animate-pulse rounded-full bg-primary/40 [animation-delay:240ms]" })
|
|
632
421
|
] }),
|
|
633
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ jsx5("div", { className: "h-3 w-28 animate-pulse rounded-full bg-muted" })
|
|
634
423
|
] }) });
|
|
635
424
|
});
|
|
636
|
-
var
|
|
425
|
+
var ActivityTimeline = memo(function ActivityTimeline2({
|
|
637
426
|
activity,
|
|
638
|
-
|
|
427
|
+
showActivityDetails,
|
|
639
428
|
labels
|
|
640
429
|
}) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
const [open, setOpen] = useState(activity.isActive && hasDetails);
|
|
653
|
-
useEffect(() => {
|
|
654
|
-
if (activity.isActive && hasDetails) {
|
|
655
|
-
setOpen(true);
|
|
656
|
-
}
|
|
657
|
-
}, [activity.isActive, hasDetails]);
|
|
658
|
-
return /* @__PURE__ */ jsx7(
|
|
659
|
-
Collapsible,
|
|
660
|
-
{
|
|
661
|
-
open: hasDetails ? open : false,
|
|
662
|
-
onOpenChange: hasDetails ? setOpen : void 0,
|
|
663
|
-
className: ROOT_SPACING_CLASS,
|
|
664
|
-
children: /* @__PURE__ */ jsxs2("div", { className: "space-y-2", children: [
|
|
665
|
-
/* @__PURE__ */ jsx7(
|
|
666
|
-
ActivitySummaryRow,
|
|
430
|
+
const [openById, setOpenById] = useState({});
|
|
431
|
+
return /* @__PURE__ */ jsx5("div", { className: ROOT_CLASS, children: /* @__PURE__ */ jsx5("div", { className: "space-y-1", children: activity.items.map((item, index) => {
|
|
432
|
+
const detailsAvailable = showActivityDetails && hasDetails(item);
|
|
433
|
+
const open = Boolean(openById[item.id]);
|
|
434
|
+
const isLast = index === activity.items.length - 1;
|
|
435
|
+
return /* @__PURE__ */ jsxs2("div", { className: "relative grid grid-cols-[1rem_minmax(0,1fr)] gap-3", children: [
|
|
436
|
+
!isLast && /* @__PURE__ */ jsx5("div", { className: "absolute left-2 top-5 h-[calc(100%-0.25rem)] w-px bg-border" }),
|
|
437
|
+
/* @__PURE__ */ jsx5("div", { className: "relative z-10 mt-1 flex h-4 w-4 items-center justify-center bg-background", children: /* @__PURE__ */ jsx5(ActivityIcon, { item }) }),
|
|
438
|
+
/* @__PURE__ */ jsxs2("div", { className: "min-w-0", children: [
|
|
439
|
+
/* @__PURE__ */ jsxs2(
|
|
440
|
+
Button,
|
|
667
441
|
{
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
442
|
+
type: "button",
|
|
443
|
+
variant: "ghost",
|
|
444
|
+
disabled: !detailsAvailable,
|
|
445
|
+
onClick: () => setOpenById((prev) => ({ ...prev, [item.id]: !prev[item.id] })),
|
|
446
|
+
className: cn(
|
|
447
|
+
"h-auto min-h-6 w-full justify-start gap-1 px-0 py-0 text-left text-sm font-normal text-muted-foreground hover:bg-transparent",
|
|
448
|
+
item.status === "active" && "text-foreground",
|
|
449
|
+
!detailsAvailable && "pointer-events-none opacity-100"
|
|
450
|
+
),
|
|
451
|
+
children: [
|
|
452
|
+
/* @__PURE__ */ jsx5("span", { className: "min-w-0 truncate", children: resolveActivityLabel(item, labels) }),
|
|
453
|
+
detailsAvailable && (open ? /* @__PURE__ */ jsx5(ChevronDown, { className: "h-3.5 w-3.5 shrink-0" }) : /* @__PURE__ */ jsx5(ChevronRight, { className: "h-3.5 w-3.5 shrink-0" }))
|
|
454
|
+
]
|
|
672
455
|
}
|
|
673
456
|
),
|
|
674
|
-
|
|
457
|
+
detailsAvailable && open && /* @__PURE__ */ jsx5(ActivityDetails, { item })
|
|
675
458
|
] })
|
|
459
|
+
] }, item.id);
|
|
460
|
+
}) }) });
|
|
461
|
+
});
|
|
462
|
+
var AssistantActivity = memo(function AssistantActivity2({
|
|
463
|
+
activity,
|
|
464
|
+
showActivity = true,
|
|
465
|
+
showActivityDetails = true,
|
|
466
|
+
labels
|
|
467
|
+
}) {
|
|
468
|
+
if (!activity || activity.items.length === 0) return null;
|
|
469
|
+
if (!showActivity) return hasActiveItem(activity) ? /* @__PURE__ */ jsx5(ActivitySkeleton, {}) : null;
|
|
470
|
+
return /* @__PURE__ */ jsx5(
|
|
471
|
+
ActivityTimeline,
|
|
472
|
+
{
|
|
473
|
+
activity,
|
|
474
|
+
showActivityDetails,
|
|
475
|
+
labels
|
|
676
476
|
}
|
|
677
477
|
);
|
|
678
478
|
});
|
|
679
479
|
|
|
480
|
+
// src/lib/chatUtils.ts
|
|
481
|
+
var AGENT_COLORS = [
|
|
482
|
+
"#6366f1",
|
|
483
|
+
// indigo
|
|
484
|
+
"#8b5cf6",
|
|
485
|
+
// violet
|
|
486
|
+
"#ec4899",
|
|
487
|
+
// pink
|
|
488
|
+
"#f59e0b",
|
|
489
|
+
// amber
|
|
490
|
+
"#10b981",
|
|
491
|
+
// emerald
|
|
492
|
+
"#3b82f6",
|
|
493
|
+
// blue
|
|
494
|
+
"#ef4444",
|
|
495
|
+
// red
|
|
496
|
+
"#14b8a6",
|
|
497
|
+
// teal
|
|
498
|
+
"#f97316",
|
|
499
|
+
// orange
|
|
500
|
+
"#84cc16"
|
|
501
|
+
// lime
|
|
502
|
+
];
|
|
503
|
+
function getAgentColor(agentId) {
|
|
504
|
+
let hash = 0;
|
|
505
|
+
for (let i = 0; i < agentId.length; i++) {
|
|
506
|
+
hash = (hash << 5) - hash + agentId.charCodeAt(i) | 0;
|
|
507
|
+
}
|
|
508
|
+
return AGENT_COLORS[Math.abs(hash) % AGENT_COLORS.length];
|
|
509
|
+
}
|
|
510
|
+
function getAgentInitials(name) {
|
|
511
|
+
const parts = name.trim().split(/\s+/);
|
|
512
|
+
if (parts.length >= 2) {
|
|
513
|
+
return (parts[0][0] + parts[1][0]).toUpperCase();
|
|
514
|
+
}
|
|
515
|
+
return name.slice(0, 2).toUpperCase();
|
|
516
|
+
}
|
|
517
|
+
function assignAgentColors(agents) {
|
|
518
|
+
return agents.map((agent) => ({
|
|
519
|
+
...agent,
|
|
520
|
+
color: agent.color || getAgentColor(agent.id)
|
|
521
|
+
}));
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// src/components/ui/avatar.tsx
|
|
525
|
+
import * as AvatarPrimitive from "@radix-ui/react-avatar";
|
|
526
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
527
|
+
function Avatar({
|
|
528
|
+
className,
|
|
529
|
+
...props
|
|
530
|
+
}) {
|
|
531
|
+
return /* @__PURE__ */ jsx6(
|
|
532
|
+
AvatarPrimitive.Root,
|
|
533
|
+
{
|
|
534
|
+
"data-slot": "avatar",
|
|
535
|
+
className: cn(
|
|
536
|
+
"relative flex size-8 shrink-0 overflow-hidden rounded-full",
|
|
537
|
+
className
|
|
538
|
+
),
|
|
539
|
+
...props
|
|
540
|
+
}
|
|
541
|
+
);
|
|
542
|
+
}
|
|
543
|
+
function AvatarImage({
|
|
544
|
+
className,
|
|
545
|
+
...props
|
|
546
|
+
}) {
|
|
547
|
+
return /* @__PURE__ */ jsx6(
|
|
548
|
+
AvatarPrimitive.Image,
|
|
549
|
+
{
|
|
550
|
+
"data-slot": "avatar-image",
|
|
551
|
+
className: cn("aspect-square size-full", className),
|
|
552
|
+
...props
|
|
553
|
+
}
|
|
554
|
+
);
|
|
555
|
+
}
|
|
556
|
+
function AvatarFallback({
|
|
557
|
+
className,
|
|
558
|
+
...props
|
|
559
|
+
}) {
|
|
560
|
+
return /* @__PURE__ */ jsx6(
|
|
561
|
+
AvatarPrimitive.Fallback,
|
|
562
|
+
{
|
|
563
|
+
"data-slot": "avatar-fallback",
|
|
564
|
+
className: cn(
|
|
565
|
+
"bg-muted flex size-full items-center justify-center rounded-full",
|
|
566
|
+
className
|
|
567
|
+
),
|
|
568
|
+
...props
|
|
569
|
+
}
|
|
570
|
+
);
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
// src/components/chat/MessageSender.tsx
|
|
574
|
+
import { Fragment, jsx as jsx7, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
575
|
+
var resolveMessageSenderDisplay = ({
|
|
576
|
+
sender,
|
|
577
|
+
fallbackName,
|
|
578
|
+
fallbackAvatar,
|
|
579
|
+
fallbackAvatarUrl,
|
|
580
|
+
compactMode = false
|
|
581
|
+
}) => {
|
|
582
|
+
const name = sender?.name?.trim() || fallbackName;
|
|
583
|
+
const isAgentLike = sender?.type === "agent" || sender?.type === "tool";
|
|
584
|
+
const color = sender?.color || (isAgentLike && sender?.id ? getAgentColor(sender.id) : void 0);
|
|
585
|
+
const fallbackClassName = color ? `${compactMode ? "text-[10px]" : ""}` : sender?.type === "user" ? "bg-primary text-primary-foreground" : "bg-secondary text-secondary-foreground";
|
|
586
|
+
const fallbackContent = isAgentLike ? getAgentInitials(name) : name.charAt(0).toUpperCase();
|
|
587
|
+
const shouldUseFallbackAvatar = Boolean(
|
|
588
|
+
fallbackAvatar && (!sender || sender.id === "assistant" && !sender.avatarUrl)
|
|
589
|
+
);
|
|
590
|
+
return {
|
|
591
|
+
name,
|
|
592
|
+
color,
|
|
593
|
+
avatar: /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
594
|
+
sender?.avatarUrl || fallbackAvatarUrl ? /* @__PURE__ */ jsx7(AvatarImage, { src: sender?.avatarUrl || fallbackAvatarUrl, alt: name }) : null,
|
|
595
|
+
shouldUseFallbackAvatar ? fallbackAvatar : /* @__PURE__ */ jsx7(
|
|
596
|
+
AvatarFallback,
|
|
597
|
+
{
|
|
598
|
+
className: fallbackClassName,
|
|
599
|
+
style: color ? { backgroundColor: color, color: "white" } : void 0,
|
|
600
|
+
children: fallbackContent
|
|
601
|
+
}
|
|
602
|
+
)
|
|
603
|
+
] })
|
|
604
|
+
};
|
|
605
|
+
};
|
|
606
|
+
var MessageSenderAvatar = ({
|
|
607
|
+
sender,
|
|
608
|
+
fallbackName,
|
|
609
|
+
fallbackAvatar,
|
|
610
|
+
fallbackAvatarUrl,
|
|
611
|
+
compactMode = false
|
|
612
|
+
}) => {
|
|
613
|
+
const display = resolveMessageSenderDisplay({
|
|
614
|
+
sender,
|
|
615
|
+
fallbackName,
|
|
616
|
+
fallbackAvatar,
|
|
617
|
+
fallbackAvatarUrl,
|
|
618
|
+
compactMode
|
|
619
|
+
});
|
|
620
|
+
return /* @__PURE__ */ jsx7(Avatar, { className: compactMode ? "h-6 w-6" : "h-8 w-8", children: display.avatar });
|
|
621
|
+
};
|
|
622
|
+
|
|
680
623
|
// src/components/chat/Message.tsx
|
|
681
624
|
import {
|
|
682
625
|
Copy,
|
|
@@ -685,12 +628,12 @@ import {
|
|
|
685
628
|
Check,
|
|
686
629
|
X
|
|
687
630
|
} from "lucide-react";
|
|
688
|
-
import { Fragment, jsx as jsx8, jsxs as
|
|
631
|
+
import { Fragment as Fragment2, jsx as jsx8, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
689
632
|
var hasRenderableAssistantBody = (message) => {
|
|
690
633
|
if (message.role !== "assistant") return true;
|
|
691
634
|
if (typeof message.content === "string" && message.content.trim().length > 0) return true;
|
|
692
635
|
if (Array.isArray(message.attachments) && message.attachments.length > 0) return true;
|
|
693
|
-
return Boolean(message.activity);
|
|
636
|
+
return Boolean(message.activity?.items.length);
|
|
694
637
|
};
|
|
695
638
|
var defaultMarkdownComponents = {
|
|
696
639
|
code: ({ node, className, children, ...props }) => {
|
|
@@ -741,7 +684,7 @@ var PlainTextContent = memo2(function PlainTextContent2({
|
|
|
741
684
|
chunkSize = 12e3,
|
|
742
685
|
style
|
|
743
686
|
}) {
|
|
744
|
-
const chunks =
|
|
687
|
+
const chunks = useMemo(() => getPlainTextChunks(content, chunkSize), [content, chunkSize]);
|
|
745
688
|
return /* @__PURE__ */ jsx8(
|
|
746
689
|
LongContentShell,
|
|
747
690
|
{
|
|
@@ -761,28 +704,28 @@ var StreamingText = memo2(function StreamingText2({
|
|
|
761
704
|
}) {
|
|
762
705
|
const hasContent = content.trim().length > 0;
|
|
763
706
|
const enableSyntaxHighlight = renderMarkdown && !isStreaming && hasCodeBlocks(content);
|
|
764
|
-
const mergedComponents =
|
|
707
|
+
const mergedComponents = useMemo(
|
|
765
708
|
() => ({
|
|
766
709
|
...defaultMarkdownComponents,
|
|
767
710
|
...markdown?.components
|
|
768
711
|
}),
|
|
769
712
|
[markdown?.components]
|
|
770
713
|
);
|
|
771
|
-
const mergedRemarkPlugins =
|
|
714
|
+
const mergedRemarkPlugins = useMemo(
|
|
772
715
|
() => [
|
|
773
716
|
...remarkPluginsDefault,
|
|
774
717
|
...markdown?.remarkPlugins ?? []
|
|
775
718
|
],
|
|
776
719
|
[markdown?.remarkPlugins]
|
|
777
720
|
);
|
|
778
|
-
const mergedRehypePlugins =
|
|
721
|
+
const mergedRehypePlugins = useMemo(
|
|
779
722
|
() => [
|
|
780
723
|
...enableSyntaxHighlight ? rehypePluginsDefault : rehypePluginsEmpty,
|
|
781
724
|
...markdown?.rehypePlugins ?? []
|
|
782
725
|
],
|
|
783
726
|
[enableSyntaxHighlight, markdown?.rehypePlugins]
|
|
784
727
|
);
|
|
785
|
-
return /* @__PURE__ */
|
|
728
|
+
return /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
786
729
|
hasContent ? renderMarkdown ? /* @__PURE__ */ jsx8(
|
|
787
730
|
LongContentShell,
|
|
788
731
|
{
|
|
@@ -810,7 +753,7 @@ var StreamingText = memo2(function StreamingText2({
|
|
|
810
753
|
});
|
|
811
754
|
var MediaRenderer = memo2(function MediaRenderer2({ attachment }) {
|
|
812
755
|
const [audioPlaybackSrc, setAudioPlaybackSrc] = useState2(attachment.dataUrl);
|
|
813
|
-
|
|
756
|
+
useEffect(() => {
|
|
814
757
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
815
758
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
816
759
|
return;
|
|
@@ -833,7 +776,7 @@ var MediaRenderer = memo2(function MediaRenderer2({ attachment }) {
|
|
|
833
776
|
};
|
|
834
777
|
switch (attachment.kind) {
|
|
835
778
|
case "image":
|
|
836
|
-
return /* @__PURE__ */
|
|
779
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative rounded-lg overflow-hidden border bg-muted/20 max-w-md", children: [
|
|
837
780
|
/* @__PURE__ */ jsx8(
|
|
838
781
|
"img",
|
|
839
782
|
{
|
|
@@ -856,7 +799,7 @@ var MediaRenderer = memo2(function MediaRenderer2({ attachment }) {
|
|
|
856
799
|
}
|
|
857
800
|
) });
|
|
858
801
|
case "video":
|
|
859
|
-
return /* @__PURE__ */
|
|
802
|
+
return /* @__PURE__ */ jsxs4("div", { className: "relative rounded-lg overflow-hidden border bg-muted/20 max-w-lg", children: [
|
|
860
803
|
/* @__PURE__ */ jsx8(
|
|
861
804
|
"video",
|
|
862
805
|
{
|
|
@@ -883,7 +826,8 @@ var arePropsEqual = (prevProps, nextProps) => {
|
|
|
883
826
|
if (prevProps.enableCopy !== nextProps.enableCopy) return false;
|
|
884
827
|
if (prevProps.enableEdit !== nextProps.enableEdit) return false;
|
|
885
828
|
if (prevProps.enableRegenerate !== nextProps.enableRegenerate) return false;
|
|
886
|
-
if (prevProps.
|
|
829
|
+
if (prevProps.showActivity !== nextProps.showActivity) return false;
|
|
830
|
+
if (prevProps.showActivityDetails !== nextProps.showActivityDetails) return false;
|
|
887
831
|
if (prevProps.compactMode !== nextProps.compactMode) return false;
|
|
888
832
|
if (prevProps.className !== nextProps.className) return false;
|
|
889
833
|
if (prevProps.labels !== nextProps.labels) return false;
|
|
@@ -912,7 +856,8 @@ var Message = memo2(({
|
|
|
912
856
|
enableCopy = true,
|
|
913
857
|
enableEdit = true,
|
|
914
858
|
enableRegenerate = true,
|
|
915
|
-
|
|
859
|
+
showActivity = true,
|
|
860
|
+
showActivityDetails = true,
|
|
916
861
|
compactMode = false,
|
|
917
862
|
onAction,
|
|
918
863
|
className = "",
|
|
@@ -926,8 +871,7 @@ var Message = memo2(({
|
|
|
926
871
|
renderUserMarkdown = true,
|
|
927
872
|
markdown,
|
|
928
873
|
isExpanded = false,
|
|
929
|
-
onToggleExpanded
|
|
930
|
-
agentOptions = []
|
|
874
|
+
onToggleExpanded
|
|
931
875
|
}) => {
|
|
932
876
|
const [isEditing, setIsEditing] = useState2(false);
|
|
933
877
|
const [editContent, setEditContent] = useState2(message.content);
|
|
@@ -937,12 +881,13 @@ var Message = memo2(({
|
|
|
937
881
|
if (!hasRenderableAssistantBody(message)) {
|
|
938
882
|
return null;
|
|
939
883
|
}
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
884
|
+
const senderDisplay = resolveMessageSenderDisplay({
|
|
885
|
+
sender: message.sender,
|
|
886
|
+
fallbackName: messageIsUser ? userName : assistantName,
|
|
887
|
+
fallbackAvatar: messageIsUser ? void 0 : assistantAvatar,
|
|
888
|
+
fallbackAvatarUrl: messageIsUser ? userAvatar : void 0,
|
|
889
|
+
compactMode
|
|
890
|
+
});
|
|
946
891
|
const canEdit = enableEdit && messageIsUser;
|
|
947
892
|
const canRegenerate = enableRegenerate && !messageIsUser;
|
|
948
893
|
const normalizedPreviewChars = Math.max(longMessagePreviewChars, 1);
|
|
@@ -990,43 +935,39 @@ var Message = memo2(({
|
|
|
990
935
|
minute: "2-digit"
|
|
991
936
|
});
|
|
992
937
|
};
|
|
993
|
-
return /* @__PURE__ */
|
|
938
|
+
return /* @__PURE__ */ jsxs4(
|
|
994
939
|
"div",
|
|
995
940
|
{
|
|
996
941
|
className: `flex w-full flex-col ${className} max-w-[800px] mx-auto`,
|
|
997
942
|
onMouseEnter: () => setShowActions(true),
|
|
998
943
|
onMouseLeave: () => setShowActions(false),
|
|
999
944
|
children: [
|
|
1000
|
-
/* @__PURE__ */
|
|
1001
|
-
showAvatar && /* @__PURE__ */ jsx8("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ jsx8(
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
}
|
|
1013
|
-
)
|
|
1014
|
-
] }) : /* @__PURE__ */ jsx8(Fragment, { children: assistantAvatar || /* @__PURE__ */ jsx8(AvatarFallback, { className: "bg-secondary text-secondary-foreground", children: "AI" }) }) }) }),
|
|
1015
|
-
/* @__PURE__ */ jsxs3("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
945
|
+
/* @__PURE__ */ jsxs4("div", { className: `flex gap-3 ${messageIsUser ? "flex-row-reverse" : "flex-row"} w-full mb-1`, children: [
|
|
946
|
+
showAvatar && /* @__PURE__ */ jsx8("div", { className: `flex-shrink-0 ${compactMode ? "mt-1" : "mt-0"}`, children: /* @__PURE__ */ jsx8(
|
|
947
|
+
MessageSenderAvatar,
|
|
948
|
+
{
|
|
949
|
+
sender: message.sender,
|
|
950
|
+
fallbackName: messageIsUser ? userName : assistantName,
|
|
951
|
+
fallbackAvatar: messageIsUser ? void 0 : assistantAvatar,
|
|
952
|
+
fallbackAvatarUrl: messageIsUser ? userAvatar : void 0,
|
|
953
|
+
compactMode
|
|
954
|
+
}
|
|
955
|
+
) }),
|
|
956
|
+
/* @__PURE__ */ jsxs4("div", { className: `flex items-center gap-2 mb-1 ${messageIsUser ? "flex-row-reverse" : "flex-row"}`, children: [
|
|
1016
957
|
/* @__PURE__ */ jsx8(
|
|
1017
958
|
"span",
|
|
1018
959
|
{
|
|
1019
960
|
className: `font-medium ${compactMode ? "text-sm" : "text-base"}`,
|
|
1020
|
-
style: !messageIsUser &&
|
|
1021
|
-
children:
|
|
961
|
+
style: !messageIsUser && senderDisplay.color ? { color: senderDisplay.color } : void 0,
|
|
962
|
+
children: senderDisplay.name
|
|
1022
963
|
}
|
|
1023
964
|
),
|
|
1024
965
|
showTimestamp && /* @__PURE__ */ jsx8("span", { className: "text-xs text-muted-foreground", children: formatTime(message.timestamp) }),
|
|
1025
966
|
message.isEdited && /* @__PURE__ */ jsx8(Badge, { variant: "outline", className: "text-xs", children: "editado" })
|
|
1026
967
|
] })
|
|
1027
968
|
] }),
|
|
1028
|
-
/* @__PURE__ */ jsx8("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */
|
|
1029
|
-
isEditing ? /* @__PURE__ */
|
|
969
|
+
/* @__PURE__ */ jsx8("div", { className: `flex-1 min-w-0 ${messageIsUser ? "text-right" : "text-left"} ${horizontalOffsetClass}`, children: /* @__PURE__ */ jsxs4("div", { className: `relative overflow-hidden text-left ${messageIsUser ? "ml-auto inline-flex max-w-[85%] flex-col rounded-lg bg-primary p-3 text-primary-foreground" : "flex w-full max-w-full flex-col"}`, children: [
|
|
970
|
+
isEditing ? /* @__PURE__ */ jsxs4("div", { className: "space-y-2", children: [
|
|
1030
971
|
/* @__PURE__ */ jsx8(
|
|
1031
972
|
Textarea,
|
|
1032
973
|
{
|
|
@@ -1036,22 +977,23 @@ var Message = memo2(({
|
|
|
1036
977
|
autoFocus: true
|
|
1037
978
|
}
|
|
1038
979
|
),
|
|
1039
|
-
/* @__PURE__ */
|
|
1040
|
-
/* @__PURE__ */
|
|
980
|
+
/* @__PURE__ */ jsxs4("div", { className: "flex gap-2 justify-end", children: [
|
|
981
|
+
/* @__PURE__ */ jsxs4(Button, { variant: "outline", size: "sm", onClick: handleCancelEdit, children: [
|
|
1041
982
|
/* @__PURE__ */ jsx8(X, { className: "h-4 w-4 mr-1" }),
|
|
1042
983
|
"Cancelar"
|
|
1043
984
|
] }),
|
|
1044
|
-
/* @__PURE__ */
|
|
985
|
+
/* @__PURE__ */ jsxs4(Button, { size: "sm", onClick: handleEdit, children: [
|
|
1045
986
|
/* @__PURE__ */ jsx8(Check, { className: "h-4 w-4 mr-1" }),
|
|
1046
987
|
"Salvar"
|
|
1047
988
|
] })
|
|
1048
989
|
] })
|
|
1049
|
-
] }) : /* @__PURE__ */
|
|
990
|
+
] }) : /* @__PURE__ */ jsxs4(Fragment2, { children: [
|
|
1050
991
|
!messageIsUser && /* @__PURE__ */ jsx8(
|
|
1051
992
|
AssistantActivity,
|
|
1052
993
|
{
|
|
1053
994
|
activity: message.activity,
|
|
1054
|
-
|
|
995
|
+
showActivity,
|
|
996
|
+
showActivityDetails,
|
|
1055
997
|
labels
|
|
1056
998
|
}
|
|
1057
999
|
),
|
|
@@ -1079,8 +1021,8 @@ var Message = memo2(({
|
|
|
1079
1021
|
) }),
|
|
1080
1022
|
message.attachments && message.attachments.length > 0 && /* @__PURE__ */ jsx8("div", { className: "mt-3 space-y-2", children: message.attachments.map((attachment, index) => /* @__PURE__ */ jsx8(MediaRenderer, { attachment }, index)) })
|
|
1081
1023
|
] }),
|
|
1082
|
-
!isEditing && (showActions || copied) && /* @__PURE__ */
|
|
1083
|
-
enableCopy && /* @__PURE__ */
|
|
1024
|
+
!isEditing && (showActions || copied) && /* @__PURE__ */ jsxs4("div", { className: `absolute -top-2 flex gap-1 ${messageIsUser ? "-left-2" : "-right-2"}`, children: [
|
|
1025
|
+
enableCopy && /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
1084
1026
|
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1085
1027
|
Button,
|
|
1086
1028
|
{
|
|
@@ -1093,7 +1035,7 @@ var Message = memo2(({
|
|
|
1093
1035
|
) }),
|
|
1094
1036
|
/* @__PURE__ */ jsx8(TooltipContent, { children: copied ? "Copiado!" : "Copiar" })
|
|
1095
1037
|
] }),
|
|
1096
|
-
canEdit && /* @__PURE__ */
|
|
1038
|
+
canEdit && /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
1097
1039
|
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1098
1040
|
Button,
|
|
1099
1041
|
{
|
|
@@ -1106,7 +1048,7 @@ var Message = memo2(({
|
|
|
1106
1048
|
) }),
|
|
1107
1049
|
/* @__PURE__ */ jsx8(TooltipContent, { children: "Editar" })
|
|
1108
1050
|
] }),
|
|
1109
|
-
canRegenerate && /* @__PURE__ */
|
|
1051
|
+
canRegenerate && /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
1110
1052
|
/* @__PURE__ */ jsx8(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx8(
|
|
1111
1053
|
Button,
|
|
1112
1054
|
{
|
|
@@ -1127,7 +1069,7 @@ var Message = memo2(({
|
|
|
1127
1069
|
}, arePropsEqual);
|
|
1128
1070
|
|
|
1129
1071
|
// src/components/chat/Sidebar.tsx
|
|
1130
|
-
import { useEffect as
|
|
1072
|
+
import { useEffect as useEffect7, useRef as useRef4, useState as useState5 } from "react";
|
|
1131
1073
|
|
|
1132
1074
|
// src/components/ui/input.tsx
|
|
1133
1075
|
import { jsx as jsx9 } from "react/jsx-runtime";
|
|
@@ -1199,7 +1141,7 @@ function Separator({
|
|
|
1199
1141
|
import * as React4 from "react";
|
|
1200
1142
|
import * as SheetPrimitive from "@radix-ui/react-dialog";
|
|
1201
1143
|
import { XIcon } from "lucide-react";
|
|
1202
|
-
import { jsx as jsx11, jsxs as
|
|
1144
|
+
import { jsx as jsx11, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1203
1145
|
function cleanupBodyStyles() {
|
|
1204
1146
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1205
1147
|
document.body.style.pointerEvents = "";
|
|
@@ -1251,9 +1193,9 @@ function SheetContent({
|
|
|
1251
1193
|
side = "right",
|
|
1252
1194
|
...props
|
|
1253
1195
|
}) {
|
|
1254
|
-
return /* @__PURE__ */
|
|
1196
|
+
return /* @__PURE__ */ jsxs5(SheetPortal, { children: [
|
|
1255
1197
|
/* @__PURE__ */ jsx11(SheetOverlay, {}),
|
|
1256
|
-
/* @__PURE__ */
|
|
1198
|
+
/* @__PURE__ */ jsxs5(
|
|
1257
1199
|
SheetPrimitive.Content,
|
|
1258
1200
|
{
|
|
1259
1201
|
"data-slot": "sheet-content",
|
|
@@ -1269,7 +1211,7 @@ function SheetContent({
|
|
|
1269
1211
|
...props,
|
|
1270
1212
|
children: [
|
|
1271
1213
|
children,
|
|
1272
|
-
/* @__PURE__ */
|
|
1214
|
+
/* @__PURE__ */ jsxs5(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: [
|
|
1273
1215
|
/* @__PURE__ */ jsx11(XIcon, { className: "size-4" }),
|
|
1274
1216
|
/* @__PURE__ */ jsx11("span", { className: "sr-only", children: "Close" })
|
|
1275
1217
|
] })
|
|
@@ -1329,7 +1271,7 @@ function Skeleton({ className, ...props }) {
|
|
|
1329
1271
|
}
|
|
1330
1272
|
|
|
1331
1273
|
// src/components/ui/sidebar.tsx
|
|
1332
|
-
import { jsx as jsx13, jsxs as
|
|
1274
|
+
import { jsx as jsx13, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1333
1275
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1334
1276
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1335
1277
|
var SIDEBAR_WIDTH = "16rem";
|
|
@@ -1437,7 +1379,7 @@ function Sidebar({
|
|
|
1437
1379
|
);
|
|
1438
1380
|
}
|
|
1439
1381
|
if (isMobile) {
|
|
1440
|
-
return /* @__PURE__ */ jsx13(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */
|
|
1382
|
+
return /* @__PURE__ */ jsx13(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs6(
|
|
1441
1383
|
SheetContent,
|
|
1442
1384
|
{
|
|
1443
1385
|
"data-sidebar": "sidebar",
|
|
@@ -1449,7 +1391,7 @@ function Sidebar({
|
|
|
1449
1391
|
},
|
|
1450
1392
|
side,
|
|
1451
1393
|
children: [
|
|
1452
|
-
/* @__PURE__ */
|
|
1394
|
+
/* @__PURE__ */ jsxs6(SheetHeader, { className: "sr-only", children: [
|
|
1453
1395
|
/* @__PURE__ */ jsx13(SheetTitle, { children: "Sidebar" }),
|
|
1454
1396
|
/* @__PURE__ */ jsx13(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1455
1397
|
] }),
|
|
@@ -1458,7 +1400,7 @@ function Sidebar({
|
|
|
1458
1400
|
}
|
|
1459
1401
|
) });
|
|
1460
1402
|
}
|
|
1461
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ jsxs6(
|
|
1462
1404
|
"div",
|
|
1463
1405
|
{
|
|
1464
1406
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
@@ -1513,7 +1455,7 @@ function SidebarTrigger({
|
|
|
1513
1455
|
...props
|
|
1514
1456
|
}) {
|
|
1515
1457
|
const { toggleSidebar } = useSidebar();
|
|
1516
|
-
return /* @__PURE__ */
|
|
1458
|
+
return /* @__PURE__ */ jsxs6(
|
|
1517
1459
|
Button,
|
|
1518
1460
|
{
|
|
1519
1461
|
"data-sidebar": "trigger",
|
|
@@ -1724,7 +1666,7 @@ function SidebarMenuButton({
|
|
|
1724
1666
|
children: tooltip
|
|
1725
1667
|
};
|
|
1726
1668
|
}
|
|
1727
|
-
return /* @__PURE__ */
|
|
1669
|
+
return /* @__PURE__ */ jsxs6(Tooltip, { children: [
|
|
1728
1670
|
/* @__PURE__ */ jsx13(TooltipTrigger, { asChild: true, children: button }),
|
|
1729
1671
|
/* @__PURE__ */ jsx13(
|
|
1730
1672
|
TooltipContent,
|
|
@@ -1769,7 +1711,7 @@ function SidebarMenuAction({
|
|
|
1769
1711
|
import * as React6 from "react";
|
|
1770
1712
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1771
1713
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
1772
|
-
import { jsx as jsx14, jsxs as
|
|
1714
|
+
import { jsx as jsx14, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1773
1715
|
function cleanupBodyStyles2() {
|
|
1774
1716
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1775
1717
|
document.body.style.pointerEvents = "";
|
|
@@ -1830,9 +1772,9 @@ function DialogContent({
|
|
|
1830
1772
|
showCloseButton = true,
|
|
1831
1773
|
...props
|
|
1832
1774
|
}) {
|
|
1833
|
-
return /* @__PURE__ */
|
|
1775
|
+
return /* @__PURE__ */ jsxs7(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1834
1776
|
/* @__PURE__ */ jsx14(DialogOverlay, {}),
|
|
1835
|
-
/* @__PURE__ */
|
|
1777
|
+
/* @__PURE__ */ jsxs7(
|
|
1836
1778
|
DialogPrimitive.Content,
|
|
1837
1779
|
{
|
|
1838
1780
|
"data-slot": "dialog-content",
|
|
@@ -1844,7 +1786,7 @@ function DialogContent({
|
|
|
1844
1786
|
...props,
|
|
1845
1787
|
children: [
|
|
1846
1788
|
children,
|
|
1847
|
-
showCloseButton && /* @__PURE__ */
|
|
1789
|
+
showCloseButton && /* @__PURE__ */ jsxs7(
|
|
1848
1790
|
DialogPrimitive.Close,
|
|
1849
1791
|
{
|
|
1850
1792
|
"data-slot": "dialog-close",
|
|
@@ -1913,7 +1855,7 @@ function DialogDescription({
|
|
|
1913
1855
|
// src/components/ui/alert-dialog.tsx
|
|
1914
1856
|
import * as React7 from "react";
|
|
1915
1857
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1916
|
-
import { jsx as jsx15, jsxs as
|
|
1858
|
+
import { jsx as jsx15, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1917
1859
|
function cleanupBodyStyles3() {
|
|
1918
1860
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1919
1861
|
document.body.style.pointerEvents = "";
|
|
@@ -1967,7 +1909,7 @@ function AlertDialogContent({
|
|
|
1967
1909
|
className,
|
|
1968
1910
|
...props
|
|
1969
1911
|
}) {
|
|
1970
|
-
return /* @__PURE__ */
|
|
1912
|
+
return /* @__PURE__ */ jsxs8(AlertDialogPortal, { children: [
|
|
1971
1913
|
/* @__PURE__ */ jsx15(AlertDialogOverlay, {}),
|
|
1972
1914
|
/* @__PURE__ */ jsx15(
|
|
1973
1915
|
AlertDialogPrimitive.Content,
|
|
@@ -2065,7 +2007,7 @@ function AlertDialogCancel({
|
|
|
2065
2007
|
// src/components/ui/dropdown-menu.tsx
|
|
2066
2008
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
2067
2009
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
2068
|
-
import { jsx as jsx16, jsxs as
|
|
2010
|
+
import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2069
2011
|
function DropdownMenu({
|
|
2070
2012
|
...props
|
|
2071
2013
|
}) {
|
|
@@ -2176,7 +2118,7 @@ import {
|
|
|
2176
2118
|
Sun,
|
|
2177
2119
|
User
|
|
2178
2120
|
} from "lucide-react";
|
|
2179
|
-
import { Fragment as
|
|
2121
|
+
import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2180
2122
|
var getInitials = (name, email) => {
|
|
2181
2123
|
if (name) {
|
|
2182
2124
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -2212,19 +2154,19 @@ var UserMenu = ({
|
|
|
2212
2154
|
};
|
|
2213
2155
|
const displayName = getDisplayName(user, labels.guest);
|
|
2214
2156
|
const initials = getInitials(user?.name, user?.email);
|
|
2215
|
-
return /* @__PURE__ */ jsx17(SidebarMenu, { children: /* @__PURE__ */ jsx17(SidebarMenuItem, { children: /* @__PURE__ */
|
|
2216
|
-
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */
|
|
2157
|
+
return /* @__PURE__ */ jsx17(SidebarMenu, { children: /* @__PURE__ */ jsx17(SidebarMenuItem, { children: /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2158
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
2217
2159
|
SidebarMenuButton,
|
|
2218
2160
|
{
|
|
2219
2161
|
size: "lg",
|
|
2220
2162
|
className: "data-[state=open]:bg-sidebar-accent data-[state=open]:text-sidebar-accent-foreground",
|
|
2221
2163
|
tooltip: displayName,
|
|
2222
2164
|
children: [
|
|
2223
|
-
/* @__PURE__ */
|
|
2165
|
+
/* @__PURE__ */ jsxs10(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2224
2166
|
user?.avatar && /* @__PURE__ */ jsx17(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2225
2167
|
/* @__PURE__ */ jsx17(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2226
2168
|
] }),
|
|
2227
|
-
/* @__PURE__ */
|
|
2169
|
+
/* @__PURE__ */ jsxs10("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
2228
2170
|
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", children: displayName }),
|
|
2229
2171
|
user?.email && /* @__PURE__ */ jsx17("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2230
2172
|
] }),
|
|
@@ -2232,7 +2174,7 @@ var UserMenu = ({
|
|
|
2232
2174
|
]
|
|
2233
2175
|
}
|
|
2234
2176
|
) }),
|
|
2235
|
-
/* @__PURE__ */
|
|
2177
|
+
/* @__PURE__ */ jsxs10(
|
|
2236
2178
|
DropdownMenuContent,
|
|
2237
2179
|
{
|
|
2238
2180
|
className: "w-[--radix-dropdown-menu-trigger-width] min-w-56 rounded-lg",
|
|
@@ -2240,30 +2182,30 @@ var UserMenu = ({
|
|
|
2240
2182
|
align: "end",
|
|
2241
2183
|
sideOffset: 4,
|
|
2242
2184
|
children: [
|
|
2243
|
-
/* @__PURE__ */ jsx17(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */
|
|
2244
|
-
/* @__PURE__ */
|
|
2185
|
+
/* @__PURE__ */ jsx17(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
2186
|
+
/* @__PURE__ */ jsxs10(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2245
2187
|
user?.avatar && /* @__PURE__ */ jsx17(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2246
2188
|
/* @__PURE__ */ jsx17(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2247
2189
|
] }),
|
|
2248
|
-
/* @__PURE__ */
|
|
2190
|
+
/* @__PURE__ */ jsxs10("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
2249
2191
|
/* @__PURE__ */ jsx17("span", { className: "truncate font-medium", children: displayName }),
|
|
2250
2192
|
user?.email && /* @__PURE__ */ jsx17("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2251
2193
|
] })
|
|
2252
2194
|
] }) }),
|
|
2253
2195
|
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2254
|
-
callbacks?.onViewProfile && /* @__PURE__ */
|
|
2196
|
+
callbacks?.onViewProfile && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
|
|
2255
2197
|
/* @__PURE__ */ jsx17(User, { className: "mr-2 h-4 w-4" }),
|
|
2256
2198
|
/* @__PURE__ */ jsx17("span", { children: labels.profile })
|
|
2257
2199
|
] }),
|
|
2258
|
-
callbacks?.onOpenSettings && /* @__PURE__ */
|
|
2200
|
+
callbacks?.onOpenSettings && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
|
|
2259
2201
|
/* @__PURE__ */ jsx17(Settings, { className: "mr-2 h-4 w-4" }),
|
|
2260
2202
|
/* @__PURE__ */ jsx17("span", { children: labels.settings })
|
|
2261
2203
|
] }),
|
|
2262
2204
|
additionalItems,
|
|
2263
|
-
sections.map((section) => /* @__PURE__ */
|
|
2205
|
+
sections.map((section) => /* @__PURE__ */ jsxs10(React8.Fragment, { children: [
|
|
2264
2206
|
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2265
2207
|
section.label && /* @__PURE__ */ jsx17(DropdownMenuLabel, { className: "px-2 py-2", children: section.label }),
|
|
2266
|
-
section.items.map((item) => /* @__PURE__ */
|
|
2208
|
+
section.items.map((item) => /* @__PURE__ */ jsxs10(
|
|
2267
2209
|
DropdownMenuItem,
|
|
2268
2210
|
{
|
|
2269
2211
|
onClick: item.onSelect,
|
|
@@ -2281,9 +2223,9 @@ var UserMenu = ({
|
|
|
2281
2223
|
item.id
|
|
2282
2224
|
))
|
|
2283
2225
|
] }, section.id)),
|
|
2284
|
-
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */
|
|
2226
|
+
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2285
2227
|
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2286
|
-
/* @__PURE__ */
|
|
2228
|
+
/* @__PURE__ */ jsxs10(
|
|
2287
2229
|
DropdownMenuItem,
|
|
2288
2230
|
{
|
|
2289
2231
|
onClick: () => callbacks.onThemeChange?.("light"),
|
|
@@ -2294,7 +2236,7 @@ var UserMenu = ({
|
|
|
2294
2236
|
]
|
|
2295
2237
|
}
|
|
2296
2238
|
),
|
|
2297
|
-
/* @__PURE__ */
|
|
2239
|
+
/* @__PURE__ */ jsxs10(
|
|
2298
2240
|
DropdownMenuItem,
|
|
2299
2241
|
{
|
|
2300
2242
|
onClick: () => callbacks.onThemeChange?.("dark"),
|
|
@@ -2305,7 +2247,7 @@ var UserMenu = ({
|
|
|
2305
2247
|
]
|
|
2306
2248
|
}
|
|
2307
2249
|
),
|
|
2308
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsxs10(
|
|
2309
2251
|
DropdownMenuItem,
|
|
2310
2252
|
{
|
|
2311
2253
|
onClick: () => callbacks.onThemeChange?.("system"),
|
|
@@ -2317,9 +2259,9 @@ var UserMenu = ({
|
|
|
2317
2259
|
}
|
|
2318
2260
|
)
|
|
2319
2261
|
] }),
|
|
2320
|
-
callbacks?.onLogout && /* @__PURE__ */
|
|
2262
|
+
callbacks?.onLogout && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2321
2263
|
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2322
|
-
/* @__PURE__ */
|
|
2264
|
+
/* @__PURE__ */ jsxs10(
|
|
2323
2265
|
DropdownMenuItem,
|
|
2324
2266
|
{
|
|
2325
2267
|
onClick: callbacks.onLogout,
|
|
@@ -2338,7 +2280,7 @@ var UserMenu = ({
|
|
|
2338
2280
|
};
|
|
2339
2281
|
|
|
2340
2282
|
// src/components/chat/Sidebar.tsx
|
|
2341
|
-
import { jsx as jsx18, jsxs as
|
|
2283
|
+
import { jsx as jsx18, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2342
2284
|
var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
2343
2285
|
const [title, setTitle] = useState5("");
|
|
2344
2286
|
const [isOpen, setIsOpen] = useState5(false);
|
|
@@ -2347,13 +2289,13 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2347
2289
|
setTitle("");
|
|
2348
2290
|
setIsOpen(false);
|
|
2349
2291
|
};
|
|
2350
|
-
return /* @__PURE__ */
|
|
2351
|
-
/* @__PURE__ */ jsx18(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */
|
|
2292
|
+
return /* @__PURE__ */ jsxs11(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2293
|
+
/* @__PURE__ */ jsx18(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxs11(Button, { className: "w-full justify-start", variant: "outline", children: [
|
|
2352
2294
|
/* @__PURE__ */ jsx18(Plus, { className: "mr-2 h-4 w-4" }),
|
|
2353
2295
|
config.labels?.newChat || "New Chat"
|
|
2354
2296
|
] }) }),
|
|
2355
|
-
/* @__PURE__ */
|
|
2356
|
-
/* @__PURE__ */
|
|
2297
|
+
/* @__PURE__ */ jsxs11(DialogContent, { children: [
|
|
2298
|
+
/* @__PURE__ */ jsxs11(DialogHeader, { children: [
|
|
2357
2299
|
/* @__PURE__ */ jsx18(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
|
|
2358
2300
|
/* @__PURE__ */ jsx18(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
2359
2301
|
] }),
|
|
@@ -2367,7 +2309,7 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2367
2309
|
autoFocus: true
|
|
2368
2310
|
}
|
|
2369
2311
|
),
|
|
2370
|
-
/* @__PURE__ */
|
|
2312
|
+
/* @__PURE__ */ jsxs11(DialogFooter, { children: [
|
|
2371
2313
|
/* @__PURE__ */ jsx18(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
|
|
2372
2314
|
/* @__PURE__ */ jsx18(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
|
|
2373
2315
|
] })
|
|
@@ -2403,7 +2345,7 @@ var Sidebar2 = ({
|
|
|
2403
2345
|
const [editTitle, setEditTitle] = useState5("");
|
|
2404
2346
|
const inputRef = useRef4(null);
|
|
2405
2347
|
const { setOpen } = useSidebar();
|
|
2406
|
-
|
|
2348
|
+
useEffect7(() => {
|
|
2407
2349
|
if (editingThreadId && inputRef.current) {
|
|
2408
2350
|
inputRef.current.focus();
|
|
2409
2351
|
inputRef.current.select();
|
|
@@ -2456,11 +2398,11 @@ var Sidebar2 = ({
|
|
|
2456
2398
|
const cancelEdit = () => {
|
|
2457
2399
|
setEditingThreadId(null);
|
|
2458
2400
|
};
|
|
2459
|
-
return /* @__PURE__ */
|
|
2460
|
-
/* @__PURE__ */
|
|
2461
|
-
/* @__PURE__ */
|
|
2401
|
+
return /* @__PURE__ */ jsxs11(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2402
|
+
/* @__PURE__ */ jsxs11(SidebarHeader, { children: [
|
|
2403
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2462
2404
|
/* @__PURE__ */ jsx18("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ jsx18(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsx18(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx18(Bot, { className: "h-4 w-4" }) }) }) }),
|
|
2463
|
-
/* @__PURE__ */
|
|
2405
|
+
/* @__PURE__ */ jsxs11("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
2464
2406
|
/* @__PURE__ */ jsx18("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
|
|
2465
2407
|
config.branding?.subtitle && /* @__PURE__ */ jsx18("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2466
2408
|
] })
|
|
@@ -2470,7 +2412,7 @@ var Sidebar2 = ({
|
|
|
2470
2412
|
{
|
|
2471
2413
|
config,
|
|
2472
2414
|
onCreateThread,
|
|
2473
|
-
trigger: /* @__PURE__ */ jsx18(SidebarMenu, { children: /* @__PURE__ */ jsx18(SidebarMenuItem, { children: /* @__PURE__ */
|
|
2415
|
+
trigger: /* @__PURE__ */ jsx18(SidebarMenu, { children: /* @__PURE__ */ jsx18(SidebarMenuItem, { children: /* @__PURE__ */ jsxs11(
|
|
2474
2416
|
SidebarMenuButton,
|
|
2475
2417
|
{
|
|
2476
2418
|
size: "lg",
|
|
@@ -2484,8 +2426,8 @@ var Sidebar2 = ({
|
|
|
2484
2426
|
) }) })
|
|
2485
2427
|
}
|
|
2486
2428
|
),
|
|
2487
|
-
/* @__PURE__ */
|
|
2488
|
-
/* @__PURE__ */
|
|
2429
|
+
/* @__PURE__ */ jsxs11("div", { className: "px-2 py-1 mt-4", children: [
|
|
2430
|
+
/* @__PURE__ */ jsxs11("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
|
|
2489
2431
|
/* @__PURE__ */ jsx18(Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
|
|
2490
2432
|
/* @__PURE__ */ jsx18(
|
|
2491
2433
|
Input,
|
|
@@ -2510,8 +2452,8 @@ var Sidebar2 = ({
|
|
|
2510
2452
|
) })
|
|
2511
2453
|
] })
|
|
2512
2454
|
] }),
|
|
2513
|
-
/* @__PURE__ */
|
|
2514
|
-
threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx18("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */
|
|
2455
|
+
/* @__PURE__ */ jsxs11(SidebarContent, { children: [
|
|
2456
|
+
threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx18("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs11(
|
|
2515
2457
|
Button,
|
|
2516
2458
|
{
|
|
2517
2459
|
variant: "ghost",
|
|
@@ -2524,12 +2466,12 @@ var Sidebar2 = ({
|
|
|
2524
2466
|
]
|
|
2525
2467
|
}
|
|
2526
2468
|
) }),
|
|
2527
|
-
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */
|
|
2469
|
+
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs11("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2528
2470
|
/* @__PURE__ */ jsx18("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ jsx18(Plus, { className: "h-4 w-4 opacity-50" }) }),
|
|
2529
2471
|
/* @__PURE__ */ jsx18("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|
|
2530
|
-
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */
|
|
2472
|
+
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs11(SidebarGroup, { className: "mt-2", children: [
|
|
2531
2473
|
/* @__PURE__ */ jsx18(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
|
|
2532
|
-
/* @__PURE__ */ jsx18(SidebarGroupContent, { children: /* @__PURE__ */ jsx18(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */
|
|
2474
|
+
/* @__PURE__ */ jsx18(SidebarGroupContent, { children: /* @__PURE__ */ jsx18(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ jsxs11(SidebarMenuItem, { children: [
|
|
2533
2475
|
editingThreadId === thread.id ? /* @__PURE__ */ jsx18("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ jsx18(
|
|
2534
2476
|
Input,
|
|
2535
2477
|
{
|
|
@@ -2547,7 +2489,7 @@ var Sidebar2 = ({
|
|
|
2547
2489
|
onBlur: saveEdit,
|
|
2548
2490
|
className: "h-7 text-sm"
|
|
2549
2491
|
}
|
|
2550
|
-
) }) : /* @__PURE__ */
|
|
2492
|
+
) }) : /* @__PURE__ */ jsxs11(
|
|
2551
2493
|
SidebarMenuButton,
|
|
2552
2494
|
{
|
|
2553
2495
|
isActive: currentThreadId === thread.id,
|
|
@@ -2560,19 +2502,19 @@ var Sidebar2 = ({
|
|
|
2560
2502
|
]
|
|
2561
2503
|
}
|
|
2562
2504
|
),
|
|
2563
|
-
!editingThreadId && /* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */
|
|
2505
|
+
!editingThreadId && /* @__PURE__ */ jsxs11(DropdownMenu, { children: [
|
|
2506
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs11(SidebarMenuAction, { showOnHover: true, children: [
|
|
2565
2507
|
/* @__PURE__ */ jsx18(MoreHorizontal, {}),
|
|
2566
2508
|
/* @__PURE__ */ jsx18("span", { className: "sr-only", children: "More" })
|
|
2567
2509
|
] }) }),
|
|
2568
|
-
/* @__PURE__ */
|
|
2510
|
+
/* @__PURE__ */ jsxs11(
|
|
2569
2511
|
DropdownMenuContent,
|
|
2570
2512
|
{
|
|
2571
2513
|
className: "w-48",
|
|
2572
2514
|
side: "right",
|
|
2573
2515
|
align: "start",
|
|
2574
2516
|
children: [
|
|
2575
|
-
/* @__PURE__ */
|
|
2517
|
+
/* @__PURE__ */ jsxs11(
|
|
2576
2518
|
DropdownMenuItem,
|
|
2577
2519
|
{
|
|
2578
2520
|
onClick: () => startEditing(thread),
|
|
@@ -2582,7 +2524,7 @@ var Sidebar2 = ({
|
|
|
2582
2524
|
]
|
|
2583
2525
|
}
|
|
2584
2526
|
),
|
|
2585
|
-
/* @__PURE__ */
|
|
2527
|
+
/* @__PURE__ */ jsxs11(
|
|
2586
2528
|
DropdownMenuItem,
|
|
2587
2529
|
{
|
|
2588
2530
|
onClick: () => onArchiveThread?.(thread.id),
|
|
@@ -2593,7 +2535,7 @@ var Sidebar2 = ({
|
|
|
2593
2535
|
}
|
|
2594
2536
|
),
|
|
2595
2537
|
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2596
|
-
/* @__PURE__ */
|
|
2538
|
+
/* @__PURE__ */ jsxs11(
|
|
2597
2539
|
DropdownMenuItem,
|
|
2598
2540
|
{
|
|
2599
2541
|
onClick: () => setDeleteThreadId(thread.id),
|
|
@@ -2629,12 +2571,12 @@ var Sidebar2 = ({
|
|
|
2629
2571
|
{
|
|
2630
2572
|
open: !!deleteThreadId,
|
|
2631
2573
|
onOpenChange: () => setDeleteThreadId(null),
|
|
2632
|
-
children: /* @__PURE__ */
|
|
2633
|
-
/* @__PURE__ */
|
|
2574
|
+
children: /* @__PURE__ */ jsxs11(AlertDialogContent, { children: [
|
|
2575
|
+
/* @__PURE__ */ jsxs11(AlertDialogHeader, { children: [
|
|
2634
2576
|
/* @__PURE__ */ jsx18(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2635
2577
|
/* @__PURE__ */ jsx18(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2636
2578
|
] }),
|
|
2637
|
-
/* @__PURE__ */
|
|
2579
|
+
/* @__PURE__ */ jsxs11(AlertDialogFooter, { children: [
|
|
2638
2580
|
/* @__PURE__ */ jsx18(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2639
2581
|
/* @__PURE__ */ jsx18(
|
|
2640
2582
|
AlertDialogAction,
|
|
@@ -2653,6 +2595,47 @@ var Sidebar2 = ({
|
|
|
2653
2595
|
|
|
2654
2596
|
// src/components/chat/ChatHeader.tsx
|
|
2655
2597
|
import React11 from "react";
|
|
2598
|
+
|
|
2599
|
+
// src/components/ui/card.tsx
|
|
2600
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2601
|
+
function Card({ className, ...props }) {
|
|
2602
|
+
return /* @__PURE__ */ jsx19(
|
|
2603
|
+
"div",
|
|
2604
|
+
{
|
|
2605
|
+
"data-slot": "card",
|
|
2606
|
+
className: cn(
|
|
2607
|
+
"bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",
|
|
2608
|
+
className
|
|
2609
|
+
),
|
|
2610
|
+
...props
|
|
2611
|
+
}
|
|
2612
|
+
);
|
|
2613
|
+
}
|
|
2614
|
+
function CardHeader({ className, ...props }) {
|
|
2615
|
+
return /* @__PURE__ */ jsx19(
|
|
2616
|
+
"div",
|
|
2617
|
+
{
|
|
2618
|
+
"data-slot": "card-header",
|
|
2619
|
+
className: cn(
|
|
2620
|
+
"@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",
|
|
2621
|
+
className
|
|
2622
|
+
),
|
|
2623
|
+
...props
|
|
2624
|
+
}
|
|
2625
|
+
);
|
|
2626
|
+
}
|
|
2627
|
+
function CardContent({ className, ...props }) {
|
|
2628
|
+
return /* @__PURE__ */ jsx19(
|
|
2629
|
+
"div",
|
|
2630
|
+
{
|
|
2631
|
+
"data-slot": "card-content",
|
|
2632
|
+
className: cn("px-6", className),
|
|
2633
|
+
...props
|
|
2634
|
+
}
|
|
2635
|
+
);
|
|
2636
|
+
}
|
|
2637
|
+
|
|
2638
|
+
// src/components/chat/ChatHeader.tsx
|
|
2656
2639
|
import {
|
|
2657
2640
|
Bot as Bot2,
|
|
2658
2641
|
MoreVertical,
|
|
@@ -2668,9 +2651,9 @@ import {
|
|
|
2668
2651
|
} from "lucide-react";
|
|
2669
2652
|
|
|
2670
2653
|
// src/components/chat/AgentSelectors.tsx
|
|
2671
|
-
import { memo as memo3, useMemo as
|
|
2654
|
+
import { memo as memo3, useMemo as useMemo3 } from "react";
|
|
2672
2655
|
import { Check as Check3, ChevronDown as ChevronDown2, Users, AtSign, X as X2 } from "lucide-react";
|
|
2673
|
-
import { Fragment as
|
|
2656
|
+
import { Fragment as Fragment4, jsx as jsx20, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
2674
2657
|
var ParticipantsSelector = memo3(({
|
|
2675
2658
|
agents,
|
|
2676
2659
|
participantIds,
|
|
@@ -2679,8 +2662,8 @@ var ParticipantsSelector = memo3(({
|
|
|
2679
2662
|
maxVisible = 3,
|
|
2680
2663
|
disabled = false
|
|
2681
2664
|
}) => {
|
|
2682
|
-
const agentsWithColors =
|
|
2683
|
-
const selectedAgents =
|
|
2665
|
+
const agentsWithColors = useMemo3(() => assignAgentColors(agents), [agents]);
|
|
2666
|
+
const selectedAgents = useMemo3(
|
|
2684
2667
|
() => agentsWithColors.filter((a) => participantIds.includes(a.id)),
|
|
2685
2668
|
[agentsWithColors, participantIds]
|
|
2686
2669
|
);
|
|
@@ -2698,19 +2681,19 @@ var ParticipantsSelector = memo3(({
|
|
|
2698
2681
|
};
|
|
2699
2682
|
const visibleAgents = selectedAgents.slice(0, maxVisible);
|
|
2700
2683
|
const hiddenCount = selectedAgents.length - maxVisible;
|
|
2701
|
-
return /* @__PURE__ */
|
|
2702
|
-
/* @__PURE__ */
|
|
2684
|
+
return /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2685
|
+
/* @__PURE__ */ jsx20(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
2703
2686
|
Button,
|
|
2704
2687
|
{
|
|
2705
2688
|
variant: "ghost",
|
|
2706
2689
|
className: "h-9 px-2 gap-1.5 text-sm hover:bg-accent/50",
|
|
2707
2690
|
disabled,
|
|
2708
2691
|
children: [
|
|
2709
|
-
/* @__PURE__ */
|
|
2710
|
-
/* @__PURE__ */
|
|
2711
|
-
/* @__PURE__ */
|
|
2712
|
-
/* @__PURE__ */
|
|
2713
|
-
/* @__PURE__ */
|
|
2692
|
+
/* @__PURE__ */ jsx20(Users, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2693
|
+
/* @__PURE__ */ jsx20("div", { className: "flex items-center gap-1", children: visibleAgents.length > 0 ? /* @__PURE__ */ jsxs12(Fragment4, { children: [
|
|
2694
|
+
/* @__PURE__ */ jsx20("div", { className: "flex -space-x-1.5", children: visibleAgents.map((agent) => /* @__PURE__ */ jsxs12(Avatar, { className: "h-5 w-5 border-2 border-background", children: [
|
|
2695
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2696
|
+
/* @__PURE__ */ jsx20(
|
|
2714
2697
|
AvatarFallback,
|
|
2715
2698
|
{
|
|
2716
2699
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2719,34 +2702,34 @@ var ParticipantsSelector = memo3(({
|
|
|
2719
2702
|
}
|
|
2720
2703
|
)
|
|
2721
2704
|
] }, agent.id)) }),
|
|
2722
|
-
hiddenCount > 0 && /* @__PURE__ */
|
|
2705
|
+
hiddenCount > 0 && /* @__PURE__ */ jsxs12("span", { className: "text-xs text-muted-foreground", children: [
|
|
2723
2706
|
"+",
|
|
2724
2707
|
hiddenCount
|
|
2725
2708
|
] })
|
|
2726
|
-
] }) : /* @__PURE__ */
|
|
2727
|
-
/* @__PURE__ */
|
|
2709
|
+
] }) : /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: label }) }),
|
|
2710
|
+
/* @__PURE__ */ jsx20(ChevronDown2, { className: "h-3 w-3 opacity-50" })
|
|
2728
2711
|
]
|
|
2729
2712
|
}
|
|
2730
2713
|
) }),
|
|
2731
|
-
/* @__PURE__ */
|
|
2732
|
-
/* @__PURE__ */
|
|
2733
|
-
/* @__PURE__ */
|
|
2734
|
-
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */
|
|
2714
|
+
/* @__PURE__ */ jsxs12(DropdownMenuContent, { align: "start", className: "w-[260px]", children: [
|
|
2715
|
+
/* @__PURE__ */ jsxs12(DropdownMenuLabel, { className: "flex items-center justify-between", children: [
|
|
2716
|
+
/* @__PURE__ */ jsx20("span", { children: "Participants" }),
|
|
2717
|
+
selectedAgents.length < agentsWithColors.length && /* @__PURE__ */ jsx20(Button, { variant: "ghost", size: "sm", className: "h-6 text-xs", onClick: selectAll, children: "Select All" })
|
|
2735
2718
|
] }),
|
|
2736
|
-
/* @__PURE__ */
|
|
2719
|
+
/* @__PURE__ */ jsx20(DropdownMenuSeparator, {}),
|
|
2737
2720
|
agentsWithColors.map((agent) => {
|
|
2738
2721
|
const isSelected = participantIds.includes(agent.id);
|
|
2739
2722
|
const isLastSelected = isSelected && participantIds.length === 1;
|
|
2740
|
-
return /* @__PURE__ */
|
|
2723
|
+
return /* @__PURE__ */ jsxs12(
|
|
2741
2724
|
DropdownMenuItem,
|
|
2742
2725
|
{
|
|
2743
2726
|
onClick: () => toggleParticipant(agent.id),
|
|
2744
2727
|
className: "flex items-center gap-3 p-2 cursor-pointer",
|
|
2745
2728
|
disabled: isLastSelected,
|
|
2746
2729
|
children: [
|
|
2747
|
-
/* @__PURE__ */
|
|
2748
|
-
/* @__PURE__ */
|
|
2749
|
-
/* @__PURE__ */
|
|
2730
|
+
/* @__PURE__ */ jsxs12(Avatar, { className: "h-6 w-6", children: [
|
|
2731
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2732
|
+
/* @__PURE__ */ jsx20(
|
|
2750
2733
|
AvatarFallback,
|
|
2751
2734
|
{
|
|
2752
2735
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2755,11 +2738,11 @@ var ParticipantsSelector = memo3(({
|
|
|
2755
2738
|
}
|
|
2756
2739
|
)
|
|
2757
2740
|
] }),
|
|
2758
|
-
/* @__PURE__ */
|
|
2759
|
-
/* @__PURE__ */
|
|
2760
|
-
agent.description && /* @__PURE__ */
|
|
2741
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2742
|
+
/* @__PURE__ */ jsx20("div", { className: "font-medium text-sm truncate", children: agent.name }),
|
|
2743
|
+
agent.description && /* @__PURE__ */ jsx20("div", { className: "text-xs text-muted-foreground truncate", children: agent.description })
|
|
2761
2744
|
] }),
|
|
2762
|
-
isSelected && /* @__PURE__ */
|
|
2745
|
+
isSelected && /* @__PURE__ */ jsx20(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2763
2746
|
]
|
|
2764
2747
|
},
|
|
2765
2748
|
agent.id
|
|
@@ -2777,24 +2760,24 @@ var TargetAgentSelector = memo3(({
|
|
|
2777
2760
|
placeholder = "Select agent",
|
|
2778
2761
|
disabled = false
|
|
2779
2762
|
}) => {
|
|
2780
|
-
const agentsWithColors =
|
|
2781
|
-
const selectedAgent =
|
|
2763
|
+
const agentsWithColors = useMemo3(() => assignAgentColors(agents), [agents]);
|
|
2764
|
+
const selectedAgent = useMemo3(
|
|
2782
2765
|
() => agentsWithColors.find((a) => a.id === targetAgentId),
|
|
2783
2766
|
[agentsWithColors, targetAgentId]
|
|
2784
2767
|
);
|
|
2785
|
-
return /* @__PURE__ */
|
|
2786
|
-
/* @__PURE__ */
|
|
2768
|
+
return /* @__PURE__ */ jsxs12(DropdownMenu, { children: [
|
|
2769
|
+
/* @__PURE__ */ jsx20(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs12(
|
|
2787
2770
|
Button,
|
|
2788
2771
|
{
|
|
2789
2772
|
variant: "ghost",
|
|
2790
2773
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2791
2774
|
disabled,
|
|
2792
2775
|
children: [
|
|
2793
|
-
/* @__PURE__ */
|
|
2794
|
-
selectedAgent ? /* @__PURE__ */
|
|
2795
|
-
/* @__PURE__ */
|
|
2796
|
-
/* @__PURE__ */
|
|
2797
|
-
/* @__PURE__ */
|
|
2776
|
+
/* @__PURE__ */ jsx20(AtSign, { className: "h-4 w-4 text-muted-foreground" }),
|
|
2777
|
+
selectedAgent ? /* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2778
|
+
/* @__PURE__ */ jsxs12(Avatar, { className: "h-5 w-5", children: [
|
|
2779
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2780
|
+
/* @__PURE__ */ jsx20(
|
|
2798
2781
|
AvatarFallback,
|
|
2799
2782
|
{
|
|
2800
2783
|
style: { backgroundColor: selectedAgent.color || getAgentColor(selectedAgent.id), color: "white" },
|
|
@@ -2803,26 +2786,26 @@ var TargetAgentSelector = memo3(({
|
|
|
2803
2786
|
}
|
|
2804
2787
|
)
|
|
2805
2788
|
] }),
|
|
2806
|
-
/* @__PURE__ */
|
|
2807
|
-
] }) : /* @__PURE__ */
|
|
2808
|
-
/* @__PURE__ */
|
|
2789
|
+
/* @__PURE__ */ jsx20("span", { className: "max-w-[150px] truncate", children: selectedAgent.name })
|
|
2790
|
+
] }) : /* @__PURE__ */ jsx20("span", { className: "text-muted-foreground", children: placeholder }),
|
|
2791
|
+
/* @__PURE__ */ jsx20(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
2809
2792
|
]
|
|
2810
2793
|
}
|
|
2811
2794
|
) }),
|
|
2812
|
-
/* @__PURE__ */
|
|
2813
|
-
/* @__PURE__ */
|
|
2814
|
-
/* @__PURE__ */
|
|
2795
|
+
/* @__PURE__ */ jsxs12(DropdownMenuContent, { align: "start", className: "w-[280px]", children: [
|
|
2796
|
+
/* @__PURE__ */ jsx20(DropdownMenuLabel, { children: label }),
|
|
2797
|
+
/* @__PURE__ */ jsx20(DropdownMenuSeparator, {}),
|
|
2815
2798
|
agentsWithColors.map((agent) => {
|
|
2816
2799
|
const isSelected = agent.id === targetAgentId;
|
|
2817
|
-
return /* @__PURE__ */
|
|
2800
|
+
return /* @__PURE__ */ jsxs12(
|
|
2818
2801
|
DropdownMenuItem,
|
|
2819
2802
|
{
|
|
2820
2803
|
onClick: () => onTargetChange(agent.id),
|
|
2821
2804
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2822
2805
|
children: [
|
|
2823
|
-
/* @__PURE__ */
|
|
2824
|
-
/* @__PURE__ */
|
|
2825
|
-
/* @__PURE__ */
|
|
2806
|
+
/* @__PURE__ */ jsxs12(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2807
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2808
|
+
/* @__PURE__ */ jsx20(
|
|
2826
2809
|
AvatarFallback,
|
|
2827
2810
|
{
|
|
2828
2811
|
style: { backgroundColor: agent.color || getAgentColor(agent.id), color: "white" },
|
|
@@ -2831,12 +2814,12 @@ var TargetAgentSelector = memo3(({
|
|
|
2831
2814
|
}
|
|
2832
2815
|
)
|
|
2833
2816
|
] }),
|
|
2834
|
-
/* @__PURE__ */
|
|
2835
|
-
/* @__PURE__ */
|
|
2836
|
-
/* @__PURE__ */
|
|
2837
|
-
isSelected && /* @__PURE__ */
|
|
2817
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex-1 min-w-0", children: [
|
|
2818
|
+
/* @__PURE__ */ jsxs12("div", { className: "flex items-center gap-2", children: [
|
|
2819
|
+
/* @__PURE__ */ jsx20("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2820
|
+
isSelected && /* @__PURE__ */ jsx20(Check3, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2838
2821
|
] }),
|
|
2839
|
-
agent.description && /* @__PURE__ */
|
|
2822
|
+
agent.description && /* @__PURE__ */ jsx20("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2840
2823
|
] })
|
|
2841
2824
|
]
|
|
2842
2825
|
},
|
|
@@ -2856,16 +2839,16 @@ var AgentBadge = memo3(({
|
|
|
2856
2839
|
const color = agent.color || getAgentColor(agent.id);
|
|
2857
2840
|
const avatarSize = size === "sm" ? "h-4 w-4" : "h-5 w-5";
|
|
2858
2841
|
const textSize = size === "sm" ? "text-xs" : "text-sm";
|
|
2859
|
-
return /* @__PURE__ */
|
|
2842
|
+
return /* @__PURE__ */ jsxs12(
|
|
2860
2843
|
Badge,
|
|
2861
2844
|
{
|
|
2862
2845
|
variant: "secondary",
|
|
2863
2846
|
className: "flex items-center gap-1.5 pr-1",
|
|
2864
2847
|
style: { borderColor: color, borderWidth: 1 },
|
|
2865
2848
|
children: [
|
|
2866
|
-
/* @__PURE__ */
|
|
2867
|
-
/* @__PURE__ */
|
|
2868
|
-
/* @__PURE__ */
|
|
2849
|
+
/* @__PURE__ */ jsxs12(Avatar, { className: avatarSize, children: [
|
|
2850
|
+
/* @__PURE__ */ jsx20(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2851
|
+
/* @__PURE__ */ jsx20(
|
|
2869
2852
|
AvatarFallback,
|
|
2870
2853
|
{
|
|
2871
2854
|
style: { backgroundColor: color, color: "white" },
|
|
@@ -2874,8 +2857,8 @@ var AgentBadge = memo3(({
|
|
|
2874
2857
|
}
|
|
2875
2858
|
)
|
|
2876
2859
|
] }),
|
|
2877
|
-
/* @__PURE__ */
|
|
2878
|
-
showRemove && onRemove && /* @__PURE__ */
|
|
2860
|
+
/* @__PURE__ */ jsx20("span", { className: textSize, children: agent.name }),
|
|
2861
|
+
showRemove && onRemove && /* @__PURE__ */ jsx20(
|
|
2879
2862
|
Button,
|
|
2880
2863
|
{
|
|
2881
2864
|
variant: "ghost",
|
|
@@ -2885,7 +2868,7 @@ var AgentBadge = memo3(({
|
|
|
2885
2868
|
e.stopPropagation();
|
|
2886
2869
|
onRemove();
|
|
2887
2870
|
},
|
|
2888
|
-
children: /* @__PURE__ */
|
|
2871
|
+
children: /* @__PURE__ */ jsx20(X2, { className: "h-3 w-3" })
|
|
2889
2872
|
}
|
|
2890
2873
|
)
|
|
2891
2874
|
]
|
|
@@ -2895,7 +2878,7 @@ var AgentBadge = memo3(({
|
|
|
2895
2878
|
AgentBadge.displayName = "AgentBadge";
|
|
2896
2879
|
|
|
2897
2880
|
// src/components/chat/ChatHeader.tsx
|
|
2898
|
-
import { Fragment as
|
|
2881
|
+
import { Fragment as Fragment5, jsx as jsx21, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
2899
2882
|
var ChatHeader = ({
|
|
2900
2883
|
config,
|
|
2901
2884
|
currentThreadTitle,
|
|
@@ -2966,19 +2949,19 @@ var ChatHeader = ({
|
|
|
2966
2949
|
};
|
|
2967
2950
|
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2968
2951
|
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2969
|
-
return /* @__PURE__ */
|
|
2952
|
+
return /* @__PURE__ */ jsx21(
|
|
2970
2953
|
Card,
|
|
2971
2954
|
{
|
|
2972
2955
|
"data-chat-header": true,
|
|
2973
2956
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2974
2957
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2975
|
-
children: /* @__PURE__ */
|
|
2976
|
-
/* @__PURE__ */
|
|
2977
|
-
/* @__PURE__ */
|
|
2978
|
-
/* @__PURE__ */
|
|
2979
|
-
/* @__PURE__ */
|
|
2958
|
+
children: /* @__PURE__ */ jsx21(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2959
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
2960
|
+
/* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
2961
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(SidebarTrigger, { className: "-ml-1" }) }),
|
|
2962
|
+
/* @__PURE__ */ jsx21(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2980
2963
|
] }),
|
|
2981
|
-
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */
|
|
2964
|
+
showAgentSelector && isMultiAgentMode && onParticipantsChange && /* @__PURE__ */ jsx21(
|
|
2982
2965
|
ParticipantsSelector,
|
|
2983
2966
|
{
|
|
2984
2967
|
agents: agentOptions,
|
|
@@ -2986,40 +2969,40 @@ var ChatHeader = ({
|
|
|
2986
2969
|
onParticipantsChange
|
|
2987
2970
|
}
|
|
2988
2971
|
),
|
|
2989
|
-
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */
|
|
2990
|
-
/* @__PURE__ */
|
|
2972
|
+
showAgentSelector && !isMultiAgentMode && /* @__PURE__ */ jsxs13(DropdownMenu, { children: [
|
|
2973
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs13(
|
|
2991
2974
|
Button,
|
|
2992
2975
|
{
|
|
2993
2976
|
variant: "ghost",
|
|
2994
2977
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2995
2978
|
children: [
|
|
2996
|
-
selectedAgent?.avatarUrl ? /* @__PURE__ */
|
|
2997
|
-
/* @__PURE__ */
|
|
2998
|
-
/* @__PURE__ */
|
|
2979
|
+
selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs13(Avatar, { className: "h-5 w-5", children: [
|
|
2980
|
+
/* @__PURE__ */ jsx21(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2981
|
+
/* @__PURE__ */ jsx21(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2999
2982
|
] }) : null,
|
|
3000
|
-
/* @__PURE__ */
|
|
3001
|
-
/* @__PURE__ */
|
|
2983
|
+
/* @__PURE__ */ jsx21("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
2984
|
+
/* @__PURE__ */ jsx21(ChevronDown3, { className: "h-4 w-4 opacity-50" })
|
|
3002
2985
|
]
|
|
3003
2986
|
}
|
|
3004
2987
|
) }),
|
|
3005
|
-
/* @__PURE__ */
|
|
2988
|
+
/* @__PURE__ */ jsx21(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
3006
2989
|
const isSelected = agent.id === selectedAgentId;
|
|
3007
|
-
return /* @__PURE__ */
|
|
2990
|
+
return /* @__PURE__ */ jsxs13(
|
|
3008
2991
|
DropdownMenuItem,
|
|
3009
2992
|
{
|
|
3010
2993
|
onClick: () => onSelectAgent?.(agent.id),
|
|
3011
2994
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
3012
2995
|
children: [
|
|
3013
|
-
agent.avatarUrl ? /* @__PURE__ */
|
|
3014
|
-
/* @__PURE__ */
|
|
3015
|
-
/* @__PURE__ */
|
|
3016
|
-
] }) : /* @__PURE__ */
|
|
3017
|
-
/* @__PURE__ */
|
|
3018
|
-
/* @__PURE__ */
|
|
3019
|
-
/* @__PURE__ */
|
|
3020
|
-
isSelected && /* @__PURE__ */
|
|
2996
|
+
agent.avatarUrl ? /* @__PURE__ */ jsxs13(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2997
|
+
/* @__PURE__ */ jsx21(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2998
|
+
/* @__PURE__ */ jsx21(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
2999
|
+
] }) : /* @__PURE__ */ jsx21("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx21(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
3000
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3001
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2", children: [
|
|
3002
|
+
/* @__PURE__ */ jsx21("span", { className: "font-medium text-sm", children: agent.name }),
|
|
3003
|
+
isSelected && /* @__PURE__ */ jsx21(Check4, { className: "h-4 w-4 text-primary shrink-0" })
|
|
3021
3004
|
] }),
|
|
3022
|
-
agent.description && /* @__PURE__ */
|
|
3005
|
+
agent.description && /* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
3023
3006
|
] })
|
|
3024
3007
|
]
|
|
3025
3008
|
},
|
|
@@ -3027,59 +3010,59 @@ var ChatHeader = ({
|
|
|
3027
3010
|
);
|
|
3028
3011
|
}) })
|
|
3029
3012
|
] }),
|
|
3030
|
-
!showAgentSelector && isMobile && /* @__PURE__ */
|
|
3013
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ jsx21("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
3031
3014
|
] }),
|
|
3032
|
-
/* @__PURE__ */
|
|
3033
|
-
/* @__PURE__ */
|
|
3034
|
-
showCustomComponentButton && config.customComponent && /* @__PURE__ */
|
|
3035
|
-
/* @__PURE__ */
|
|
3015
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1" }),
|
|
3016
|
+
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
|
|
3017
|
+
showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs13(Tooltip, { children: [
|
|
3018
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
3036
3019
|
Button,
|
|
3037
3020
|
{
|
|
3038
3021
|
variant: "ghost",
|
|
3039
3022
|
size: "icon",
|
|
3040
3023
|
className: "h-8 w-8",
|
|
3041
3024
|
onClick: onCustomComponentToggle,
|
|
3042
|
-
children: config.customComponent.icon || /* @__PURE__ */
|
|
3025
|
+
children: config.customComponent.icon || /* @__PURE__ */ jsx21(Menu, { className: "h-4 w-4" })
|
|
3043
3026
|
}
|
|
3044
3027
|
) }),
|
|
3045
|
-
/* @__PURE__ */
|
|
3028
|
+
/* @__PURE__ */ jsx21(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
3046
3029
|
] }),
|
|
3047
3030
|
config.headerActions,
|
|
3048
|
-
/* @__PURE__ */
|
|
3049
|
-
/* @__PURE__ */
|
|
3050
|
-
/* @__PURE__ */
|
|
3051
|
-
onNewThread && /* @__PURE__ */
|
|
3052
|
-
/* @__PURE__ */
|
|
3053
|
-
/* @__PURE__ */
|
|
3031
|
+
/* @__PURE__ */ jsxs13(DropdownMenu, { children: [
|
|
3032
|
+
/* @__PURE__ */ jsx21(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx21(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
3033
|
+
/* @__PURE__ */ jsxs13(DropdownMenuContent, { align: "end", children: [
|
|
3034
|
+
onNewThread && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3035
|
+
/* @__PURE__ */ jsxs13(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
3036
|
+
/* @__PURE__ */ jsx21(Plus2, { className: "h-4 w-4 mr-2" }),
|
|
3054
3037
|
config.labels?.newThread || "New Thread"
|
|
3055
3038
|
] }),
|
|
3056
|
-
/* @__PURE__ */
|
|
3039
|
+
/* @__PURE__ */ jsx21(DropdownMenuSeparator, {})
|
|
3057
3040
|
] }),
|
|
3058
|
-
onExportData && /* @__PURE__ */
|
|
3059
|
-
/* @__PURE__ */
|
|
3041
|
+
onExportData && /* @__PURE__ */ jsxs13(DropdownMenuItem, { onClick: onExportData, children: [
|
|
3042
|
+
/* @__PURE__ */ jsx21(Download, { className: "h-4 w-4 mr-2" }),
|
|
3060
3043
|
config.labels?.exportData || "Export Data"
|
|
3061
3044
|
] }),
|
|
3062
|
-
onImportData && /* @__PURE__ */
|
|
3063
|
-
/* @__PURE__ */
|
|
3045
|
+
onImportData && /* @__PURE__ */ jsxs13(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
3046
|
+
/* @__PURE__ */ jsx21(Upload, { className: "h-4 w-4 mr-2" }),
|
|
3064
3047
|
config.labels?.importData || "Import Data"
|
|
3065
3048
|
] }),
|
|
3066
|
-
(onExportData || onImportData) && /* @__PURE__ */
|
|
3067
|
-
/* @__PURE__ */
|
|
3068
|
-
/* @__PURE__ */
|
|
3049
|
+
(onExportData || onImportData) && /* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
|
|
3050
|
+
/* @__PURE__ */ jsx21(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3051
|
+
/* @__PURE__ */ jsx21(Sun2, { className: "h-4 w-4 mr-2" }),
|
|
3069
3052
|
config.labels?.lightMode || "Light Mode"
|
|
3070
|
-
] }) : /* @__PURE__ */
|
|
3071
|
-
/* @__PURE__ */
|
|
3053
|
+
] }) : /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3054
|
+
/* @__PURE__ */ jsx21(Moon2, { className: "h-4 w-4 mr-2" }),
|
|
3072
3055
|
config.labels?.darkMode || "Dark Mode"
|
|
3073
3056
|
] }) }),
|
|
3074
|
-
onClearAll && /* @__PURE__ */
|
|
3075
|
-
/* @__PURE__ */
|
|
3076
|
-
/* @__PURE__ */
|
|
3057
|
+
onClearAll && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3058
|
+
/* @__PURE__ */ jsx21(DropdownMenuSeparator, {}),
|
|
3059
|
+
/* @__PURE__ */ jsxs13(
|
|
3077
3060
|
DropdownMenuItem,
|
|
3078
3061
|
{
|
|
3079
3062
|
onClick: onClearAll,
|
|
3080
3063
|
className: "text-destructive",
|
|
3081
3064
|
children: [
|
|
3082
|
-
/* @__PURE__ */
|
|
3065
|
+
/* @__PURE__ */ jsx21(Trash22, { className: "h-4 w-4 mr-2" }),
|
|
3083
3066
|
config.labels?.clearAll || "Clear All"
|
|
3084
3067
|
]
|
|
3085
3068
|
}
|
|
@@ -3094,18 +3077,18 @@ var ChatHeader = ({
|
|
|
3094
3077
|
};
|
|
3095
3078
|
|
|
3096
3079
|
// src/components/chat/ChatInput.tsx
|
|
3097
|
-
import React13, { useState as useState7, useRef as useRef5, useCallback as useCallback3, useEffect as
|
|
3080
|
+
import React13, { useState as useState7, useRef as useRef5, useCallback as useCallback3, useEffect as useEffect9, memo as memo4 } from "react";
|
|
3098
3081
|
|
|
3099
3082
|
// src/components/chat/UserContext.tsx
|
|
3100
|
-
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as
|
|
3101
|
-
import { jsx as
|
|
3083
|
+
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo4, useState as useState6 } from "react";
|
|
3084
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
3102
3085
|
var Ctx = createContext2(void 0);
|
|
3103
3086
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
3104
3087
|
const [ctx, setCtx] = useState6(() => ({
|
|
3105
3088
|
updatedAt: Date.now(),
|
|
3106
3089
|
...initial ?? {}
|
|
3107
3090
|
}));
|
|
3108
|
-
|
|
3091
|
+
useEffect8(() => {
|
|
3109
3092
|
if (!initial) return;
|
|
3110
3093
|
setCtx((prev) => {
|
|
3111
3094
|
const keys = Object.keys(initial);
|
|
@@ -3120,12 +3103,12 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
3120
3103
|
return { ...prev, ...partial, updatedAt: Date.now() };
|
|
3121
3104
|
});
|
|
3122
3105
|
}, []);
|
|
3123
|
-
const value =
|
|
3106
|
+
const value = useMemo4(() => ({
|
|
3124
3107
|
context: ctx,
|
|
3125
3108
|
setContext: setPartial,
|
|
3126
3109
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
3127
3110
|
}), [ctx, setPartial]);
|
|
3128
|
-
return /* @__PURE__ */
|
|
3111
|
+
return /* @__PURE__ */ jsx22(Ctx.Provider, { value, children });
|
|
3129
3112
|
};
|
|
3130
3113
|
function useChatUserContext() {
|
|
3131
3114
|
const v = useContext2(Ctx);
|
|
@@ -3459,13 +3442,13 @@ var resolveVoiceProviderFactory = (createProvider) => createProvider ?? createMa
|
|
|
3459
3442
|
|
|
3460
3443
|
// src/components/ui/progress.tsx
|
|
3461
3444
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
3462
|
-
import { jsx as
|
|
3445
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
3463
3446
|
function Progress({
|
|
3464
3447
|
className,
|
|
3465
3448
|
value,
|
|
3466
3449
|
...props
|
|
3467
3450
|
}) {
|
|
3468
|
-
return /* @__PURE__ */
|
|
3451
|
+
return /* @__PURE__ */ jsx23(
|
|
3469
3452
|
ProgressPrimitive.Root,
|
|
3470
3453
|
{
|
|
3471
3454
|
"data-slot": "progress",
|
|
@@ -3474,7 +3457,7 @@ function Progress({
|
|
|
3474
3457
|
className
|
|
3475
3458
|
),
|
|
3476
3459
|
...props,
|
|
3477
|
-
children: /* @__PURE__ */
|
|
3460
|
+
children: /* @__PURE__ */ jsx23(
|
|
3478
3461
|
ProgressPrimitive.Indicator,
|
|
3479
3462
|
{
|
|
3480
3463
|
"data-slot": "progress-indicator",
|
|
@@ -3488,7 +3471,7 @@ function Progress({
|
|
|
3488
3471
|
|
|
3489
3472
|
// src/components/chat/VoiceComposer.tsx
|
|
3490
3473
|
import { Keyboard, Loader2, Mic, Send, Square, Trash2 as Trash23, X as X3 } from "lucide-react";
|
|
3491
|
-
import { jsx as
|
|
3474
|
+
import { jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3492
3475
|
var formatDuration = (durationMs) => {
|
|
3493
3476
|
const totalSeconds = Math.max(0, Math.floor(durationMs / 1e3));
|
|
3494
3477
|
const minutes = Math.floor(totalSeconds / 60);
|
|
@@ -3583,13 +3566,13 @@ var VoiceComposer = ({
|
|
|
3583
3566
|
}
|
|
3584
3567
|
onRecordAgain();
|
|
3585
3568
|
};
|
|
3586
|
-
return /* @__PURE__ */
|
|
3587
|
-
/* @__PURE__ */
|
|
3588
|
-
/* @__PURE__ */
|
|
3589
|
-
/* @__PURE__ */
|
|
3590
|
-
/* @__PURE__ */
|
|
3569
|
+
return /* @__PURE__ */ jsxs14("div", { className: "w-full max-w-3xl rounded-2xl border bg-background p-3 shadow-sm sm:p-4 md:min-w-3xl", children: [
|
|
3570
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-2 sm:gap-3", children: [
|
|
3571
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex min-w-0 items-center gap-2", children: [
|
|
3572
|
+
/* @__PURE__ */ jsx24(Badge, { variant: "outline", children: labels?.voiceTitle || "Voice" }),
|
|
3573
|
+
/* @__PURE__ */ jsx24("span", { className: "truncate rounded-full bg-muted px-2.5 py-1 text-[11px] sm:text-xs text-muted-foreground", children: headerLabel })
|
|
3591
3574
|
] }),
|
|
3592
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ jsxs14(
|
|
3593
3576
|
Button,
|
|
3594
3577
|
{
|
|
3595
3578
|
type: "button",
|
|
@@ -3599,14 +3582,14 @@ var VoiceComposer = ({
|
|
|
3599
3582
|
onClick: onExit,
|
|
3600
3583
|
disabled: disabled || isBusy,
|
|
3601
3584
|
children: [
|
|
3602
|
-
/* @__PURE__ */
|
|
3603
|
-
/* @__PURE__ */
|
|
3585
|
+
/* @__PURE__ */ jsx24(Keyboard, { className: "h-4 w-4" }),
|
|
3586
|
+
/* @__PURE__ */ jsx24("span", { className: "hidden sm:inline", children: labels?.voiceExit || "Use keyboard" })
|
|
3604
3587
|
]
|
|
3605
3588
|
}
|
|
3606
3589
|
)
|
|
3607
3590
|
] }),
|
|
3608
|
-
!isDraftLayout ? /* @__PURE__ */
|
|
3609
|
-
/* @__PURE__ */
|
|
3591
|
+
!isDraftLayout ? /* @__PURE__ */ jsx24("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__ */ jsxs14("div", { className: "mx-auto flex w-full max-w-sm flex-col items-center gap-3", children: [
|
|
3592
|
+
/* @__PURE__ */ jsx24(
|
|
3610
3593
|
Button,
|
|
3611
3594
|
{
|
|
3612
3595
|
type: "button",
|
|
@@ -3615,21 +3598,21 @@ var VoiceComposer = ({
|
|
|
3615
3598
|
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"}`,
|
|
3616
3599
|
onClick: isCapturing ? onStop : onStart,
|
|
3617
3600
|
disabled: disabled || isBusy,
|
|
3618
|
-
children: isBusy ? /* @__PURE__ */
|
|
3601
|
+
children: isBusy ? /* @__PURE__ */ jsx24(Loader2, { className: "h-7 w-7 animate-spin" }) : isCapturing ? /* @__PURE__ */ jsx24(Square, { className: "h-7 w-7" }) : /* @__PURE__ */ jsx24(Mic, { className: "h-7 w-7" })
|
|
3619
3602
|
}
|
|
3620
3603
|
),
|
|
3621
|
-
/* @__PURE__ */
|
|
3622
|
-
/* @__PURE__ */
|
|
3623
|
-
/* @__PURE__ */
|
|
3624
|
-
/* @__PURE__ */
|
|
3625
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsxs14("div", { className: "w-full space-y-2", children: [
|
|
3605
|
+
/* @__PURE__ */ jsx24(Progress, { value: levelValue, className: "h-2" }),
|
|
3606
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between text-xs text-muted-foreground", children: [
|
|
3607
|
+
/* @__PURE__ */ jsx24("span", { children: formatDuration(durationMs) }),
|
|
3608
|
+
/* @__PURE__ */ jsx24("span", { children: isCapturing ? labels?.voiceStop || "Stop recording" : labels?.voiceStart || "Start recording" })
|
|
3626
3609
|
] })
|
|
3627
3610
|
] }),
|
|
3628
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3629
|
-
] }) }) : /* @__PURE__ */
|
|
3630
|
-
/* @__PURE__ */
|
|
3631
|
-
/* @__PURE__ */
|
|
3632
|
-
/* @__PURE__ */
|
|
3611
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx24("div", { className: "w-full rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText })
|
|
3612
|
+
] }) }) : /* @__PURE__ */ jsxs14("div", { className: "mt-3 rounded-xl border bg-muted/20 p-3 sm:p-4", children: [
|
|
3613
|
+
/* @__PURE__ */ jsxs14("div", { className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [
|
|
3614
|
+
/* @__PURE__ */ jsx24("span", { children: formatDuration(durationMs) }),
|
|
3615
|
+
/* @__PURE__ */ jsx24(
|
|
3633
3616
|
Button,
|
|
3634
3617
|
{
|
|
3635
3618
|
type: "button",
|
|
@@ -3640,12 +3623,12 @@ var VoiceComposer = ({
|
|
|
3640
3623
|
disabled,
|
|
3641
3624
|
"aria-label": labels?.voiceDiscard || "Delete recording",
|
|
3642
3625
|
title: labels?.voiceDiscard || "Delete recording",
|
|
3643
|
-
children: /* @__PURE__ */
|
|
3626
|
+
children: /* @__PURE__ */ jsx24(Trash23, { className: "h-4 w-4" })
|
|
3644
3627
|
}
|
|
3645
3628
|
)
|
|
3646
3629
|
] }),
|
|
3647
|
-
/* @__PURE__ */
|
|
3648
|
-
/* @__PURE__ */
|
|
3630
|
+
/* @__PURE__ */ jsxs14("div", { className: "mt-4 flex flex-col items-center gap-4 text-center", children: [
|
|
3631
|
+
/* @__PURE__ */ jsx24(
|
|
3649
3632
|
Button,
|
|
3650
3633
|
{
|
|
3651
3634
|
type: "button",
|
|
@@ -3654,12 +3637,12 @@ var VoiceComposer = ({
|
|
|
3654
3637
|
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"}`,
|
|
3655
3638
|
onClick: handleReviewOrbClick,
|
|
3656
3639
|
disabled: disabled || orbIsReviewBusy,
|
|
3657
|
-
children: orbIsReviewBusy ? /* @__PURE__ */
|
|
3640
|
+
children: orbIsReviewBusy ? /* @__PURE__ */ jsx24(Loader2, { className: "h-7 w-7 animate-spin" }) : orbIsListening ? /* @__PURE__ */ jsx24(Square, { className: "h-7 w-7" }) : isArmedDraft ? /* @__PURE__ */ jsx24(Mic, { className: "h-7 w-7 animate-pulse" }) : /* @__PURE__ */ jsx24(Mic, { className: "h-7 w-7" })
|
|
3658
3641
|
}
|
|
3659
3642
|
),
|
|
3660
|
-
/* @__PURE__ */
|
|
3661
|
-
/* @__PURE__ */
|
|
3662
|
-
isCapturing && /* @__PURE__ */
|
|
3643
|
+
/* @__PURE__ */ jsxs14("div", { className: "max-w-sm space-y-1 px-2", children: [
|
|
3644
|
+
/* @__PURE__ */ jsx24("p", { className: "text-sm text-foreground", children: reviewHelperText }),
|
|
3645
|
+
isCapturing && /* @__PURE__ */ jsx24("div", { className: "mx-auto h-1.5 w-32 overflow-hidden rounded-full bg-red-100", children: /* @__PURE__ */ jsx24(
|
|
3663
3646
|
"div",
|
|
3664
3647
|
{
|
|
3665
3648
|
className: "h-full rounded-full bg-red-500 transition-[width] duration-150",
|
|
@@ -3668,21 +3651,21 @@ var VoiceComposer = ({
|
|
|
3668
3651
|
) })
|
|
3669
3652
|
] })
|
|
3670
3653
|
] }),
|
|
3671
|
-
attachment && /* @__PURE__ */
|
|
3672
|
-
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */
|
|
3673
|
-
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */
|
|
3674
|
-
/* @__PURE__ */
|
|
3675
|
-
isAutoSendActive && /* @__PURE__ */
|
|
3676
|
-
/* @__PURE__ */
|
|
3654
|
+
attachment && /* @__PURE__ */ jsx24("div", { className: "mt-4 rounded-lg border bg-background/90 p-2 shadow-sm", children: /* @__PURE__ */ jsx24("audio", { controls: true, preload: "metadata", className: "w-full", children: /* @__PURE__ */ jsx24("source", { src: attachment.dataUrl, type: attachment.mimeType }) }) }),
|
|
3655
|
+
showTranscriptPreview && transcriptMode !== "none" && transcriptText && /* @__PURE__ */ jsx24("div", { className: "mt-3 rounded-lg border bg-background px-3 py-2 text-left text-sm", children: transcriptText }),
|
|
3656
|
+
isAutoSendActive && autoSendDelayMs > 0 && /* @__PURE__ */ jsx24("div", { className: "mt-3 flex justify-center", children: /* @__PURE__ */ jsx24("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) }) }),
|
|
3657
|
+
/* @__PURE__ */ jsxs14("div", { className: "mt-4 grid grid-cols-1 gap-2 sm:flex sm:items-center sm:justify-end", children: [
|
|
3658
|
+
isAutoSendActive && /* @__PURE__ */ jsxs14(Button, { type: "button", variant: "ghost", size: "sm", onClick: onCancelAutoSend, disabled, className: "w-full sm:w-auto", children: [
|
|
3659
|
+
/* @__PURE__ */ jsx24(X3, { className: "h-4 w-4" }),
|
|
3677
3660
|
labels?.voiceCancel || "Cancel"
|
|
3678
3661
|
] }),
|
|
3679
|
-
/* @__PURE__ */
|
|
3680
|
-
/* @__PURE__ */
|
|
3662
|
+
/* @__PURE__ */ jsxs14(Button, { type: "button", size: "sm", onClick: onSendNow, disabled, className: "w-full sm:w-auto", children: [
|
|
3663
|
+
/* @__PURE__ */ jsx24(Send, { className: "h-4 w-4" }),
|
|
3681
3664
|
labels?.voiceSendNow || "Send now"
|
|
3682
3665
|
] })
|
|
3683
3666
|
] })
|
|
3684
3667
|
] }),
|
|
3685
|
-
errorMessage && /* @__PURE__ */
|
|
3668
|
+
errorMessage && /* @__PURE__ */ jsx24("div", { className: "mt-3 rounded-lg border border-destructive/30 bg-destructive/5 px-3 py-2 text-sm text-destructive", children: errorMessage })
|
|
3686
3669
|
] });
|
|
3687
3670
|
};
|
|
3688
3671
|
|
|
@@ -3700,7 +3683,7 @@ import {
|
|
|
3700
3683
|
Pause,
|
|
3701
3684
|
Loader2 as Loader22
|
|
3702
3685
|
} from "lucide-react";
|
|
3703
|
-
import { Fragment as
|
|
3686
|
+
import { Fragment as Fragment6, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
3704
3687
|
function getActiveMentionMatch(value, caret) {
|
|
3705
3688
|
const prefix = value.slice(0, caret);
|
|
3706
3689
|
const match = /(^|\s)@([\w.-]*)$/.exec(prefix);
|
|
@@ -3752,10 +3735,10 @@ var FileUploadItem = memo4(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3752
3735
|
};
|
|
3753
3736
|
const getFileIcon = (type, name) => {
|
|
3754
3737
|
const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
|
|
3755
|
-
if (t.startsWith("image/")) return /* @__PURE__ */
|
|
3756
|
-
if (t.startsWith("video/")) return /* @__PURE__ */
|
|
3757
|
-
if (t.startsWith("audio/")) return /* @__PURE__ */
|
|
3758
|
-
return /* @__PURE__ */
|
|
3738
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ jsx25(Image2, { className: "h-4 w-4" });
|
|
3739
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ jsx25(Video, { className: "h-4 w-4" });
|
|
3740
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ jsx25(Mic2, { className: "h-4 w-4" });
|
|
3741
|
+
return /* @__PURE__ */ jsx25(FileText, { className: "h-4 w-4" });
|
|
3759
3742
|
};
|
|
3760
3743
|
const formatFileSize = (bytes) => {
|
|
3761
3744
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -3764,21 +3747,21 @@ var FileUploadItem = memo4(function FileUploadItem2({ file, progress, onCancel }
|
|
|
3764
3747
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
3765
3748
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
3766
3749
|
};
|
|
3767
|
-
return /* @__PURE__ */
|
|
3750
|
+
return /* @__PURE__ */ jsx25(Card, { className: "relative", children: /* @__PURE__ */ jsx25(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-3", children: [
|
|
3768
3751
|
getFileIcon(file.type, file.name),
|
|
3769
|
-
/* @__PURE__ */
|
|
3770
|
-
/* @__PURE__ */
|
|
3771
|
-
/* @__PURE__ */
|
|
3772
|
-
/* @__PURE__ */
|
|
3752
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1 min-w-0", children: [
|
|
3753
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
3754
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
3755
|
+
/* @__PURE__ */ jsx25(Progress, { value: progress, className: "h-1 mt-1" })
|
|
3773
3756
|
] }),
|
|
3774
|
-
/* @__PURE__ */
|
|
3757
|
+
/* @__PURE__ */ jsx25(
|
|
3775
3758
|
Button,
|
|
3776
3759
|
{
|
|
3777
3760
|
variant: "ghost",
|
|
3778
3761
|
size: "icon",
|
|
3779
3762
|
className: "h-6 w-6",
|
|
3780
3763
|
onClick: onCancel,
|
|
3781
|
-
children: /* @__PURE__ */
|
|
3764
|
+
children: /* @__PURE__ */ jsx25(X4, { className: "h-3 w-3" })
|
|
3782
3765
|
}
|
|
3783
3766
|
)
|
|
3784
3767
|
] }) }) });
|
|
@@ -3787,7 +3770,7 @@ var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove
|
|
|
3787
3770
|
const [isPlaying, setIsPlaying] = useState7(false);
|
|
3788
3771
|
const [audioPlaybackSrc, setAudioPlaybackSrc] = useState7(attachment.dataUrl);
|
|
3789
3772
|
const audioRef = useRef5(null);
|
|
3790
|
-
|
|
3773
|
+
useEffect9(() => {
|
|
3791
3774
|
if (attachment.kind !== "audio" || !attachment.dataUrl.startsWith("data:")) {
|
|
3792
3775
|
setAudioPlaybackSrc(attachment.dataUrl);
|
|
3793
3776
|
return;
|
|
@@ -3818,9 +3801,9 @@ var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove
|
|
|
3818
3801
|
const minutes = Math.floor(seconds / 60);
|
|
3819
3802
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
3820
3803
|
};
|
|
3821
|
-
return /* @__PURE__ */
|
|
3822
|
-
attachment.kind === "image" && /* @__PURE__ */
|
|
3823
|
-
/* @__PURE__ */
|
|
3804
|
+
return /* @__PURE__ */ jsx25(Card, { className: "relative group", children: /* @__PURE__ */ jsxs15(CardContent, { className: "p-2", children: [
|
|
3805
|
+
attachment.kind === "image" && /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
3806
|
+
/* @__PURE__ */ jsx25(
|
|
3824
3807
|
"img",
|
|
3825
3808
|
{
|
|
3826
3809
|
src: attachment.dataUrl,
|
|
@@ -3828,19 +3811,19 @@ var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove
|
|
|
3828
3811
|
className: "w-full h-20 object-cover rounded"
|
|
3829
3812
|
}
|
|
3830
3813
|
),
|
|
3831
|
-
/* @__PURE__ */
|
|
3814
|
+
/* @__PURE__ */ jsx25("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx25(
|
|
3832
3815
|
Button,
|
|
3833
3816
|
{
|
|
3834
3817
|
variant: "destructive",
|
|
3835
3818
|
size: "icon",
|
|
3836
3819
|
className: "h-6 w-6",
|
|
3837
3820
|
onClick: onRemove,
|
|
3838
|
-
children: /* @__PURE__ */
|
|
3821
|
+
children: /* @__PURE__ */ jsx25(X4, { className: "h-3 w-3" })
|
|
3839
3822
|
}
|
|
3840
3823
|
) })
|
|
3841
3824
|
] }),
|
|
3842
|
-
attachment.kind === "video" && /* @__PURE__ */
|
|
3843
|
-
/* @__PURE__ */
|
|
3825
|
+
attachment.kind === "video" && /* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
3826
|
+
/* @__PURE__ */ jsx25(
|
|
3844
3827
|
"video",
|
|
3845
3828
|
{
|
|
3846
3829
|
src: attachment.dataUrl,
|
|
@@ -3849,34 +3832,34 @@ var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove
|
|
|
3849
3832
|
muted: true
|
|
3850
3833
|
}
|
|
3851
3834
|
),
|
|
3852
|
-
/* @__PURE__ */
|
|
3835
|
+
/* @__PURE__ */ jsx25("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx25(
|
|
3853
3836
|
Button,
|
|
3854
3837
|
{
|
|
3855
3838
|
variant: "destructive",
|
|
3856
3839
|
size: "icon",
|
|
3857
3840
|
className: "h-6 w-6",
|
|
3858
3841
|
onClick: onRemove,
|
|
3859
|
-
children: /* @__PURE__ */
|
|
3842
|
+
children: /* @__PURE__ */ jsx25(X4, { className: "h-3 w-3" })
|
|
3860
3843
|
}
|
|
3861
3844
|
) }),
|
|
3862
|
-
/* @__PURE__ */
|
|
3845
|
+
/* @__PURE__ */ jsx25(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration2(attachment.durationMs) })
|
|
3863
3846
|
] }),
|
|
3864
|
-
attachment.kind === "audio" && /* @__PURE__ */
|
|
3865
|
-
/* @__PURE__ */
|
|
3847
|
+
attachment.kind === "audio" && /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 p-2", children: [
|
|
3848
|
+
/* @__PURE__ */ jsx25(
|
|
3866
3849
|
Button,
|
|
3867
3850
|
{
|
|
3868
3851
|
variant: "outline",
|
|
3869
3852
|
size: "icon",
|
|
3870
3853
|
className: "h-8 w-8",
|
|
3871
3854
|
onClick: handlePlayPause,
|
|
3872
|
-
children: isPlaying ? /* @__PURE__ */
|
|
3855
|
+
children: isPlaying ? /* @__PURE__ */ jsx25(Pause, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx25(Play, { className: "h-3 w-3" })
|
|
3873
3856
|
}
|
|
3874
3857
|
),
|
|
3875
|
-
/* @__PURE__ */
|
|
3876
|
-
/* @__PURE__ */
|
|
3877
|
-
/* @__PURE__ */
|
|
3858
|
+
/* @__PURE__ */ jsxs15("div", { className: "flex-1", children: [
|
|
3859
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs font-medium", children: attachment.fileName || "Audio" }),
|
|
3860
|
+
/* @__PURE__ */ jsx25("p", { className: "text-xs text-muted-foreground", children: formatDuration2(attachment.durationMs) })
|
|
3878
3861
|
] }),
|
|
3879
|
-
/* @__PURE__ */
|
|
3862
|
+
/* @__PURE__ */ jsx25(
|
|
3880
3863
|
"audio",
|
|
3881
3864
|
{
|
|
3882
3865
|
ref: audioRef,
|
|
@@ -3884,21 +3867,21 @@ var AttachmentPreview = memo4(function AttachmentPreview2({ attachment, onRemove
|
|
|
3884
3867
|
onPause: () => setIsPlaying(false),
|
|
3885
3868
|
onEnded: () => setIsPlaying(false),
|
|
3886
3869
|
preload: "metadata",
|
|
3887
|
-
children: /* @__PURE__ */
|
|
3870
|
+
children: /* @__PURE__ */ jsx25("source", { src: audioPlaybackSrc, type: attachment.mimeType })
|
|
3888
3871
|
}
|
|
3889
3872
|
),
|
|
3890
|
-
/* @__PURE__ */
|
|
3873
|
+
/* @__PURE__ */ jsx25(
|
|
3891
3874
|
Button,
|
|
3892
3875
|
{
|
|
3893
3876
|
variant: "ghost",
|
|
3894
3877
|
size: "icon",
|
|
3895
3878
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
3896
3879
|
onClick: onRemove,
|
|
3897
|
-
children: /* @__PURE__ */
|
|
3880
|
+
children: /* @__PURE__ */ jsx25(X4, { className: "h-3 w-3" })
|
|
3898
3881
|
}
|
|
3899
3882
|
)
|
|
3900
3883
|
] }),
|
|
3901
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */
|
|
3884
|
+
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx25("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx25("p", { className: "truncate", children: attachment.fileName }) })
|
|
3902
3885
|
] }) });
|
|
3903
3886
|
});
|
|
3904
3887
|
var resolveVoiceErrorMessage = (error, config) => {
|
|
@@ -3990,7 +3973,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
3990
3973
|
});
|
|
3991
3974
|
setActiveMentionIndex(0);
|
|
3992
3975
|
}, []);
|
|
3993
|
-
|
|
3976
|
+
useEffect9(() => {
|
|
3994
3977
|
return () => {
|
|
3995
3978
|
if (voiceProviderRef.current) {
|
|
3996
3979
|
void voiceProviderRef.current.destroy();
|
|
@@ -3998,10 +3981,10 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
3998
3981
|
}
|
|
3999
3982
|
};
|
|
4000
3983
|
}, []);
|
|
4001
|
-
|
|
3984
|
+
useEffect9(() => {
|
|
4002
3985
|
voiceDraftRef.current = voiceDraft;
|
|
4003
3986
|
}, [voiceDraft]);
|
|
4004
|
-
|
|
3987
|
+
useEffect9(() => {
|
|
4005
3988
|
if (!isMentionMenuOpen) {
|
|
4006
3989
|
setActiveMentionIndex(0);
|
|
4007
3990
|
return;
|
|
@@ -4421,7 +4404,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4421
4404
|
setVoiceAudioLevel(0);
|
|
4422
4405
|
setVoiceState("review");
|
|
4423
4406
|
}, [armVoiceDraftForAppend, stopVoiceCapture, voiceReviewMode, voiceState]);
|
|
4424
|
-
|
|
4407
|
+
useEffect9(() => {
|
|
4425
4408
|
if (!voiceDraft || voiceAutoSendDelayMs <= 0 || !isVoiceAutoSendActive) {
|
|
4426
4409
|
return;
|
|
4427
4410
|
}
|
|
@@ -4449,8 +4432,8 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4449
4432
|
};
|
|
4450
4433
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
4451
4434
|
const showVoiceComposer = enableAudioRecording && isVoiceComposerOpen;
|
|
4452
|
-
return /* @__PURE__ */
|
|
4453
|
-
uploadProgress.size > 0 && /* @__PURE__ */
|
|
4435
|
+
return /* @__PURE__ */ jsx25(TooltipProvider, { children: /* @__PURE__ */ jsx25("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs15("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
|
|
4436
|
+
uploadProgress.size > 0 && /* @__PURE__ */ jsx25("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx25(
|
|
4454
4437
|
FileUploadItem,
|
|
4455
4438
|
{
|
|
4456
4439
|
file: { name: progress.fileName },
|
|
@@ -4465,7 +4448,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4465
4448
|
},
|
|
4466
4449
|
id
|
|
4467
4450
|
)) }),
|
|
4468
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4451
|
+
attachments.length > 0 && /* @__PURE__ */ jsx25("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx25(
|
|
4469
4452
|
AttachmentPreview,
|
|
4470
4453
|
{
|
|
4471
4454
|
attachment,
|
|
@@ -4473,7 +4456,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4473
4456
|
},
|
|
4474
4457
|
index
|
|
4475
4458
|
)) }),
|
|
4476
|
-
showVoiceComposer ? /* @__PURE__ */
|
|
4459
|
+
showVoiceComposer ? /* @__PURE__ */ jsx25("div", { className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsx25(
|
|
4477
4460
|
VoiceComposer,
|
|
4478
4461
|
{
|
|
4479
4462
|
state: voiceState,
|
|
@@ -4513,15 +4496,15 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4513
4496
|
void closeVoiceComposer();
|
|
4514
4497
|
}
|
|
4515
4498
|
}
|
|
4516
|
-
) }) : /* @__PURE__ */
|
|
4499
|
+
) }) : /* @__PURE__ */ jsx25("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs15(
|
|
4517
4500
|
"div",
|
|
4518
4501
|
{
|
|
4519
4502
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
4520
4503
|
onDrop: handleDrop,
|
|
4521
4504
|
onDragOver: handleDragOver,
|
|
4522
4505
|
children: [
|
|
4523
|
-
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */
|
|
4524
|
-
/* @__PURE__ */
|
|
4506
|
+
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
4507
|
+
/* @__PURE__ */ jsx25(
|
|
4525
4508
|
"input",
|
|
4526
4509
|
{
|
|
4527
4510
|
ref: fileInputRef,
|
|
@@ -4532,8 +4515,8 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4532
4515
|
className: "hidden"
|
|
4533
4516
|
}
|
|
4534
4517
|
),
|
|
4535
|
-
/* @__PURE__ */
|
|
4536
|
-
/* @__PURE__ */
|
|
4518
|
+
/* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
4519
|
+
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
4537
4520
|
Button,
|
|
4538
4521
|
{
|
|
4539
4522
|
type: "button",
|
|
@@ -4546,14 +4529,14 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4546
4529
|
fileInputRef.current?.click();
|
|
4547
4530
|
},
|
|
4548
4531
|
disabled,
|
|
4549
|
-
children: /* @__PURE__ */
|
|
4532
|
+
children: /* @__PURE__ */ jsx25(Paperclip, { className: "h-4 w-4" })
|
|
4550
4533
|
}
|
|
4551
4534
|
) }),
|
|
4552
|
-
/* @__PURE__ */
|
|
4535
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
4553
4536
|
] })
|
|
4554
4537
|
] }),
|
|
4555
|
-
/* @__PURE__ */
|
|
4556
|
-
/* @__PURE__ */
|
|
4538
|
+
/* @__PURE__ */ jsxs15("div", { className: "relative flex-1", children: [
|
|
4539
|
+
/* @__PURE__ */ jsx25(
|
|
4557
4540
|
Textarea,
|
|
4558
4541
|
{
|
|
4559
4542
|
ref: textareaRef,
|
|
@@ -4577,7 +4560,7 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4577
4560
|
rows: 1
|
|
4578
4561
|
}
|
|
4579
4562
|
),
|
|
4580
|
-
isMentionMenuOpen && /* @__PURE__ */
|
|
4563
|
+
isMentionMenuOpen && /* @__PURE__ */ jsx25("div", { className: "absolute bottom-full left-0 right-0 mb-2 overflow-hidden rounded-md border bg-popover shadow-md", children: /* @__PURE__ */ jsx25("div", { className: "p-1", children: filteredMentionAgents.map((agent, index) => /* @__PURE__ */ jsxs15(
|
|
4581
4564
|
"button",
|
|
4582
4565
|
{
|
|
4583
4566
|
type: "button",
|
|
@@ -4587,15 +4570,15 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4587
4570
|
selectMentionAgent(agent);
|
|
4588
4571
|
},
|
|
4589
4572
|
children: [
|
|
4590
|
-
/* @__PURE__ */
|
|
4591
|
-
agent.description && /* @__PURE__ */
|
|
4573
|
+
/* @__PURE__ */ jsx25("span", { className: "font-medium", children: agent.name }),
|
|
4574
|
+
agent.description && /* @__PURE__ */ jsx25("span", { className: "truncate text-xs text-muted-foreground", children: agent.description })
|
|
4592
4575
|
]
|
|
4593
4576
|
},
|
|
4594
4577
|
agent.id
|
|
4595
4578
|
)) }) })
|
|
4596
4579
|
] }),
|
|
4597
|
-
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */
|
|
4598
|
-
/* @__PURE__ */
|
|
4580
|
+
enableAudioRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
4581
|
+
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
4599
4582
|
Button,
|
|
4600
4583
|
{
|
|
4601
4584
|
type: "button",
|
|
@@ -4606,13 +4589,13 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4606
4589
|
void startVoiceCapture();
|
|
4607
4590
|
},
|
|
4608
4591
|
disabled: disabled || isGenerating,
|
|
4609
|
-
children: /* @__PURE__ */
|
|
4592
|
+
children: /* @__PURE__ */ jsx25(Mic2, { className: "h-4 w-4" })
|
|
4610
4593
|
}
|
|
4611
4594
|
) }),
|
|
4612
|
-
/* @__PURE__ */
|
|
4595
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.voiceEnter })
|
|
4613
4596
|
] }),
|
|
4614
|
-
isGenerating ? /* @__PURE__ */
|
|
4615
|
-
/* @__PURE__ */
|
|
4597
|
+
isGenerating ? /* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
4598
|
+
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
4616
4599
|
Button,
|
|
4617
4600
|
{
|
|
4618
4601
|
type: "button",
|
|
@@ -4620,36 +4603,36 @@ var ChatInput = memo4(function ChatInput2({
|
|
|
4620
4603
|
size: "icon",
|
|
4621
4604
|
className: "h-10 w-10",
|
|
4622
4605
|
onClick: onStopGeneration,
|
|
4623
|
-
children: /* @__PURE__ */
|
|
4606
|
+
children: /* @__PURE__ */ jsx25(Square2, { className: "h-4 w-4" })
|
|
4624
4607
|
}
|
|
4625
4608
|
) }),
|
|
4626
|
-
/* @__PURE__ */
|
|
4627
|
-
] }) : /* @__PURE__ */
|
|
4628
|
-
/* @__PURE__ */
|
|
4609
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
4610
|
+
] }) : /* @__PURE__ */ jsxs15(Tooltip, { children: [
|
|
4611
|
+
/* @__PURE__ */ jsx25(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(
|
|
4629
4612
|
Button,
|
|
4630
4613
|
{
|
|
4631
4614
|
type: "submit",
|
|
4632
4615
|
size: "icon",
|
|
4633
4616
|
className: "h-10 w-10",
|
|
4634
4617
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
4635
|
-
children: disabled ? /* @__PURE__ */
|
|
4618
|
+
children: disabled ? /* @__PURE__ */ jsx25(Loader22, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx25(Send2, { className: "h-4 w-4" })
|
|
4636
4619
|
}
|
|
4637
4620
|
) }),
|
|
4638
|
-
/* @__PURE__ */
|
|
4621
|
+
/* @__PURE__ */ jsx25(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
4639
4622
|
] })
|
|
4640
4623
|
]
|
|
4641
4624
|
}
|
|
4642
4625
|
) }),
|
|
4643
|
-
/* @__PURE__ */
|
|
4626
|
+
/* @__PURE__ */ jsxs15("div", { className: "text-[10px] text-muted-foreground text-center", children: [
|
|
4644
4627
|
window.innerWidth > 768 ? config?.labels?.inputHelpText : "",
|
|
4645
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
4628
|
+
attachments.length > 0 && /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
4646
4629
|
" \u2022 ",
|
|
4647
4630
|
attachments.length,
|
|
4648
4631
|
"/",
|
|
4649
4632
|
maxAttachments,
|
|
4650
4633
|
" anexos"
|
|
4651
4634
|
] }),
|
|
4652
|
-
config?.labels?.footerLabel && /* @__PURE__ */
|
|
4635
|
+
config?.labels?.footerLabel && /* @__PURE__ */ jsxs15(Fragment6, { children: [
|
|
4653
4636
|
" \u2022 ",
|
|
4654
4637
|
config.labels.footerLabel
|
|
4655
4638
|
] })
|
|
@@ -4663,16 +4646,16 @@ import { useState as useState8 } from "react";
|
|
|
4663
4646
|
// src/components/ui/scroll-area.tsx
|
|
4664
4647
|
import * as React14 from "react";
|
|
4665
4648
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
4666
|
-
import { jsx as
|
|
4649
|
+
import { jsx as jsx26, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
4667
4650
|
var ScrollArea = React14.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
4668
|
-
return /* @__PURE__ */
|
|
4651
|
+
return /* @__PURE__ */ jsxs16(
|
|
4669
4652
|
ScrollAreaPrimitive.Root,
|
|
4670
4653
|
{
|
|
4671
4654
|
"data-slot": "scroll-area",
|
|
4672
4655
|
className: cn("relative", className),
|
|
4673
4656
|
...props,
|
|
4674
4657
|
children: [
|
|
4675
|
-
/* @__PURE__ */
|
|
4658
|
+
/* @__PURE__ */ jsx26(
|
|
4676
4659
|
ScrollAreaPrimitive.Viewport,
|
|
4677
4660
|
{
|
|
4678
4661
|
ref,
|
|
@@ -4686,8 +4669,8 @@ var ScrollArea = React14.forwardRef(({ className, children, viewportClassName, o
|
|
|
4686
4669
|
children
|
|
4687
4670
|
}
|
|
4688
4671
|
),
|
|
4689
|
-
/* @__PURE__ */
|
|
4690
|
-
/* @__PURE__ */
|
|
4672
|
+
/* @__PURE__ */ jsx26(ScrollBar, {}),
|
|
4673
|
+
/* @__PURE__ */ jsx26(ScrollAreaPrimitive.Corner, {})
|
|
4691
4674
|
]
|
|
4692
4675
|
}
|
|
4693
4676
|
);
|
|
@@ -4698,7 +4681,7 @@ function ScrollBar({
|
|
|
4698
4681
|
orientation = "vertical",
|
|
4699
4682
|
...props
|
|
4700
4683
|
}) {
|
|
4701
|
-
return /* @__PURE__ */
|
|
4684
|
+
return /* @__PURE__ */ jsx26(
|
|
4702
4685
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
4703
4686
|
{
|
|
4704
4687
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -4710,7 +4693,7 @@ function ScrollBar({
|
|
|
4710
4693
|
className
|
|
4711
4694
|
),
|
|
4712
4695
|
...props,
|
|
4713
|
-
children: /* @__PURE__ */
|
|
4696
|
+
children: /* @__PURE__ */ jsx26(
|
|
4714
4697
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
4715
4698
|
{
|
|
4716
4699
|
"data-slot": "scroll-area-thumb",
|
|
@@ -4749,7 +4732,7 @@ import {
|
|
|
4749
4732
|
Check as Check5,
|
|
4750
4733
|
X as X5
|
|
4751
4734
|
} from "lucide-react";
|
|
4752
|
-
import { Fragment as
|
|
4735
|
+
import { Fragment as Fragment7, jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
4753
4736
|
var getInitials2 = (name, email) => {
|
|
4754
4737
|
if (name) {
|
|
4755
4738
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -4763,29 +4746,29 @@ var getFieldIcon = (type, key) => {
|
|
|
4763
4746
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4764
4747
|
switch (type) {
|
|
4765
4748
|
case "email":
|
|
4766
|
-
return /* @__PURE__ */
|
|
4749
|
+
return /* @__PURE__ */ jsx27(Mail, { className: iconClass });
|
|
4767
4750
|
case "phone":
|
|
4768
|
-
return /* @__PURE__ */
|
|
4751
|
+
return /* @__PURE__ */ jsx27(Phone, { className: iconClass });
|
|
4769
4752
|
case "url":
|
|
4770
|
-
return /* @__PURE__ */
|
|
4753
|
+
return /* @__PURE__ */ jsx27(Globe, { className: iconClass });
|
|
4771
4754
|
case "date":
|
|
4772
|
-
return /* @__PURE__ */
|
|
4755
|
+
return /* @__PURE__ */ jsx27(Calendar, { className: iconClass });
|
|
4773
4756
|
}
|
|
4774
4757
|
const lowerKey = key?.toLowerCase() || "";
|
|
4775
|
-
if (lowerKey.includes("follower")) return /* @__PURE__ */
|
|
4776
|
-
if (lowerKey.includes("following")) return /* @__PURE__ */
|
|
4777
|
-
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */
|
|
4778
|
-
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */
|
|
4779
|
-
if (lowerKey.includes("bio")) return /* @__PURE__ */
|
|
4780
|
-
if (lowerKey.includes("email")) return /* @__PURE__ */
|
|
4781
|
-
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */
|
|
4782
|
-
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */
|
|
4783
|
-
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */
|
|
4784
|
-
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */
|
|
4785
|
-
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */
|
|
4786
|
-
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */
|
|
4787
|
-
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */
|
|
4788
|
-
return /* @__PURE__ */
|
|
4758
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx27(Users2, { className: iconClass });
|
|
4759
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ jsx27(UserPlus, { className: iconClass });
|
|
4760
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx27(Image3, { className: iconClass });
|
|
4761
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx27(BadgeCheck, { className: iconClass });
|
|
4762
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx27(FileText2, { className: iconClass });
|
|
4763
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ jsx27(Mail, { className: iconClass });
|
|
4764
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx27(Phone, { className: iconClass });
|
|
4765
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx27(MapPin, { className: iconClass });
|
|
4766
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx27(Building, { className: iconClass });
|
|
4767
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx27(Briefcase, { className: iconClass });
|
|
4768
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx27(Globe, { className: iconClass });
|
|
4769
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx27(AtSign2, { className: iconClass });
|
|
4770
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx27(Calendar, { className: iconClass });
|
|
4771
|
+
return /* @__PURE__ */ jsx27(User2, { className: iconClass });
|
|
4789
4772
|
};
|
|
4790
4773
|
var formatValue = (value, type, key) => {
|
|
4791
4774
|
if (value === null || value === void 0) return "-";
|
|
@@ -4819,15 +4802,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
4819
4802
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
4820
4803
|
switch (category) {
|
|
4821
4804
|
case "preference":
|
|
4822
|
-
return /* @__PURE__ */
|
|
4805
|
+
return /* @__PURE__ */ jsx27(Heart, { className: iconClass });
|
|
4823
4806
|
case "fact":
|
|
4824
|
-
return /* @__PURE__ */
|
|
4807
|
+
return /* @__PURE__ */ jsx27(Info, { className: iconClass });
|
|
4825
4808
|
case "goal":
|
|
4826
|
-
return /* @__PURE__ */
|
|
4809
|
+
return /* @__PURE__ */ jsx27(Target, { className: iconClass });
|
|
4827
4810
|
case "context":
|
|
4828
|
-
return /* @__PURE__ */
|
|
4811
|
+
return /* @__PURE__ */ jsx27(Lightbulb, { className: iconClass });
|
|
4829
4812
|
default:
|
|
4830
|
-
return /* @__PURE__ */
|
|
4813
|
+
return /* @__PURE__ */ jsx27(Brain2, { className: iconClass });
|
|
4831
4814
|
}
|
|
4832
4815
|
};
|
|
4833
4816
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -4897,66 +4880,66 @@ var UserProfile = ({
|
|
|
4897
4880
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
4898
4881
|
const initials = getInitials2(user?.name, user?.email);
|
|
4899
4882
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
4900
|
-
return /* @__PURE__ */
|
|
4883
|
+
return /* @__PURE__ */ jsx27(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs17(
|
|
4901
4884
|
SheetContent,
|
|
4902
4885
|
{
|
|
4903
4886
|
side: "right",
|
|
4904
4887
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
4905
4888
|
children: [
|
|
4906
|
-
/* @__PURE__ */
|
|
4907
|
-
/* @__PURE__ */
|
|
4908
|
-
/* @__PURE__ */
|
|
4909
|
-
/* @__PURE__ */
|
|
4910
|
-
user?.avatar && /* @__PURE__ */
|
|
4911
|
-
/* @__PURE__ */
|
|
4889
|
+
/* @__PURE__ */ jsx27(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx27("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx27(SheetTitle, { children: labels.title }) }) }),
|
|
4890
|
+
/* @__PURE__ */ jsx27(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs17("div", { className: "p-6 space-y-6", children: [
|
|
4891
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
4892
|
+
/* @__PURE__ */ jsxs17(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
4893
|
+
user?.avatar && /* @__PURE__ */ jsx27(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
4894
|
+
/* @__PURE__ */ jsx27(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
4912
4895
|
] }),
|
|
4913
|
-
/* @__PURE__ */
|
|
4914
|
-
/* @__PURE__ */
|
|
4915
|
-
user?.email && /* @__PURE__ */
|
|
4896
|
+
/* @__PURE__ */ jsxs17("div", { className: "w-full px-2", children: [
|
|
4897
|
+
/* @__PURE__ */ jsx27("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
4898
|
+
user?.email && /* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
4916
4899
|
] })
|
|
4917
4900
|
] }),
|
|
4918
|
-
/* @__PURE__ */
|
|
4919
|
-
/* @__PURE__ */
|
|
4920
|
-
/* @__PURE__ */
|
|
4921
|
-
/* @__PURE__ */
|
|
4922
|
-
/* @__PURE__ */
|
|
4923
|
-
/* @__PURE__ */
|
|
4924
|
-
/* @__PURE__ */
|
|
4925
|
-
/* @__PURE__ */
|
|
4926
|
-
/* @__PURE__ */
|
|
4901
|
+
/* @__PURE__ */ jsx27(Separator, {}),
|
|
4902
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
|
|
4903
|
+
/* @__PURE__ */ jsx27("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
4904
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-2", children: [
|
|
4905
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4906
|
+
/* @__PURE__ */ jsx27(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4907
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
4908
|
+
/* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
4909
|
+
/* @__PURE__ */ jsx27("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
4927
4910
|
] })
|
|
4928
4911
|
] }),
|
|
4929
|
-
user?.email && /* @__PURE__ */
|
|
4930
|
-
/* @__PURE__ */
|
|
4931
|
-
/* @__PURE__ */
|
|
4932
|
-
/* @__PURE__ */
|
|
4933
|
-
/* @__PURE__ */
|
|
4912
|
+
user?.email && /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4913
|
+
/* @__PURE__ */ jsx27(AtSign2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4914
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
4915
|
+
/* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
4916
|
+
/* @__PURE__ */ jsx27("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
4934
4917
|
] })
|
|
4935
4918
|
] }),
|
|
4936
|
-
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */
|
|
4937
|
-
/* @__PURE__ */
|
|
4938
|
-
/* @__PURE__ */
|
|
4939
|
-
/* @__PURE__ */
|
|
4940
|
-
/* @__PURE__ */
|
|
4919
|
+
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs17("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
4920
|
+
/* @__PURE__ */ jsx27(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
4921
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
4922
|
+
/* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
4923
|
+
/* @__PURE__ */ jsx27("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
4941
4924
|
] })
|
|
4942
4925
|
] })
|
|
4943
4926
|
] })
|
|
4944
4927
|
] }),
|
|
4945
|
-
normalizedFields.length > 0 && /* @__PURE__ */
|
|
4946
|
-
/* @__PURE__ */
|
|
4947
|
-
/* @__PURE__ */
|
|
4948
|
-
/* @__PURE__ */
|
|
4949
|
-
/* @__PURE__ */
|
|
4928
|
+
normalizedFields.length > 0 && /* @__PURE__ */ jsxs17(Fragment7, { children: [
|
|
4929
|
+
/* @__PURE__ */ jsx27(Separator, {}),
|
|
4930
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
|
|
4931
|
+
/* @__PURE__ */ jsx27("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
4932
|
+
/* @__PURE__ */ jsx27("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
4950
4933
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
4951
|
-
return /* @__PURE__ */
|
|
4934
|
+
return /* @__PURE__ */ jsxs17(
|
|
4952
4935
|
"div",
|
|
4953
4936
|
{
|
|
4954
4937
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
4955
4938
|
children: [
|
|
4956
|
-
/* @__PURE__ */
|
|
4957
|
-
/* @__PURE__ */
|
|
4958
|
-
/* @__PURE__ */
|
|
4959
|
-
/* @__PURE__ */
|
|
4939
|
+
/* @__PURE__ */ jsx27("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
4940
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
4941
|
+
/* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
4942
|
+
/* @__PURE__ */ jsx27("p", { className: cn(
|
|
4960
4943
|
"text-sm font-medium",
|
|
4961
4944
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
4962
4945
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -4968,26 +4951,26 @@ var UserProfile = ({
|
|
|
4968
4951
|
}) })
|
|
4969
4952
|
] })
|
|
4970
4953
|
] }),
|
|
4971
|
-
/* @__PURE__ */
|
|
4972
|
-
/* @__PURE__ */
|
|
4973
|
-
/* @__PURE__ */
|
|
4974
|
-
/* @__PURE__ */
|
|
4975
|
-
/* @__PURE__ */
|
|
4954
|
+
/* @__PURE__ */ jsx27(Separator, {}),
|
|
4955
|
+
/* @__PURE__ */ jsxs17("div", { className: "space-y-3", children: [
|
|
4956
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center justify-between", children: [
|
|
4957
|
+
/* @__PURE__ */ jsxs17("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
4958
|
+
/* @__PURE__ */ jsx27(Brain2, { className: "h-4 w-4" }),
|
|
4976
4959
|
labels.memories
|
|
4977
4960
|
] }),
|
|
4978
|
-
onAddMemory && /* @__PURE__ */
|
|
4961
|
+
onAddMemory && /* @__PURE__ */ jsx27(
|
|
4979
4962
|
Button,
|
|
4980
4963
|
{
|
|
4981
4964
|
variant: "ghost",
|
|
4982
4965
|
size: "sm",
|
|
4983
4966
|
className: "h-7 px-2",
|
|
4984
4967
|
onClick: () => setIsAddingMemory(true),
|
|
4985
|
-
children: /* @__PURE__ */
|
|
4968
|
+
children: /* @__PURE__ */ jsx27(Plus3, { className: "h-4 w-4" })
|
|
4986
4969
|
}
|
|
4987
4970
|
)
|
|
4988
4971
|
] }),
|
|
4989
|
-
isAddingMemory && onAddMemory && /* @__PURE__ */
|
|
4990
|
-
/* @__PURE__ */
|
|
4972
|
+
isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs17("div", { className: "flex gap-2", children: [
|
|
4973
|
+
/* @__PURE__ */ jsx27(
|
|
4991
4974
|
Input,
|
|
4992
4975
|
{
|
|
4993
4976
|
value: newMemoryContent,
|
|
@@ -5004,24 +4987,24 @@ var UserProfile = ({
|
|
|
5004
4987
|
autoFocus: true
|
|
5005
4988
|
}
|
|
5006
4989
|
),
|
|
5007
|
-
/* @__PURE__ */
|
|
4990
|
+
/* @__PURE__ */ jsx27(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
5008
4991
|
] }),
|
|
5009
|
-
/* @__PURE__ */
|
|
4992
|
+
/* @__PURE__ */ jsx27("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx27("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
|
|
5010
4993
|
const isEditing = editingMemoryId === memory.id;
|
|
5011
|
-
return /* @__PURE__ */
|
|
4994
|
+
return /* @__PURE__ */ jsxs17(
|
|
5012
4995
|
"div",
|
|
5013
4996
|
{
|
|
5014
4997
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
5015
4998
|
children: [
|
|
5016
|
-
/* @__PURE__ */
|
|
5017
|
-
/* @__PURE__ */
|
|
5018
|
-
/* @__PURE__ */
|
|
5019
|
-
/* @__PURE__ */
|
|
5020
|
-
/* @__PURE__ */
|
|
5021
|
-
/* @__PURE__ */
|
|
4999
|
+
/* @__PURE__ */ jsx27("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx27(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
|
|
5000
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex-1 min-w-0", children: [
|
|
5001
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
5002
|
+
/* @__PURE__ */ jsx27("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
5003
|
+
/* @__PURE__ */ jsx27("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
5004
|
+
/* @__PURE__ */ jsx27("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
5022
5005
|
] }),
|
|
5023
|
-
isEditing ? /* @__PURE__ */
|
|
5024
|
-
/* @__PURE__ */
|
|
5006
|
+
isEditing ? /* @__PURE__ */ jsxs17("div", { className: "space-y-2", children: [
|
|
5007
|
+
/* @__PURE__ */ jsx27(
|
|
5025
5008
|
Textarea,
|
|
5026
5009
|
{
|
|
5027
5010
|
value: editingMemoryContent,
|
|
@@ -5038,8 +5021,8 @@ var UserProfile = ({
|
|
|
5038
5021
|
}
|
|
5039
5022
|
}
|
|
5040
5023
|
),
|
|
5041
|
-
/* @__PURE__ */
|
|
5042
|
-
/* @__PURE__ */
|
|
5024
|
+
/* @__PURE__ */ jsxs17("div", { className: "flex gap-1 justify-end", children: [
|
|
5025
|
+
/* @__PURE__ */ jsxs17(
|
|
5043
5026
|
Button,
|
|
5044
5027
|
{
|
|
5045
5028
|
variant: "ghost",
|
|
@@ -5047,12 +5030,12 @@ var UserProfile = ({
|
|
|
5047
5030
|
className: "h-7 px-2",
|
|
5048
5031
|
onClick: handleCancelEdit,
|
|
5049
5032
|
children: [
|
|
5050
|
-
/* @__PURE__ */
|
|
5033
|
+
/* @__PURE__ */ jsx27(X5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
5051
5034
|
"Cancelar"
|
|
5052
5035
|
]
|
|
5053
5036
|
}
|
|
5054
5037
|
),
|
|
5055
|
-
/* @__PURE__ */
|
|
5038
|
+
/* @__PURE__ */ jsxs17(
|
|
5056
5039
|
Button,
|
|
5057
5040
|
{
|
|
5058
5041
|
size: "sm",
|
|
@@ -5060,33 +5043,33 @@ var UserProfile = ({
|
|
|
5060
5043
|
onClick: handleSaveEdit,
|
|
5061
5044
|
disabled: !editingMemoryContent.trim(),
|
|
5062
5045
|
children: [
|
|
5063
|
-
/* @__PURE__ */
|
|
5046
|
+
/* @__PURE__ */ jsx27(Check5, { className: "h-3.5 w-3.5 mr-1" }),
|
|
5064
5047
|
"Salvar"
|
|
5065
5048
|
]
|
|
5066
5049
|
}
|
|
5067
5050
|
)
|
|
5068
5051
|
] })
|
|
5069
|
-
] }) : /* @__PURE__ */
|
|
5052
|
+
] }) : /* @__PURE__ */ jsx27("p", { className: "text-sm break-words", children: memory.content })
|
|
5070
5053
|
] }),
|
|
5071
|
-
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */
|
|
5072
|
-
onUpdateMemory && /* @__PURE__ */
|
|
5054
|
+
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs17("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
5055
|
+
onUpdateMemory && /* @__PURE__ */ jsx27(
|
|
5073
5056
|
Button,
|
|
5074
5057
|
{
|
|
5075
5058
|
variant: "ghost",
|
|
5076
5059
|
size: "icon",
|
|
5077
5060
|
className: "h-7 w-7",
|
|
5078
5061
|
onClick: () => handleStartEdit(memory),
|
|
5079
|
-
children: /* @__PURE__ */
|
|
5062
|
+
children: /* @__PURE__ */ jsx27(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
5080
5063
|
}
|
|
5081
5064
|
),
|
|
5082
|
-
onDeleteMemory && /* @__PURE__ */
|
|
5065
|
+
onDeleteMemory && /* @__PURE__ */ jsx27(
|
|
5083
5066
|
Button,
|
|
5084
5067
|
{
|
|
5085
5068
|
variant: "ghost",
|
|
5086
5069
|
size: "icon",
|
|
5087
5070
|
className: "h-7 w-7",
|
|
5088
5071
|
onClick: () => onDeleteMemory(memory.id),
|
|
5089
|
-
children: /* @__PURE__ */
|
|
5072
|
+
children: /* @__PURE__ */ jsx27(Trash24, { className: "h-3.5 w-3.5 text-destructive" })
|
|
5090
5073
|
}
|
|
5091
5074
|
)
|
|
5092
5075
|
] })
|
|
@@ -5097,8 +5080,8 @@ var UserProfile = ({
|
|
|
5097
5080
|
}) })
|
|
5098
5081
|
] })
|
|
5099
5082
|
] }) }),
|
|
5100
|
-
/* @__PURE__ */
|
|
5101
|
-
onEditProfile && /* @__PURE__ */
|
|
5083
|
+
/* @__PURE__ */ jsxs17("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
5084
|
+
onEditProfile && /* @__PURE__ */ jsx27(
|
|
5102
5085
|
Button,
|
|
5103
5086
|
{
|
|
5104
5087
|
variant: "outline",
|
|
@@ -5107,7 +5090,7 @@ var UserProfile = ({
|
|
|
5107
5090
|
children: "Edit Profile"
|
|
5108
5091
|
}
|
|
5109
5092
|
),
|
|
5110
|
-
onLogout && /* @__PURE__ */
|
|
5093
|
+
onLogout && /* @__PURE__ */ jsx27(
|
|
5111
5094
|
Button,
|
|
5112
5095
|
{
|
|
5113
5096
|
variant: "destructive",
|
|
@@ -5122,37 +5105,31 @@ var UserProfile = ({
|
|
|
5122
5105
|
) });
|
|
5123
5106
|
};
|
|
5124
5107
|
|
|
5125
|
-
// src/
|
|
5126
|
-
|
|
5127
|
-
ArrowRight,
|
|
5128
|
-
HelpCircle,
|
|
5129
|
-
Lightbulb as Lightbulb2,
|
|
5130
|
-
MessageSquare,
|
|
5131
|
-
Sparkles as Sparkles2,
|
|
5132
|
-
Zap
|
|
5133
|
-
} from "lucide-react";
|
|
5134
|
-
import { jsx as jsx27, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
5135
|
-
function getMessageSpeakerKey(message) {
|
|
5108
|
+
// src/lib/messageGrouping.ts
|
|
5109
|
+
var getMessageSpeakerKey = (message) => {
|
|
5136
5110
|
if (!message) return null;
|
|
5137
|
-
if (message.
|
|
5138
|
-
return message.
|
|
5111
|
+
if (message.sender) {
|
|
5112
|
+
return `${message.sender.type}:${message.sender.id}`;
|
|
5139
5113
|
}
|
|
5140
5114
|
if (message.role === "user") {
|
|
5141
5115
|
return "user";
|
|
5142
5116
|
}
|
|
5143
5117
|
return message.role;
|
|
5144
|
-
}
|
|
5145
|
-
|
|
5118
|
+
};
|
|
5119
|
+
var getAssistantSpeakerTokens = (message) => {
|
|
5146
5120
|
if (!message || message.role !== "assistant") return [];
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5121
|
+
if (message.sender) {
|
|
5122
|
+
return Array.from(new Set([
|
|
5123
|
+
`${message.sender.type}:${message.sender.id}`,
|
|
5124
|
+
message.sender.agentId ? `agent:${message.sender.agentId}` : "",
|
|
5125
|
+
message.sender.externalId ? `external:${message.sender.externalId}` : ""
|
|
5126
|
+
].filter(Boolean).map((value) => value.toLowerCase())));
|
|
5152
5127
|
}
|
|
5153
5128
|
return ["assistant"];
|
|
5154
|
-
}
|
|
5155
|
-
|
|
5129
|
+
};
|
|
5130
|
+
var hasAssistantContent = (message) => message.role === "assistant" && (message.content.trim().length > 0 || Boolean(message.attachments?.length));
|
|
5131
|
+
var hasActivity = (message) => Boolean(message.activity?.items.length);
|
|
5132
|
+
var canGroupMessages = (previous, next) => {
|
|
5156
5133
|
if (previous.role !== next.role) {
|
|
5157
5134
|
return false;
|
|
5158
5135
|
}
|
|
@@ -5161,39 +5138,20 @@ function canGroupMessages(previous, next) {
|
|
|
5161
5138
|
}
|
|
5162
5139
|
const previousTokens = getAssistantSpeakerTokens(previous);
|
|
5163
5140
|
const nextTokens = getAssistantSpeakerTokens(next);
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
var mergeToolCalls = (activities) => {
|
|
5167
|
-
const merged = /* @__PURE__ */ new Map();
|
|
5168
|
-
for (const activity of activities) {
|
|
5169
|
-
if (!Array.isArray(activity.toolCalls)) continue;
|
|
5170
|
-
for (const toolCall of activity.toolCalls) {
|
|
5171
|
-
const key = toolCall.id || `${toolCall.name}:${JSON.stringify(toolCall.arguments ?? {})}`;
|
|
5172
|
-
merged.set(key, toolCall);
|
|
5173
|
-
}
|
|
5174
|
-
}
|
|
5175
|
-
return merged.size > 0 ? Array.from(merged.values()) : void 0;
|
|
5176
|
-
};
|
|
5177
|
-
var mergeReasoning = (activities) => {
|
|
5178
|
-
const segments = activities.map((activity) => activity.reasoning?.trim()).filter((value) => Boolean(value));
|
|
5179
|
-
if (segments.length === 0) return void 0;
|
|
5180
|
-
return segments.filter((segment, index) => index === 0 || segment !== segments[index - 1]).join("\n\n");
|
|
5141
|
+
if (!previousTokens.some((token) => nextTokens.includes(token))) return false;
|
|
5142
|
+
return !(hasAssistantContent(previous) && hasActivity(next));
|
|
5181
5143
|
};
|
|
5182
5144
|
var mergeGroupActivity = (messages) => {
|
|
5183
|
-
const
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
const mergedReasoning = mergeReasoning(activities);
|
|
5189
|
-
const mergedToolCalls = mergeToolCalls(activities);
|
|
5190
|
-
return {
|
|
5191
|
-
...lastActivity,
|
|
5192
|
-
...mergedReasoning ? { reasoning: mergedReasoning } : {},
|
|
5193
|
-
...mergedToolCalls ? { toolCalls: mergedToolCalls } : {}
|
|
5194
|
-
};
|
|
5145
|
+
const merged = /* @__PURE__ */ new Map();
|
|
5146
|
+
for (const activity of messages.map((message) => message.activity).filter((activity2) => Boolean(activity2))) {
|
|
5147
|
+
for (const item of activity.items) merged.set(item.id, item);
|
|
5148
|
+
}
|
|
5149
|
+
return merged.size > 0 ? { items: Array.from(merged.values()) } : void 0;
|
|
5195
5150
|
};
|
|
5196
5151
|
var mergeMessageGroup = (messages) => {
|
|
5152
|
+
if (messages.length === 1) {
|
|
5153
|
+
return messages[0];
|
|
5154
|
+
}
|
|
5197
5155
|
const firstMessage = messages[0];
|
|
5198
5156
|
const lastMessage = messages[messages.length - 1];
|
|
5199
5157
|
const content = messages.map((message) => message.content.trim()).filter((value) => value.length > 0).join("\n\n");
|
|
@@ -5210,8 +5168,7 @@ var mergeMessageGroup = (messages) => {
|
|
|
5210
5168
|
originalContent: void 0,
|
|
5211
5169
|
editedAt: lastMessage.editedAt,
|
|
5212
5170
|
activity: mergeGroupActivity(messages),
|
|
5213
|
-
|
|
5214
|
-
senderAgentId: lastMessage.senderAgentId ?? firstMessage.senderAgentId,
|
|
5171
|
+
sender: lastMessage.sender ?? firstMessage.sender,
|
|
5215
5172
|
metadata: lastMessage.metadata
|
|
5216
5173
|
};
|
|
5217
5174
|
};
|
|
@@ -5240,6 +5197,17 @@ var groupMessagesForRender = (messages) => {
|
|
|
5240
5197
|
flushGroup();
|
|
5241
5198
|
return groups;
|
|
5242
5199
|
};
|
|
5200
|
+
|
|
5201
|
+
// src/components/chat/ChatUI.tsx
|
|
5202
|
+
import {
|
|
5203
|
+
ArrowRight,
|
|
5204
|
+
HelpCircle,
|
|
5205
|
+
Lightbulb as Lightbulb2,
|
|
5206
|
+
MessageSquare,
|
|
5207
|
+
Sparkles as Sparkles2,
|
|
5208
|
+
Zap
|
|
5209
|
+
} from "lucide-react";
|
|
5210
|
+
import { jsx as jsx28, jsxs as jsxs18 } from "react/jsx-runtime";
|
|
5243
5211
|
var ChatUI = ({
|
|
5244
5212
|
messages = [],
|
|
5245
5213
|
threads = [],
|
|
@@ -5272,7 +5240,7 @@ var ChatUI = ({
|
|
|
5272
5240
|
initialInput,
|
|
5273
5241
|
onInitialInputConsumed
|
|
5274
5242
|
}) => {
|
|
5275
|
-
const config =
|
|
5243
|
+
const config = useMemo5(
|
|
5276
5244
|
() => mergeConfig(defaultChatConfig, userConfig),
|
|
5277
5245
|
[userConfig]
|
|
5278
5246
|
);
|
|
@@ -5306,14 +5274,14 @@ var ChatUI = ({
|
|
|
5306
5274
|
isSidebarCollapsed: false
|
|
5307
5275
|
// No longer used for main sidebar
|
|
5308
5276
|
});
|
|
5309
|
-
|
|
5277
|
+
useEffect10(() => {
|
|
5310
5278
|
if (currentThreadId !== state.selectedThreadId) {
|
|
5311
5279
|
setState((prev) => ({ ...prev, selectedThreadId: currentThreadId }));
|
|
5312
5280
|
}
|
|
5313
5281
|
}, [currentThreadId]);
|
|
5314
5282
|
const initialInputApplied = useRef6(false);
|
|
5315
5283
|
const initialInputConsumedRef = useRef6(false);
|
|
5316
|
-
|
|
5284
|
+
useEffect10(() => {
|
|
5317
5285
|
if (initialInput && !initialInputApplied.current) {
|
|
5318
5286
|
setInputValue(initialInput);
|
|
5319
5287
|
initialInputApplied.current = true;
|
|
@@ -5324,18 +5292,18 @@ var ChatUI = ({
|
|
|
5324
5292
|
const stateRef = useRef6(state);
|
|
5325
5293
|
const inputValueRef = useRef6(inputValue);
|
|
5326
5294
|
const attachmentsRef = useRef6(attachments);
|
|
5327
|
-
|
|
5295
|
+
useEffect10(() => {
|
|
5328
5296
|
stateRef.current = state;
|
|
5329
5297
|
}, [state]);
|
|
5330
|
-
|
|
5298
|
+
useEffect10(() => {
|
|
5331
5299
|
inputValueRef.current = inputValue;
|
|
5332
5300
|
}, [inputValue]);
|
|
5333
|
-
|
|
5301
|
+
useEffect10(() => {
|
|
5334
5302
|
attachmentsRef.current = attachments;
|
|
5335
5303
|
}, [attachments]);
|
|
5336
5304
|
const [isCustomMounted, setIsCustomMounted] = useState9(false);
|
|
5337
5305
|
const [isCustomVisible, setIsCustomVisible] = useState9(false);
|
|
5338
|
-
const groupedMessages =
|
|
5306
|
+
const groupedMessages = useMemo5(() => groupMessagesForRender(messages), [
|
|
5339
5307
|
messages
|
|
5340
5308
|
]);
|
|
5341
5309
|
const virtualizer = useVirtualizer({
|
|
@@ -5357,7 +5325,7 @@ var ChatUI = ({
|
|
|
5357
5325
|
[]
|
|
5358
5326
|
// No dependencies - uses refs for latest state
|
|
5359
5327
|
);
|
|
5360
|
-
|
|
5328
|
+
useEffect10(() => {
|
|
5361
5329
|
const checkMobile = () => {
|
|
5362
5330
|
setIsMobile(globalThis.innerWidth < 1024);
|
|
5363
5331
|
};
|
|
@@ -5365,7 +5333,7 @@ var ChatUI = ({
|
|
|
5365
5333
|
globalThis.addEventListener("resize", checkMobile);
|
|
5366
5334
|
return () => globalThis.removeEventListener("resize", checkMobile);
|
|
5367
5335
|
}, []);
|
|
5368
|
-
|
|
5336
|
+
useEffect10(() => {
|
|
5369
5337
|
if (!isMobile || !config.customComponent?.component) return;
|
|
5370
5338
|
if (state.showSidebar) {
|
|
5371
5339
|
setIsCustomMounted(true);
|
|
@@ -5377,7 +5345,7 @@ var ChatUI = ({
|
|
|
5377
5345
|
}
|
|
5378
5346
|
}, [state.showSidebar, isMobile, config.customComponent]);
|
|
5379
5347
|
const prevMessageCountRef = useRef6(0);
|
|
5380
|
-
|
|
5348
|
+
useEffect10(() => {
|
|
5381
5349
|
if (groupedMessages.length === 0) {
|
|
5382
5350
|
prevMessageCountRef.current = 0;
|
|
5383
5351
|
return;
|
|
@@ -5409,7 +5377,7 @@ var ChatUI = ({
|
|
|
5409
5377
|
}
|
|
5410
5378
|
});
|
|
5411
5379
|
}, [groupedMessages, state.isAtBottom, virtualizer]);
|
|
5412
|
-
|
|
5380
|
+
useEffect10(() => {
|
|
5413
5381
|
const viewport = scrollAreaRef.current;
|
|
5414
5382
|
if (!viewport) return;
|
|
5415
5383
|
let rafId;
|
|
@@ -5433,10 +5401,10 @@ var ChatUI = ({
|
|
|
5433
5401
|
ro.disconnect();
|
|
5434
5402
|
};
|
|
5435
5403
|
}, [virtualizer]);
|
|
5436
|
-
|
|
5404
|
+
useEffect10(() => {
|
|
5437
5405
|
prependSnapshotRef.current = null;
|
|
5438
5406
|
}, [currentThreadId]);
|
|
5439
|
-
|
|
5407
|
+
useEffect10(() => {
|
|
5440
5408
|
const snapshot = prependSnapshotRef.current;
|
|
5441
5409
|
if (!snapshot) return;
|
|
5442
5410
|
if (groupedMessages.length <= snapshot.messageCount) {
|
|
@@ -5478,7 +5446,7 @@ var ChatUI = ({
|
|
|
5478
5446
|
isLoadingOlderMessages,
|
|
5479
5447
|
onLoadOlderMessages
|
|
5480
5448
|
]);
|
|
5481
|
-
|
|
5449
|
+
useEffect10(() => {
|
|
5482
5450
|
const validMessageIds = new Set(groupedMessages.map((group) => group.id));
|
|
5483
5451
|
setExpandedMessageIds((prev) => {
|
|
5484
5452
|
const activeIds = Object.keys(prev);
|
|
@@ -5581,7 +5549,7 @@ var ChatUI = ({
|
|
|
5581
5549
|
const handleCustomComponentToggle = useCallback4(() => {
|
|
5582
5550
|
setState((prev) => ({ ...prev, showSidebar: !prev.showSidebar }));
|
|
5583
5551
|
}, []);
|
|
5584
|
-
const sidebarUser =
|
|
5552
|
+
const sidebarUser = useMemo5(() => user ? {
|
|
5585
5553
|
id: user.id,
|
|
5586
5554
|
name: user.name,
|
|
5587
5555
|
email: user.email,
|
|
@@ -5591,7 +5559,7 @@ var ChatUI = ({
|
|
|
5591
5559
|
setIsUserProfileOpen(true);
|
|
5592
5560
|
callbacks.onViewProfile?.();
|
|
5593
5561
|
}, [callbacks.onViewProfile]);
|
|
5594
|
-
const sidebarUserMenuCallbacks =
|
|
5562
|
+
const sidebarUserMenuCallbacks = useMemo5(() => ({
|
|
5595
5563
|
onViewProfile: handleViewProfile,
|
|
5596
5564
|
onOpenSettings: callbacks.onOpenSettings,
|
|
5597
5565
|
onThemeChange: callbacks.onThemeChange,
|
|
@@ -5613,13 +5581,13 @@ var ChatUI = ({
|
|
|
5613
5581
|
const SuggestionIconComponents = [MessageSquare, Lightbulb2, Zap, HelpCircle];
|
|
5614
5582
|
const renderSuggestions = () => {
|
|
5615
5583
|
if (groupedMessages.length > 0 || !suggestions.length) return null;
|
|
5616
|
-
return /* @__PURE__ */
|
|
5617
|
-
/* @__PURE__ */
|
|
5618
|
-
/* @__PURE__ */
|
|
5619
|
-
/* @__PURE__ */
|
|
5620
|
-
/* @__PURE__ */
|
|
5584
|
+
return /* @__PURE__ */ jsxs18("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
5585
|
+
/* @__PURE__ */ jsxs18("div", { className: "text-center mb-8", children: [
|
|
5586
|
+
/* @__PURE__ */ jsx28("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__ */ jsx28(Sparkles2, { className: "w-7 h-7 text-primary" }) }),
|
|
5587
|
+
/* @__PURE__ */ jsx28("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
5588
|
+
/* @__PURE__ */ jsx28("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
5621
5589
|
] }),
|
|
5622
|
-
/* @__PURE__ */
|
|
5590
|
+
/* @__PURE__ */ jsx28("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs18(
|
|
5623
5591
|
"button",
|
|
5624
5592
|
{
|
|
5625
5593
|
type: "button",
|
|
@@ -5628,10 +5596,10 @@ var ChatUI = ({
|
|
|
5628
5596
|
children: [
|
|
5629
5597
|
(() => {
|
|
5630
5598
|
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
5631
|
-
return /* @__PURE__ */
|
|
5599
|
+
return /* @__PURE__ */ jsx28("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__ */ jsx28(IconComponent, { className: "h-4 w-4" }) });
|
|
5632
5600
|
})(),
|
|
5633
|
-
/* @__PURE__ */
|
|
5634
|
-
/* @__PURE__ */
|
|
5601
|
+
/* @__PURE__ */ jsx28("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx28("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
|
|
5602
|
+
/* @__PURE__ */ jsx28(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" })
|
|
5635
5603
|
]
|
|
5636
5604
|
},
|
|
5637
5605
|
index
|
|
@@ -5642,19 +5610,19 @@ var ChatUI = ({
|
|
|
5642
5610
|
const items = messageSuggestions?.[messageId];
|
|
5643
5611
|
if (!items || items.length === 0) return null;
|
|
5644
5612
|
const inlineSuggestionOffsetClass = config.ui.showAvatars ? config.ui.compactMode ? "ml-9" : "ml-11" : "";
|
|
5645
|
-
return /* @__PURE__ */
|
|
5613
|
+
return /* @__PURE__ */ jsx28(
|
|
5646
5614
|
"div",
|
|
5647
5615
|
{
|
|
5648
5616
|
className: `flex flex-wrap gap-2 mt-2 ${inlineSuggestionOffsetClass}`,
|
|
5649
|
-
children: items.map((suggestion, index) => /* @__PURE__ */
|
|
5617
|
+
children: items.map((suggestion, index) => /* @__PURE__ */ jsxs18(
|
|
5650
5618
|
"button",
|
|
5651
5619
|
{
|
|
5652
5620
|
type: "button",
|
|
5653
5621
|
onClick: () => handleSendMessage(suggestion),
|
|
5654
5622
|
className: "group inline-flex items-center gap-1.5 px-3 py-1.5 text-sm rounded-full border border-border bg-background hover:bg-accent hover:border-accent-foreground/20 transition-all duration-150 text-foreground/80 hover:text-foreground",
|
|
5655
5623
|
children: [
|
|
5656
|
-
/* @__PURE__ */
|
|
5657
|
-
/* @__PURE__ */
|
|
5624
|
+
/* @__PURE__ */ jsx28(Sparkles2, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
5625
|
+
/* @__PURE__ */ jsx28("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
5658
5626
|
]
|
|
5659
5627
|
},
|
|
5660
5628
|
`${messageId}-suggestion-${index}`
|
|
@@ -5662,27 +5630,27 @@ var ChatUI = ({
|
|
|
5662
5630
|
}
|
|
5663
5631
|
);
|
|
5664
5632
|
};
|
|
5665
|
-
const renderMessageLoadingSkeleton = () => /* @__PURE__ */
|
|
5633
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx28("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
5666
5634
|
const isUserRow = index % 2 === 1;
|
|
5667
|
-
return /* @__PURE__ */
|
|
5635
|
+
return /* @__PURE__ */ jsxs18(
|
|
5668
5636
|
"div",
|
|
5669
5637
|
{
|
|
5670
5638
|
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
5671
5639
|
children: [
|
|
5672
|
-
!isUserRow && /* @__PURE__ */
|
|
5673
|
-
/* @__PURE__ */
|
|
5674
|
-
/* @__PURE__ */
|
|
5675
|
-
/* @__PURE__ */
|
|
5676
|
-
/* @__PURE__ */
|
|
5640
|
+
!isUserRow && /* @__PURE__ */ jsx28(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
5641
|
+
/* @__PURE__ */ jsxs18("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
5642
|
+
/* @__PURE__ */ jsx28(Skeleton, { className: "h-4 w-24" }),
|
|
5643
|
+
/* @__PURE__ */ jsx28(Skeleton, { className: "h-4 w-full" }),
|
|
5644
|
+
/* @__PURE__ */ jsx28(Skeleton, { className: "h-4 w-[85%]" })
|
|
5677
5645
|
] }),
|
|
5678
|
-
isUserRow && /* @__PURE__ */
|
|
5646
|
+
isUserRow && /* @__PURE__ */ jsx28(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
5679
5647
|
]
|
|
5680
5648
|
},
|
|
5681
5649
|
`message-skeleton-${index}`
|
|
5682
5650
|
);
|
|
5683
5651
|
}) });
|
|
5684
5652
|
const isMultiAgentMode = config.agentSelector?.mode === "multi";
|
|
5685
|
-
const messageProps =
|
|
5653
|
+
const messageProps = useMemo5(() => ({
|
|
5686
5654
|
userAvatar: user?.avatar,
|
|
5687
5655
|
userName: user?.name,
|
|
5688
5656
|
assistantAvatar: assistant?.avatar,
|
|
@@ -5692,7 +5660,8 @@ var ChatUI = ({
|
|
|
5692
5660
|
enableCopy: config.features.enableMessageCopy,
|
|
5693
5661
|
enableEdit: config.features.enableMessageEditing,
|
|
5694
5662
|
enableRegenerate: config.features.enableRegeneration,
|
|
5695
|
-
|
|
5663
|
+
showActivity: config.features.showActivity,
|
|
5664
|
+
showActivityDetails: config.features.showActivityDetails,
|
|
5696
5665
|
compactMode: config.ui.compactMode,
|
|
5697
5666
|
onAction: handleMessageAction,
|
|
5698
5667
|
labels: config.labels,
|
|
@@ -5704,22 +5673,20 @@ var ChatUI = ({
|
|
|
5704
5673
|
longMessageChunkChars: config.ui.longMessageChunkChars,
|
|
5705
5674
|
renderUserMarkdown: config.ui.renderUserMarkdown,
|
|
5706
5675
|
markdown: config.markdown,
|
|
5707
|
-
onToggleExpanded: handleToggleMessageExpansion
|
|
5708
|
-
agentOptions: isMultiAgentMode ? agentOptions : void 0
|
|
5676
|
+
onToggleExpanded: handleToggleMessageExpansion
|
|
5709
5677
|
}), [
|
|
5710
5678
|
user?.avatar,
|
|
5711
5679
|
user?.name,
|
|
5712
5680
|
assistant?.avatar,
|
|
5713
5681
|
assistant?.name,
|
|
5714
|
-
isMultiAgentMode,
|
|
5715
|
-
agentOptions,
|
|
5716
5682
|
config.ui.showTimestamps,
|
|
5717
5683
|
config.ui.showAvatars,
|
|
5718
5684
|
config.ui.compactMode,
|
|
5719
5685
|
config.features.enableMessageCopy,
|
|
5720
5686
|
config.features.enableMessageEditing,
|
|
5721
5687
|
config.features.enableRegeneration,
|
|
5722
|
-
config.features.
|
|
5688
|
+
config.features.showActivity,
|
|
5689
|
+
config.features.showActivityDetails,
|
|
5723
5690
|
config.labels,
|
|
5724
5691
|
config.labels.showMoreMessage,
|
|
5725
5692
|
config.labels.showLessMessage,
|
|
@@ -5735,12 +5702,12 @@ var ChatUI = ({
|
|
|
5735
5702
|
const shouldShowAgentSelector = Boolean(
|
|
5736
5703
|
config.agentSelector?.enabled && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1) && (isMultiAgentMode ? onParticipantsChange : onSelectAgent)
|
|
5737
5704
|
);
|
|
5738
|
-
return /* @__PURE__ */
|
|
5705
|
+
return /* @__PURE__ */ jsx28(TooltipProvider, { children: /* @__PURE__ */ jsx28(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs18(
|
|
5739
5706
|
"div",
|
|
5740
5707
|
{
|
|
5741
|
-
className: `flex h-[
|
|
5708
|
+
className: `flex h-[100dvh] bg-background w-full overflow-hidden ${className}`,
|
|
5742
5709
|
children: [
|
|
5743
|
-
/* @__PURE__ */
|
|
5710
|
+
/* @__PURE__ */ jsx28(
|
|
5744
5711
|
Sidebar2,
|
|
5745
5712
|
{
|
|
5746
5713
|
threads,
|
|
@@ -5759,8 +5726,8 @@ var ChatUI = ({
|
|
|
5759
5726
|
userMenuAdditionalItems
|
|
5760
5727
|
}
|
|
5761
5728
|
),
|
|
5762
|
-
/* @__PURE__ */
|
|
5763
|
-
/* @__PURE__ */
|
|
5729
|
+
/* @__PURE__ */ jsx28(SidebarInset, { children: /* @__PURE__ */ jsxs18("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
5730
|
+
/* @__PURE__ */ jsx28(
|
|
5764
5731
|
ChatHeader,
|
|
5765
5732
|
{
|
|
5766
5733
|
config,
|
|
@@ -5780,9 +5747,9 @@ var ChatUI = ({
|
|
|
5780
5747
|
onParticipantsChange
|
|
5781
5748
|
}
|
|
5782
5749
|
),
|
|
5783
|
-
/* @__PURE__ */
|
|
5784
|
-
/* @__PURE__ */
|
|
5785
|
-
/* @__PURE__ */
|
|
5750
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
5751
|
+
/* @__PURE__ */ jsxs18("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
5752
|
+
/* @__PURE__ */ jsx28(
|
|
5786
5753
|
ScrollArea,
|
|
5787
5754
|
{
|
|
5788
5755
|
ref: scrollAreaRef,
|
|
@@ -5790,8 +5757,8 @@ var ChatUI = ({
|
|
|
5790
5757
|
viewportClassName: "p-4 overscroll-contain",
|
|
5791
5758
|
onScrollCapture: handleScroll,
|
|
5792
5759
|
style: { contain: "content" },
|
|
5793
|
-
children: /* @__PURE__ */
|
|
5794
|
-
groupedMessages.length > 0 && /* @__PURE__ */
|
|
5760
|
+
children: /* @__PURE__ */ jsxs18("div", { className: "max-w-4xl mx-auto pb-4", children: [
|
|
5761
|
+
groupedMessages.length > 0 && /* @__PURE__ */ jsx28("div", { className: "flex justify-center py-2", children: isLoadingOlderMessages ? /* @__PURE__ */ jsx28("span", { className: "text-xs text-muted-foreground", children: config.labels.loadingOlderMessages }) : hasMoreMessagesBefore ? /* @__PURE__ */ jsx28(
|
|
5795
5762
|
"button",
|
|
5796
5763
|
{
|
|
5797
5764
|
type: "button",
|
|
@@ -5800,7 +5767,7 @@ var ChatUI = ({
|
|
|
5800
5767
|
children: config.labels.loadOlderMessages
|
|
5801
5768
|
}
|
|
5802
5769
|
) : null }),
|
|
5803
|
-
isMessagesLoading ? renderMessageLoadingSkeleton() : groupedMessages.length === 0 ? renderSuggestions() : /* @__PURE__ */
|
|
5770
|
+
isMessagesLoading ? renderMessageLoadingSkeleton() : groupedMessages.length === 0 ? renderSuggestions() : /* @__PURE__ */ jsx28(
|
|
5804
5771
|
"div",
|
|
5805
5772
|
{
|
|
5806
5773
|
style: {
|
|
@@ -5811,7 +5778,7 @@ var ChatUI = ({
|
|
|
5811
5778
|
children: virtualizer.getVirtualItems().map((virtualRow) => {
|
|
5812
5779
|
const group = groupedMessages[virtualRow.index];
|
|
5813
5780
|
const message = group.message;
|
|
5814
|
-
return /* @__PURE__ */
|
|
5781
|
+
return /* @__PURE__ */ jsx28(
|
|
5815
5782
|
"div",
|
|
5816
5783
|
{
|
|
5817
5784
|
"data-index": virtualRow.index,
|
|
@@ -5823,12 +5790,12 @@ var ChatUI = ({
|
|
|
5823
5790
|
width: "100%",
|
|
5824
5791
|
transform: `translateY(${virtualRow.start}px)`
|
|
5825
5792
|
},
|
|
5826
|
-
children: /* @__PURE__ */
|
|
5793
|
+
children: /* @__PURE__ */ jsxs18(
|
|
5827
5794
|
"div",
|
|
5828
5795
|
{
|
|
5829
5796
|
className: virtualRow.index === 0 ? "" : "pt-4",
|
|
5830
5797
|
children: [
|
|
5831
|
-
/* @__PURE__ */
|
|
5798
|
+
/* @__PURE__ */ jsx28(
|
|
5832
5799
|
Message,
|
|
5833
5800
|
{
|
|
5834
5801
|
message,
|
|
@@ -5853,8 +5820,8 @@ var ChatUI = ({
|
|
|
5853
5820
|
] })
|
|
5854
5821
|
}
|
|
5855
5822
|
),
|
|
5856
|
-
/* @__PURE__ */
|
|
5857
|
-
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */
|
|
5823
|
+
/* @__PURE__ */ jsxs18("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: [
|
|
5824
|
+
isMultiAgentMode && shouldShowAgentSelector && onTargetAgentChange && /* @__PURE__ */ jsx28("div", { className: "px-4 pt-1", children: /* @__PURE__ */ jsx28(
|
|
5858
5825
|
TargetAgentSelector,
|
|
5859
5826
|
{
|
|
5860
5827
|
agents: participantIds && participantIds.length > 0 ? agentOptions.filter(
|
|
@@ -5866,7 +5833,7 @@ var ChatUI = ({
|
|
|
5866
5833
|
disabled: isGenerating
|
|
5867
5834
|
}
|
|
5868
5835
|
) }),
|
|
5869
|
-
/* @__PURE__ */
|
|
5836
|
+
/* @__PURE__ */ jsx28(
|
|
5870
5837
|
ChatInput,
|
|
5871
5838
|
{
|
|
5872
5839
|
value: inputValue,
|
|
@@ -5897,14 +5864,14 @@ var ChatUI = ({
|
|
|
5897
5864
|
)
|
|
5898
5865
|
] })
|
|
5899
5866
|
] }),
|
|
5900
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */
|
|
5867
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx28(
|
|
5901
5868
|
"div",
|
|
5902
5869
|
{
|
|
5903
5870
|
className: "h-full transition-all duration-300 ease-in-out overflow-hidden",
|
|
5904
5871
|
style: {
|
|
5905
5872
|
width: state.showSidebar ? config.customComponent.panelWidth ?? 320 : 0
|
|
5906
5873
|
},
|
|
5907
|
-
children: state.showSidebar && /* @__PURE__ */
|
|
5874
|
+
children: state.showSidebar && /* @__PURE__ */ jsx28(
|
|
5908
5875
|
"div",
|
|
5909
5876
|
{
|
|
5910
5877
|
className: "h-full overflow-hidden border-l bg-background animate-in slide-in-from-right-4 duration-300",
|
|
@@ -5918,8 +5885,8 @@ var ChatUI = ({
|
|
|
5918
5885
|
)
|
|
5919
5886
|
] })
|
|
5920
5887
|
] }) }),
|
|
5921
|
-
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */
|
|
5922
|
-
/* @__PURE__ */
|
|
5888
|
+
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs18("div", { className: "fixed inset-0 z-50", children: [
|
|
5889
|
+
/* @__PURE__ */ jsx28(
|
|
5923
5890
|
"div",
|
|
5924
5891
|
{
|
|
5925
5892
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -5927,16 +5894,16 @@ var ChatUI = ({
|
|
|
5927
5894
|
onClick: closeSidebar
|
|
5928
5895
|
}
|
|
5929
5896
|
),
|
|
5930
|
-
/* @__PURE__ */
|
|
5897
|
+
/* @__PURE__ */ jsx28(
|
|
5931
5898
|
"div",
|
|
5932
5899
|
{
|
|
5933
5900
|
className: `absolute top-0 right-0 h-full w-full bg-background transform-gpu transition-transform duration-200 ease-out ${isCustomVisible ? "translate-x-0" : "translate-x-full"}`,
|
|
5934
5901
|
style: { willChange: "transform" },
|
|
5935
|
-
children: /* @__PURE__ */
|
|
5902
|
+
children: /* @__PURE__ */ jsx28("div", { className: "h-full overflow-hidden", children: renderCustomComponent() })
|
|
5936
5903
|
}
|
|
5937
5904
|
)
|
|
5938
5905
|
] }),
|
|
5939
|
-
isUserProfileOpen && /* @__PURE__ */
|
|
5906
|
+
isUserProfileOpen && /* @__PURE__ */ jsx28(
|
|
5940
5907
|
UserProfile,
|
|
5941
5908
|
{
|
|
5942
5909
|
isOpen: isUserProfileOpen,
|
|
@@ -5963,8 +5930,10 @@ export {
|
|
|
5963
5930
|
AssistantActivity,
|
|
5964
5931
|
ChatUI,
|
|
5965
5932
|
ChatUserContextProvider,
|
|
5933
|
+
MessageSenderAvatar,
|
|
5966
5934
|
defaultChatConfig,
|
|
5967
5935
|
mergeConfig,
|
|
5936
|
+
resolveMessageSenderDisplay,
|
|
5968
5937
|
useChatUserContext
|
|
5969
5938
|
};
|
|
5970
5939
|
//# sourceMappingURL=index.js.map
|