@copilotz/chat-ui 0.1.1 → 0.1.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 +599 -555
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +462 -418
- package/dist/index.js.map +1 -1
- package/dist/styles.css +9 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// src/components/chat/ChatUI.tsx
|
|
2
|
-
import { useState as useState8, useEffect as useEffect10, useRef as useRef7, useCallback as useCallback4 } from "react";
|
|
2
|
+
import { useState as useState8, useEffect as useEffect10, useRef as useRef7, useCallback as useCallback4, useMemo as useMemo3 } from "react";
|
|
3
3
|
|
|
4
4
|
// src/config/chatConfig.ts
|
|
5
5
|
var defaultChatConfig = {
|
|
@@ -736,27 +736,7 @@ var ToolCallsDisplay = memo(function ToolCallsDisplay2({ toolCalls, label }) {
|
|
|
736
736
|
] });
|
|
737
737
|
});
|
|
738
738
|
var arePropsEqual = (prevProps, nextProps) => {
|
|
739
|
-
if (prevProps.message
|
|
740
|
-
if (prevProps.message.content !== nextProps.message.content) return false;
|
|
741
|
-
if (prevProps.message.isStreaming !== nextProps.message.isStreaming) return false;
|
|
742
|
-
if (prevProps.message.isComplete !== nextProps.message.isComplete) return false;
|
|
743
|
-
if (prevProps.message.isEdited !== nextProps.message.isEdited) return false;
|
|
744
|
-
if (prevProps.message.timestamp !== nextProps.message.timestamp) return false;
|
|
745
|
-
if (prevProps.message.toolCalls !== nextProps.message.toolCalls) {
|
|
746
|
-
const prevCalls = prevProps.message.toolCalls;
|
|
747
|
-
const nextCalls = nextProps.message.toolCalls;
|
|
748
|
-
if (!prevCalls || !nextCalls || prevCalls.length !== nextCalls.length) return false;
|
|
749
|
-
for (let i = 0; i < prevCalls.length; i++) {
|
|
750
|
-
if (prevCalls[i].id !== nextCalls[i].id || prevCalls[i].status !== nextCalls[i].status || prevCalls[i].result !== nextCalls[i].result) {
|
|
751
|
-
return false;
|
|
752
|
-
}
|
|
753
|
-
}
|
|
754
|
-
}
|
|
755
|
-
if (prevProps.message.attachments !== nextProps.message.attachments) {
|
|
756
|
-
const prevAtt = prevProps.message.attachments;
|
|
757
|
-
const nextAtt = nextProps.message.attachments;
|
|
758
|
-
if (!prevAtt || !nextAtt || prevAtt.length !== nextAtt.length) return false;
|
|
759
|
-
}
|
|
739
|
+
if (prevProps.message !== nextProps.message) return false;
|
|
760
740
|
if (prevProps.isUser !== nextProps.isUser) return false;
|
|
761
741
|
if (prevProps.userAvatar !== nextProps.userAvatar) return false;
|
|
762
742
|
if (prevProps.userName !== nextProps.userName) return false;
|
|
@@ -1123,8 +1103,21 @@ function SheetDescription({
|
|
|
1123
1103
|
);
|
|
1124
1104
|
}
|
|
1125
1105
|
|
|
1106
|
+
// src/components/ui/skeleton.tsx
|
|
1107
|
+
import { jsx as jsx11 } from "react/jsx-runtime";
|
|
1108
|
+
function Skeleton({ className, ...props }) {
|
|
1109
|
+
return /* @__PURE__ */ jsx11(
|
|
1110
|
+
"div",
|
|
1111
|
+
{
|
|
1112
|
+
"data-slot": "skeleton",
|
|
1113
|
+
className: cn("bg-accent animate-pulse rounded-md", className),
|
|
1114
|
+
...props
|
|
1115
|
+
}
|
|
1116
|
+
);
|
|
1117
|
+
}
|
|
1118
|
+
|
|
1126
1119
|
// src/components/ui/sidebar.tsx
|
|
1127
|
-
import { jsx as
|
|
1120
|
+
import { jsx as jsx12, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
1128
1121
|
var SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
1129
1122
|
var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
1130
1123
|
var SIDEBAR_WIDTH = "16rem";
|
|
@@ -1190,7 +1183,7 @@ function SidebarProvider({
|
|
|
1190
1183
|
}),
|
|
1191
1184
|
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
1192
1185
|
);
|
|
1193
|
-
return /* @__PURE__ */
|
|
1186
|
+
return /* @__PURE__ */ jsx12(SidebarContext.Provider, { value: contextValue, children: /* @__PURE__ */ jsx12(TooltipProvider, { delayDuration: 0, children: /* @__PURE__ */ jsx12(
|
|
1194
1187
|
"div",
|
|
1195
1188
|
{
|
|
1196
1189
|
"data-slot": "sidebar-wrapper",
|
|
@@ -1218,7 +1211,7 @@ function Sidebar({
|
|
|
1218
1211
|
}) {
|
|
1219
1212
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
1220
1213
|
if (collapsible === "none") {
|
|
1221
|
-
return /* @__PURE__ */
|
|
1214
|
+
return /* @__PURE__ */ jsx12(
|
|
1222
1215
|
"div",
|
|
1223
1216
|
{
|
|
1224
1217
|
"data-slot": "sidebar",
|
|
@@ -1232,7 +1225,7 @@ function Sidebar({
|
|
|
1232
1225
|
);
|
|
1233
1226
|
}
|
|
1234
1227
|
if (isMobile) {
|
|
1235
|
-
return /* @__PURE__ */
|
|
1228
|
+
return /* @__PURE__ */ jsx12(Sheet, { open: openMobile, onOpenChange: setOpenMobile, ...props, children: /* @__PURE__ */ jsxs4(
|
|
1236
1229
|
SheetContent,
|
|
1237
1230
|
{
|
|
1238
1231
|
"data-sidebar": "sidebar",
|
|
@@ -1245,10 +1238,10 @@ function Sidebar({
|
|
|
1245
1238
|
side,
|
|
1246
1239
|
children: [
|
|
1247
1240
|
/* @__PURE__ */ jsxs4(SheetHeader, { className: "sr-only", children: [
|
|
1248
|
-
/* @__PURE__ */
|
|
1249
|
-
/* @__PURE__ */
|
|
1241
|
+
/* @__PURE__ */ jsx12(SheetTitle, { children: "Sidebar" }),
|
|
1242
|
+
/* @__PURE__ */ jsx12(SheetDescription, { children: "Displays the mobile sidebar." })
|
|
1250
1243
|
] }),
|
|
1251
|
-
/* @__PURE__ */
|
|
1244
|
+
/* @__PURE__ */ jsx12("div", { className: "flex h-full w-full flex-col", children })
|
|
1252
1245
|
]
|
|
1253
1246
|
}
|
|
1254
1247
|
) });
|
|
@@ -1263,7 +1256,7 @@ function Sidebar({
|
|
|
1263
1256
|
"data-side": side,
|
|
1264
1257
|
"data-slot": "sidebar",
|
|
1265
1258
|
children: [
|
|
1266
|
-
/* @__PURE__ */
|
|
1259
|
+
/* @__PURE__ */ jsx12(
|
|
1267
1260
|
"div",
|
|
1268
1261
|
{
|
|
1269
1262
|
"data-slot": "sidebar-gap",
|
|
@@ -1275,7 +1268,7 @@ function Sidebar({
|
|
|
1275
1268
|
)
|
|
1276
1269
|
}
|
|
1277
1270
|
),
|
|
1278
|
-
/* @__PURE__ */
|
|
1271
|
+
/* @__PURE__ */ jsx12(
|
|
1279
1272
|
"div",
|
|
1280
1273
|
{
|
|
1281
1274
|
"data-slot": "sidebar-container",
|
|
@@ -1287,7 +1280,7 @@ function Sidebar({
|
|
|
1287
1280
|
className
|
|
1288
1281
|
),
|
|
1289
1282
|
...props,
|
|
1290
|
-
children: /* @__PURE__ */
|
|
1283
|
+
children: /* @__PURE__ */ jsx12(
|
|
1291
1284
|
"div",
|
|
1292
1285
|
{
|
|
1293
1286
|
"data-sidebar": "sidebar",
|
|
@@ -1322,15 +1315,15 @@ function SidebarTrigger({
|
|
|
1322
1315
|
},
|
|
1323
1316
|
...props,
|
|
1324
1317
|
children: [
|
|
1325
|
-
/* @__PURE__ */
|
|
1326
|
-
/* @__PURE__ */
|
|
1318
|
+
/* @__PURE__ */ jsx12(PanelLeftIcon, {}),
|
|
1319
|
+
/* @__PURE__ */ jsx12("span", { className: "sr-only", children: "Toggle Sidebar" })
|
|
1327
1320
|
]
|
|
1328
1321
|
}
|
|
1329
1322
|
);
|
|
1330
1323
|
}
|
|
1331
1324
|
function SidebarRail({ className, ...props }) {
|
|
1332
1325
|
const { toggleSidebar } = useSidebar();
|
|
1333
|
-
return /* @__PURE__ */
|
|
1326
|
+
return /* @__PURE__ */ jsx12(
|
|
1334
1327
|
"button",
|
|
1335
1328
|
{
|
|
1336
1329
|
"data-sidebar": "rail",
|
|
@@ -1353,7 +1346,7 @@ function SidebarRail({ className, ...props }) {
|
|
|
1353
1346
|
);
|
|
1354
1347
|
}
|
|
1355
1348
|
function SidebarInset({ className, ...props }) {
|
|
1356
|
-
return /* @__PURE__ */
|
|
1349
|
+
return /* @__PURE__ */ jsx12(
|
|
1357
1350
|
"main",
|
|
1358
1351
|
{
|
|
1359
1352
|
"data-slot": "sidebar-inset",
|
|
@@ -1367,7 +1360,7 @@ function SidebarInset({ className, ...props }) {
|
|
|
1367
1360
|
);
|
|
1368
1361
|
}
|
|
1369
1362
|
function SidebarHeader({ className, ...props }) {
|
|
1370
|
-
return /* @__PURE__ */
|
|
1363
|
+
return /* @__PURE__ */ jsx12(
|
|
1371
1364
|
"div",
|
|
1372
1365
|
{
|
|
1373
1366
|
"data-slot": "sidebar-header",
|
|
@@ -1378,7 +1371,7 @@ function SidebarHeader({ className, ...props }) {
|
|
|
1378
1371
|
);
|
|
1379
1372
|
}
|
|
1380
1373
|
function SidebarFooter({ className, ...props }) {
|
|
1381
|
-
return /* @__PURE__ */
|
|
1374
|
+
return /* @__PURE__ */ jsx12(
|
|
1382
1375
|
"div",
|
|
1383
1376
|
{
|
|
1384
1377
|
"data-slot": "sidebar-footer",
|
|
@@ -1389,7 +1382,7 @@ function SidebarFooter({ className, ...props }) {
|
|
|
1389
1382
|
);
|
|
1390
1383
|
}
|
|
1391
1384
|
function SidebarContent({ className, ...props }) {
|
|
1392
|
-
return /* @__PURE__ */
|
|
1385
|
+
return /* @__PURE__ */ jsx12(
|
|
1393
1386
|
"div",
|
|
1394
1387
|
{
|
|
1395
1388
|
"data-slot": "sidebar-content",
|
|
@@ -1403,7 +1396,7 @@ function SidebarContent({ className, ...props }) {
|
|
|
1403
1396
|
);
|
|
1404
1397
|
}
|
|
1405
1398
|
function SidebarGroup({ className, ...props }) {
|
|
1406
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ jsx12(
|
|
1407
1400
|
"div",
|
|
1408
1401
|
{
|
|
1409
1402
|
"data-slot": "sidebar-group",
|
|
@@ -1419,7 +1412,7 @@ function SidebarGroupLabel({
|
|
|
1419
1412
|
...props
|
|
1420
1413
|
}) {
|
|
1421
1414
|
const Comp = asChild ? Slot3 : "div";
|
|
1422
|
-
return /* @__PURE__ */
|
|
1415
|
+
return /* @__PURE__ */ jsx12(
|
|
1423
1416
|
Comp,
|
|
1424
1417
|
{
|
|
1425
1418
|
"data-slot": "sidebar-group-label",
|
|
@@ -1437,7 +1430,7 @@ function SidebarGroupContent({
|
|
|
1437
1430
|
className,
|
|
1438
1431
|
...props
|
|
1439
1432
|
}) {
|
|
1440
|
-
return /* @__PURE__ */
|
|
1433
|
+
return /* @__PURE__ */ jsx12(
|
|
1441
1434
|
"div",
|
|
1442
1435
|
{
|
|
1443
1436
|
"data-slot": "sidebar-group-content",
|
|
@@ -1448,7 +1441,7 @@ function SidebarGroupContent({
|
|
|
1448
1441
|
);
|
|
1449
1442
|
}
|
|
1450
1443
|
function SidebarMenu({ className, ...props }) {
|
|
1451
|
-
return /* @__PURE__ */
|
|
1444
|
+
return /* @__PURE__ */ jsx12(
|
|
1452
1445
|
"ul",
|
|
1453
1446
|
{
|
|
1454
1447
|
"data-slot": "sidebar-menu",
|
|
@@ -1459,7 +1452,7 @@ function SidebarMenu({ className, ...props }) {
|
|
|
1459
1452
|
);
|
|
1460
1453
|
}
|
|
1461
1454
|
function SidebarMenuItem({ className, ...props }) {
|
|
1462
|
-
return /* @__PURE__ */
|
|
1455
|
+
return /* @__PURE__ */ jsx12(
|
|
1463
1456
|
"li",
|
|
1464
1457
|
{
|
|
1465
1458
|
"data-slot": "sidebar-menu-item",
|
|
@@ -1500,7 +1493,7 @@ function SidebarMenuButton({
|
|
|
1500
1493
|
}) {
|
|
1501
1494
|
const Comp = asChild ? Slot3 : "button";
|
|
1502
1495
|
const { isMobile, state } = useSidebar();
|
|
1503
|
-
const button = /* @__PURE__ */
|
|
1496
|
+
const button = /* @__PURE__ */ jsx12(
|
|
1504
1497
|
Comp,
|
|
1505
1498
|
{
|
|
1506
1499
|
"data-slot": "sidebar-menu-button",
|
|
@@ -1520,8 +1513,8 @@ function SidebarMenuButton({
|
|
|
1520
1513
|
};
|
|
1521
1514
|
}
|
|
1522
1515
|
return /* @__PURE__ */ jsxs4(Tooltip, { children: [
|
|
1523
|
-
/* @__PURE__ */
|
|
1524
|
-
/* @__PURE__ */
|
|
1516
|
+
/* @__PURE__ */ jsx12(TooltipTrigger, { asChild: true, children: button }),
|
|
1517
|
+
/* @__PURE__ */ jsx12(
|
|
1525
1518
|
TooltipContent,
|
|
1526
1519
|
{
|
|
1527
1520
|
side: "right",
|
|
@@ -1539,7 +1532,7 @@ function SidebarMenuAction({
|
|
|
1539
1532
|
...props
|
|
1540
1533
|
}) {
|
|
1541
1534
|
const Comp = asChild ? Slot3 : "button";
|
|
1542
|
-
return /* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ jsx12(
|
|
1543
1536
|
Comp,
|
|
1544
1537
|
{
|
|
1545
1538
|
"data-slot": "sidebar-menu-action",
|
|
@@ -1564,7 +1557,7 @@ function SidebarMenuAction({
|
|
|
1564
1557
|
import * as React5 from "react";
|
|
1565
1558
|
import * as DialogPrimitive from "@radix-ui/react-dialog";
|
|
1566
1559
|
import { XIcon as XIcon2 } from "lucide-react";
|
|
1567
|
-
import { jsx as
|
|
1560
|
+
import { jsx as jsx13, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1568
1561
|
function cleanupBodyStyles2() {
|
|
1569
1562
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1570
1563
|
document.body.style.pointerEvents = "";
|
|
@@ -1588,23 +1581,23 @@ function Dialog({
|
|
|
1588
1581
|
cleanupBodyStyles2();
|
|
1589
1582
|
};
|
|
1590
1583
|
}, []);
|
|
1591
|
-
return /* @__PURE__ */
|
|
1584
|
+
return /* @__PURE__ */ jsx13(DialogPrimitive.Root, { "data-slot": "dialog", open, onOpenChange, ...props });
|
|
1592
1585
|
}
|
|
1593
1586
|
function DialogTrigger({
|
|
1594
1587
|
...props
|
|
1595
1588
|
}) {
|
|
1596
|
-
return /* @__PURE__ */
|
|
1589
|
+
return /* @__PURE__ */ jsx13(DialogPrimitive.Trigger, { "data-slot": "dialog-trigger", ...props });
|
|
1597
1590
|
}
|
|
1598
1591
|
function DialogPortal({
|
|
1599
1592
|
...props
|
|
1600
1593
|
}) {
|
|
1601
|
-
return /* @__PURE__ */
|
|
1594
|
+
return /* @__PURE__ */ jsx13(DialogPrimitive.Portal, { "data-slot": "dialog-portal", ...props });
|
|
1602
1595
|
}
|
|
1603
1596
|
function DialogOverlay({
|
|
1604
1597
|
className,
|
|
1605
1598
|
...props
|
|
1606
1599
|
}) {
|
|
1607
|
-
return /* @__PURE__ */
|
|
1600
|
+
return /* @__PURE__ */ jsx13(
|
|
1608
1601
|
DialogPrimitive.Overlay,
|
|
1609
1602
|
{
|
|
1610
1603
|
"data-slot": "dialog-overlay",
|
|
@@ -1626,7 +1619,7 @@ function DialogContent({
|
|
|
1626
1619
|
...props
|
|
1627
1620
|
}) {
|
|
1628
1621
|
return /* @__PURE__ */ jsxs5(DialogPortal, { "data-slot": "dialog-portal", children: [
|
|
1629
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ jsx13(DialogOverlay, {}),
|
|
1630
1623
|
/* @__PURE__ */ jsxs5(
|
|
1631
1624
|
DialogPrimitive.Content,
|
|
1632
1625
|
{
|
|
@@ -1645,8 +1638,8 @@ function DialogContent({
|
|
|
1645
1638
|
"data-slot": "dialog-close",
|
|
1646
1639
|
className: "ring-offset-background focus:ring-ring data-[state=open]:bg-accent data-[state=open]:text-muted-foreground absolute top-4 right-4 rounded-xs opacity-70 transition-opacity hover:opacity-100 focus:ring-2 focus:ring-offset-2 focus:outline-hidden disabled:pointer-events-none [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",
|
|
1647
1640
|
children: [
|
|
1648
|
-
/* @__PURE__ */
|
|
1649
|
-
/* @__PURE__ */
|
|
1641
|
+
/* @__PURE__ */ jsx13(XIcon2, {}),
|
|
1642
|
+
/* @__PURE__ */ jsx13("span", { className: "sr-only", children: "Close" })
|
|
1650
1643
|
]
|
|
1651
1644
|
}
|
|
1652
1645
|
)
|
|
@@ -1656,7 +1649,7 @@ function DialogContent({
|
|
|
1656
1649
|
] });
|
|
1657
1650
|
}
|
|
1658
1651
|
function DialogHeader({ className, ...props }) {
|
|
1659
|
-
return /* @__PURE__ */
|
|
1652
|
+
return /* @__PURE__ */ jsx13(
|
|
1660
1653
|
"div",
|
|
1661
1654
|
{
|
|
1662
1655
|
"data-slot": "dialog-header",
|
|
@@ -1666,7 +1659,7 @@ function DialogHeader({ className, ...props }) {
|
|
|
1666
1659
|
);
|
|
1667
1660
|
}
|
|
1668
1661
|
function DialogFooter({ className, ...props }) {
|
|
1669
|
-
return /* @__PURE__ */
|
|
1662
|
+
return /* @__PURE__ */ jsx13(
|
|
1670
1663
|
"div",
|
|
1671
1664
|
{
|
|
1672
1665
|
"data-slot": "dialog-footer",
|
|
@@ -1682,7 +1675,7 @@ function DialogTitle({
|
|
|
1682
1675
|
className,
|
|
1683
1676
|
...props
|
|
1684
1677
|
}) {
|
|
1685
|
-
return /* @__PURE__ */
|
|
1678
|
+
return /* @__PURE__ */ jsx13(
|
|
1686
1679
|
DialogPrimitive.Title,
|
|
1687
1680
|
{
|
|
1688
1681
|
"data-slot": "dialog-title",
|
|
@@ -1695,7 +1688,7 @@ function DialogDescription({
|
|
|
1695
1688
|
className,
|
|
1696
1689
|
...props
|
|
1697
1690
|
}) {
|
|
1698
|
-
return /* @__PURE__ */
|
|
1691
|
+
return /* @__PURE__ */ jsx13(
|
|
1699
1692
|
DialogPrimitive.Description,
|
|
1700
1693
|
{
|
|
1701
1694
|
"data-slot": "dialog-description",
|
|
@@ -1708,7 +1701,7 @@ function DialogDescription({
|
|
|
1708
1701
|
// src/components/ui/alert-dialog.tsx
|
|
1709
1702
|
import * as React6 from "react";
|
|
1710
1703
|
import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog";
|
|
1711
|
-
import { jsx as
|
|
1704
|
+
import { jsx as jsx14, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1712
1705
|
function cleanupBodyStyles3() {
|
|
1713
1706
|
if (typeof document !== "undefined" && document.body.style.pointerEvents === "none") {
|
|
1714
1707
|
document.body.style.pointerEvents = "";
|
|
@@ -1732,18 +1725,18 @@ function AlertDialog({
|
|
|
1732
1725
|
cleanupBodyStyles3();
|
|
1733
1726
|
};
|
|
1734
1727
|
}, []);
|
|
1735
|
-
return /* @__PURE__ */
|
|
1728
|
+
return /* @__PURE__ */ jsx14(AlertDialogPrimitive.Root, { "data-slot": "alert-dialog", open, onOpenChange, ...props });
|
|
1736
1729
|
}
|
|
1737
1730
|
function AlertDialogPortal({
|
|
1738
1731
|
...props
|
|
1739
1732
|
}) {
|
|
1740
|
-
return /* @__PURE__ */
|
|
1733
|
+
return /* @__PURE__ */ jsx14(AlertDialogPrimitive.Portal, { "data-slot": "alert-dialog-portal", ...props });
|
|
1741
1734
|
}
|
|
1742
1735
|
function AlertDialogOverlay({
|
|
1743
1736
|
className,
|
|
1744
1737
|
...props
|
|
1745
1738
|
}) {
|
|
1746
|
-
return /* @__PURE__ */
|
|
1739
|
+
return /* @__PURE__ */ jsx14(
|
|
1747
1740
|
AlertDialogPrimitive.Overlay,
|
|
1748
1741
|
{
|
|
1749
1742
|
"data-slot": "alert-dialog-overlay",
|
|
@@ -1763,8 +1756,8 @@ function AlertDialogContent({
|
|
|
1763
1756
|
...props
|
|
1764
1757
|
}) {
|
|
1765
1758
|
return /* @__PURE__ */ jsxs6(AlertDialogPortal, { children: [
|
|
1766
|
-
/* @__PURE__ */
|
|
1767
|
-
/* @__PURE__ */
|
|
1759
|
+
/* @__PURE__ */ jsx14(AlertDialogOverlay, {}),
|
|
1760
|
+
/* @__PURE__ */ jsx14(
|
|
1768
1761
|
AlertDialogPrimitive.Content,
|
|
1769
1762
|
{
|
|
1770
1763
|
"data-slot": "alert-dialog-content",
|
|
@@ -1781,7 +1774,7 @@ function AlertDialogHeader({
|
|
|
1781
1774
|
className,
|
|
1782
1775
|
...props
|
|
1783
1776
|
}) {
|
|
1784
|
-
return /* @__PURE__ */
|
|
1777
|
+
return /* @__PURE__ */ jsx14(
|
|
1785
1778
|
"div",
|
|
1786
1779
|
{
|
|
1787
1780
|
"data-slot": "alert-dialog-header",
|
|
@@ -1794,7 +1787,7 @@ function AlertDialogFooter({
|
|
|
1794
1787
|
className,
|
|
1795
1788
|
...props
|
|
1796
1789
|
}) {
|
|
1797
|
-
return /* @__PURE__ */
|
|
1790
|
+
return /* @__PURE__ */ jsx14(
|
|
1798
1791
|
"div",
|
|
1799
1792
|
{
|
|
1800
1793
|
"data-slot": "alert-dialog-footer",
|
|
@@ -1810,7 +1803,7 @@ function AlertDialogTitle({
|
|
|
1810
1803
|
className,
|
|
1811
1804
|
...props
|
|
1812
1805
|
}) {
|
|
1813
|
-
return /* @__PURE__ */
|
|
1806
|
+
return /* @__PURE__ */ jsx14(
|
|
1814
1807
|
AlertDialogPrimitive.Title,
|
|
1815
1808
|
{
|
|
1816
1809
|
"data-slot": "alert-dialog-title",
|
|
@@ -1823,7 +1816,7 @@ function AlertDialogDescription({
|
|
|
1823
1816
|
className,
|
|
1824
1817
|
...props
|
|
1825
1818
|
}) {
|
|
1826
|
-
return /* @__PURE__ */
|
|
1819
|
+
return /* @__PURE__ */ jsx14(
|
|
1827
1820
|
AlertDialogPrimitive.Description,
|
|
1828
1821
|
{
|
|
1829
1822
|
"data-slot": "alert-dialog-description",
|
|
@@ -1836,7 +1829,7 @@ function AlertDialogAction({
|
|
|
1836
1829
|
className,
|
|
1837
1830
|
...props
|
|
1838
1831
|
}) {
|
|
1839
|
-
return /* @__PURE__ */
|
|
1832
|
+
return /* @__PURE__ */ jsx14(
|
|
1840
1833
|
AlertDialogPrimitive.Action,
|
|
1841
1834
|
{
|
|
1842
1835
|
className: cn(buttonVariants(), className),
|
|
@@ -1848,7 +1841,7 @@ function AlertDialogCancel({
|
|
|
1848
1841
|
className,
|
|
1849
1842
|
...props
|
|
1850
1843
|
}) {
|
|
1851
|
-
return /* @__PURE__ */
|
|
1844
|
+
return /* @__PURE__ */ jsx14(
|
|
1852
1845
|
AlertDialogPrimitive.Cancel,
|
|
1853
1846
|
{
|
|
1854
1847
|
className: cn(buttonVariants({ variant: "outline" }), className),
|
|
@@ -1860,16 +1853,16 @@ function AlertDialogCancel({
|
|
|
1860
1853
|
// src/components/ui/dropdown-menu.tsx
|
|
1861
1854
|
import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
|
|
1862
1855
|
import { CheckIcon, ChevronRightIcon, CircleIcon } from "lucide-react";
|
|
1863
|
-
import { jsx as
|
|
1856
|
+
import { jsx as jsx15, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1864
1857
|
function DropdownMenu({
|
|
1865
1858
|
...props
|
|
1866
1859
|
}) {
|
|
1867
|
-
return /* @__PURE__ */
|
|
1860
|
+
return /* @__PURE__ */ jsx15(DropdownMenuPrimitive.Root, { "data-slot": "dropdown-menu", ...props });
|
|
1868
1861
|
}
|
|
1869
1862
|
function DropdownMenuTrigger({
|
|
1870
1863
|
...props
|
|
1871
1864
|
}) {
|
|
1872
|
-
return /* @__PURE__ */
|
|
1865
|
+
return /* @__PURE__ */ jsx15(
|
|
1873
1866
|
DropdownMenuPrimitive.Trigger,
|
|
1874
1867
|
{
|
|
1875
1868
|
"data-slot": "dropdown-menu-trigger",
|
|
@@ -1882,7 +1875,7 @@ function DropdownMenuContent({
|
|
|
1882
1875
|
sideOffset = 4,
|
|
1883
1876
|
...props
|
|
1884
1877
|
}) {
|
|
1885
|
-
return /* @__PURE__ */
|
|
1878
|
+
return /* @__PURE__ */ jsx15(DropdownMenuPrimitive.Portal, { children: /* @__PURE__ */ jsx15(
|
|
1886
1879
|
DropdownMenuPrimitive.Content,
|
|
1887
1880
|
{
|
|
1888
1881
|
"data-slot": "dropdown-menu-content",
|
|
@@ -1901,7 +1894,7 @@ function DropdownMenuItem({
|
|
|
1901
1894
|
variant = "default",
|
|
1902
1895
|
...props
|
|
1903
1896
|
}) {
|
|
1904
|
-
return /* @__PURE__ */
|
|
1897
|
+
return /* @__PURE__ */ jsx15(
|
|
1905
1898
|
DropdownMenuPrimitive.Item,
|
|
1906
1899
|
{
|
|
1907
1900
|
"data-slot": "dropdown-menu-item",
|
|
@@ -1920,7 +1913,7 @@ function DropdownMenuLabel({
|
|
|
1920
1913
|
inset,
|
|
1921
1914
|
...props
|
|
1922
1915
|
}) {
|
|
1923
|
-
return /* @__PURE__ */
|
|
1916
|
+
return /* @__PURE__ */ jsx15(
|
|
1924
1917
|
DropdownMenuPrimitive.Label,
|
|
1925
1918
|
{
|
|
1926
1919
|
"data-slot": "dropdown-menu-label",
|
|
@@ -1937,7 +1930,7 @@ function DropdownMenuSeparator({
|
|
|
1937
1930
|
className,
|
|
1938
1931
|
...props
|
|
1939
1932
|
}) {
|
|
1940
|
-
return /* @__PURE__ */
|
|
1933
|
+
return /* @__PURE__ */ jsx15(
|
|
1941
1934
|
DropdownMenuPrimitive.Separator,
|
|
1942
1935
|
{
|
|
1943
1936
|
"data-slot": "dropdown-menu-separator",
|
|
@@ -1969,7 +1962,7 @@ import {
|
|
|
1969
1962
|
Sun,
|
|
1970
1963
|
Palette
|
|
1971
1964
|
} from "lucide-react";
|
|
1972
|
-
import { Fragment as Fragment2, jsx as
|
|
1965
|
+
import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1973
1966
|
var getInitials = (name, email) => {
|
|
1974
1967
|
if (name) {
|
|
1975
1968
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -2004,8 +1997,8 @@ var UserMenu = ({
|
|
|
2004
1997
|
};
|
|
2005
1998
|
const displayName = getDisplayName(user, labels.guest);
|
|
2006
1999
|
const initials = getInitials(user?.name, user?.email);
|
|
2007
|
-
return /* @__PURE__ */
|
|
2008
|
-
/* @__PURE__ */
|
|
2000
|
+
return /* @__PURE__ */ jsx16(SidebarMenu, { children: /* @__PURE__ */ jsx16(SidebarMenuItem, { children: /* @__PURE__ */ jsxs8(DropdownMenu, { children: [
|
|
2001
|
+
/* @__PURE__ */ jsx16(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs8(
|
|
2009
2002
|
SidebarMenuButton,
|
|
2010
2003
|
{
|
|
2011
2004
|
size: "lg",
|
|
@@ -2013,14 +2006,14 @@ var UserMenu = ({
|
|
|
2013
2006
|
tooltip: displayName,
|
|
2014
2007
|
children: [
|
|
2015
2008
|
/* @__PURE__ */ jsxs8(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2016
|
-
user?.avatar && /* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2009
|
+
user?.avatar && /* @__PURE__ */ jsx16(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2010
|
+
/* @__PURE__ */ jsx16(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2018
2011
|
] }),
|
|
2019
2012
|
/* @__PURE__ */ jsxs8("div", { className: "grid flex-1 text-left text-sm leading-tight group-data-[collapsible=icon]:hidden", children: [
|
|
2020
|
-
/* @__PURE__ */
|
|
2021
|
-
user?.email && /* @__PURE__ */
|
|
2013
|
+
/* @__PURE__ */ jsx16("span", { className: "truncate font-medium", children: displayName }),
|
|
2014
|
+
user?.email && /* @__PURE__ */ jsx16("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2022
2015
|
] }),
|
|
2023
|
-
/* @__PURE__ */
|
|
2016
|
+
/* @__PURE__ */ jsx16(ChevronsUpDown, { className: "ml-auto size-4 group-data-[collapsible=icon]:hidden" })
|
|
2024
2017
|
]
|
|
2025
2018
|
}
|
|
2026
2019
|
) }),
|
|
@@ -2032,36 +2025,36 @@ var UserMenu = ({
|
|
|
2032
2025
|
align: "end",
|
|
2033
2026
|
sideOffset: 4,
|
|
2034
2027
|
children: [
|
|
2035
|
-
/* @__PURE__ */
|
|
2028
|
+
/* @__PURE__ */ jsx16(DropdownMenuLabel, { className: "p-0 font-normal", children: /* @__PURE__ */ jsxs8("div", { className: "flex items-center gap-2 px-1 py-1.5 text-left text-sm", children: [
|
|
2036
2029
|
/* @__PURE__ */ jsxs8(Avatar, { className: "h-8 w-8 rounded-lg", children: [
|
|
2037
|
-
user?.avatar && /* @__PURE__ */
|
|
2038
|
-
/* @__PURE__ */
|
|
2030
|
+
user?.avatar && /* @__PURE__ */ jsx16(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
2031
|
+
/* @__PURE__ */ jsx16(AvatarFallback, { className: "rounded-lg bg-primary/10 text-primary text-xs font-medium", children: initials })
|
|
2039
2032
|
] }),
|
|
2040
2033
|
/* @__PURE__ */ jsxs8("div", { className: "grid flex-1 text-left text-sm leading-tight", children: [
|
|
2041
|
-
/* @__PURE__ */
|
|
2042
|
-
user?.email && /* @__PURE__ */
|
|
2034
|
+
/* @__PURE__ */ jsx16("span", { className: "truncate font-medium", children: displayName }),
|
|
2035
|
+
user?.email && /* @__PURE__ */ jsx16("span", { className: "truncate text-xs text-muted-foreground", children: user.email })
|
|
2043
2036
|
] })
|
|
2044
2037
|
] }) }),
|
|
2045
|
-
/* @__PURE__ */
|
|
2038
|
+
/* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
|
|
2046
2039
|
callbacks?.onViewProfile && /* @__PURE__ */ jsxs8(DropdownMenuItem, { onClick: callbacks.onViewProfile, children: [
|
|
2047
|
-
/* @__PURE__ */
|
|
2048
|
-
/* @__PURE__ */
|
|
2040
|
+
/* @__PURE__ */ jsx16(User, { className: "mr-2 h-4 w-4" }),
|
|
2041
|
+
/* @__PURE__ */ jsx16("span", { children: labels.profile })
|
|
2049
2042
|
] }),
|
|
2050
2043
|
callbacks?.onOpenSettings && /* @__PURE__ */ jsxs8(DropdownMenuItem, { onClick: callbacks.onOpenSettings, children: [
|
|
2051
|
-
/* @__PURE__ */
|
|
2052
|
-
/* @__PURE__ */
|
|
2044
|
+
/* @__PURE__ */ jsx16(Settings, { className: "mr-2 h-4 w-4" }),
|
|
2045
|
+
/* @__PURE__ */ jsx16("span", { children: labels.settings })
|
|
2053
2046
|
] }),
|
|
2054
2047
|
additionalItems,
|
|
2055
2048
|
showThemeOptions && callbacks?.onThemeChange && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2056
|
-
/* @__PURE__ */
|
|
2049
|
+
/* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
|
|
2057
2050
|
/* @__PURE__ */ jsxs8(
|
|
2058
2051
|
DropdownMenuItem,
|
|
2059
2052
|
{
|
|
2060
2053
|
onClick: () => callbacks.onThemeChange?.("light"),
|
|
2061
2054
|
className: currentTheme === "light" ? "bg-accent" : "",
|
|
2062
2055
|
children: [
|
|
2063
|
-
/* @__PURE__ */
|
|
2064
|
-
/* @__PURE__ */
|
|
2056
|
+
/* @__PURE__ */ jsx16(Sun, { className: "mr-2 h-4 w-4" }),
|
|
2057
|
+
/* @__PURE__ */ jsx16("span", { children: labels.lightMode })
|
|
2065
2058
|
]
|
|
2066
2059
|
}
|
|
2067
2060
|
),
|
|
@@ -2071,8 +2064,8 @@ var UserMenu = ({
|
|
|
2071
2064
|
onClick: () => callbacks.onThemeChange?.("dark"),
|
|
2072
2065
|
className: currentTheme === "dark" ? "bg-accent" : "",
|
|
2073
2066
|
children: [
|
|
2074
|
-
/* @__PURE__ */
|
|
2075
|
-
/* @__PURE__ */
|
|
2067
|
+
/* @__PURE__ */ jsx16(Moon, { className: "mr-2 h-4 w-4" }),
|
|
2068
|
+
/* @__PURE__ */ jsx16("span", { children: labels.darkMode })
|
|
2076
2069
|
]
|
|
2077
2070
|
}
|
|
2078
2071
|
),
|
|
@@ -2082,22 +2075,22 @@ var UserMenu = ({
|
|
|
2082
2075
|
onClick: () => callbacks.onThemeChange?.("system"),
|
|
2083
2076
|
className: currentTheme === "system" ? "bg-accent" : "",
|
|
2084
2077
|
children: [
|
|
2085
|
-
/* @__PURE__ */
|
|
2086
|
-
/* @__PURE__ */
|
|
2078
|
+
/* @__PURE__ */ jsx16(Palette, { className: "mr-2 h-4 w-4" }),
|
|
2079
|
+
/* @__PURE__ */ jsx16("span", { children: labels.systemTheme })
|
|
2087
2080
|
]
|
|
2088
2081
|
}
|
|
2089
2082
|
)
|
|
2090
2083
|
] }),
|
|
2091
2084
|
callbacks?.onLogout && /* @__PURE__ */ jsxs8(Fragment2, { children: [
|
|
2092
|
-
/* @__PURE__ */
|
|
2085
|
+
/* @__PURE__ */ jsx16(DropdownMenuSeparator, {}),
|
|
2093
2086
|
/* @__PURE__ */ jsxs8(
|
|
2094
2087
|
DropdownMenuItem,
|
|
2095
2088
|
{
|
|
2096
2089
|
onClick: callbacks.onLogout,
|
|
2097
2090
|
className: "text-destructive focus:text-destructive focus:bg-destructive/10",
|
|
2098
2091
|
children: [
|
|
2099
|
-
/* @__PURE__ */
|
|
2100
|
-
/* @__PURE__ */
|
|
2092
|
+
/* @__PURE__ */ jsx16(LogOut, { className: "mr-2 h-4 w-4" }),
|
|
2093
|
+
/* @__PURE__ */ jsx16("span", { children: labels.logout })
|
|
2101
2094
|
]
|
|
2102
2095
|
}
|
|
2103
2096
|
)
|
|
@@ -2109,7 +2102,7 @@ var UserMenu = ({
|
|
|
2109
2102
|
};
|
|
2110
2103
|
|
|
2111
2104
|
// src/components/chat/Sidebar.tsx
|
|
2112
|
-
import { jsx as
|
|
2105
|
+
import { jsx as jsx17, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2113
2106
|
var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
2114
2107
|
const [title, setTitle] = useState4("");
|
|
2115
2108
|
const [isOpen, setIsOpen] = useState4(false);
|
|
@@ -2119,16 +2112,16 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2119
2112
|
setIsOpen(false);
|
|
2120
2113
|
};
|
|
2121
2114
|
return /* @__PURE__ */ jsxs9(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
2122
|
-
/* @__PURE__ */
|
|
2123
|
-
/* @__PURE__ */
|
|
2115
|
+
/* @__PURE__ */ jsx17(DialogTrigger, { asChild: true, children: trigger || /* @__PURE__ */ jsxs9(Button, { className: "w-full justify-start", variant: "outline", children: [
|
|
2116
|
+
/* @__PURE__ */ jsx17(Plus, { className: "mr-2 h-4 w-4" }),
|
|
2124
2117
|
config.labels?.newChat || "New Chat"
|
|
2125
2118
|
] }) }),
|
|
2126
2119
|
/* @__PURE__ */ jsxs9(DialogContent, { children: [
|
|
2127
2120
|
/* @__PURE__ */ jsxs9(DialogHeader, { children: [
|
|
2128
|
-
/* @__PURE__ */
|
|
2129
|
-
/* @__PURE__ */
|
|
2121
|
+
/* @__PURE__ */ jsx17(DialogTitle, { children: config.labels?.createNewThread || "New Conversation" }),
|
|
2122
|
+
/* @__PURE__ */ jsx17(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
2130
2123
|
] }),
|
|
2131
|
-
/* @__PURE__ */
|
|
2124
|
+
/* @__PURE__ */ jsx17(
|
|
2132
2125
|
Input,
|
|
2133
2126
|
{
|
|
2134
2127
|
value: title,
|
|
@@ -2139,15 +2132,15 @@ var CreateThreadDialog = ({ config, onCreateThread, trigger }) => {
|
|
|
2139
2132
|
}
|
|
2140
2133
|
),
|
|
2141
2134
|
/* @__PURE__ */ jsxs9(DialogFooter, { children: [
|
|
2142
|
-
/* @__PURE__ */
|
|
2143
|
-
/* @__PURE__ */
|
|
2135
|
+
/* @__PURE__ */ jsx17(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config.labels?.cancel || "Cancel" }),
|
|
2136
|
+
/* @__PURE__ */ jsx17(Button, { onClick: handleCreate, children: config.labels?.create || "Create" })
|
|
2144
2137
|
] })
|
|
2145
2138
|
] })
|
|
2146
2139
|
] });
|
|
2147
2140
|
};
|
|
2148
2141
|
var ThreadInitialsIcon = ({ title }) => {
|
|
2149
2142
|
const initials = title?.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase() || "?";
|
|
2150
|
-
return /* @__PURE__ */
|
|
2143
|
+
return /* @__PURE__ */ jsx17("div", { className: "flex shrink-0 items-center justify-center rounded bg-muted text-[10px] font-medium", children: initials });
|
|
2151
2144
|
};
|
|
2152
2145
|
var Sidebar2 = ({
|
|
2153
2146
|
threads,
|
|
@@ -2227,26 +2220,26 @@ var Sidebar2 = ({
|
|
|
2227
2220
|
return /* @__PURE__ */ jsxs9(Sidebar, { collapsible: "icon", ...props, children: [
|
|
2228
2221
|
/* @__PURE__ */ jsxs9(SidebarHeader, { children: [
|
|
2229
2222
|
/* @__PURE__ */ jsxs9("div", { className: "flex items-center gap-3 px-2 py-3", children: [
|
|
2230
|
-
/* @__PURE__ */
|
|
2223
|
+
/* @__PURE__ */ jsx17("div", { className: "flex items-center justify-center shrink-0", children: config.branding?.logo || /* @__PURE__ */ jsx17(Avatar, { className: "h-8 w-8", children: /* @__PURE__ */ jsx17(AvatarFallback, { className: "bg-primary text-primary-foreground", children: /* @__PURE__ */ jsx17(Bot, { className: "h-4 w-4" }) }) }) }),
|
|
2231
2224
|
/* @__PURE__ */ jsxs9("div", { className: "flex flex-col min-w-0 group-data-[collapsible=icon]:hidden", children: [
|
|
2232
|
-
/* @__PURE__ */
|
|
2233
|
-
config.branding?.subtitle && /* @__PURE__ */
|
|
2225
|
+
/* @__PURE__ */ jsx17("span", { className: "text-sm font-semibold truncate", children: config.branding?.title || "Chat" }),
|
|
2226
|
+
config.branding?.subtitle && /* @__PURE__ */ jsx17("span", { className: "text-xs text-muted-foreground truncate", children: config.branding.subtitle })
|
|
2234
2227
|
] })
|
|
2235
2228
|
] }),
|
|
2236
|
-
onCreateThread && /* @__PURE__ */
|
|
2229
|
+
onCreateThread && /* @__PURE__ */ jsx17(
|
|
2237
2230
|
CreateThreadDialog,
|
|
2238
2231
|
{
|
|
2239
2232
|
config,
|
|
2240
2233
|
onCreateThread,
|
|
2241
|
-
trigger: /* @__PURE__ */
|
|
2234
|
+
trigger: /* @__PURE__ */ jsx17(SidebarMenu, { children: /* @__PURE__ */ jsx17(SidebarMenuItem, { children: /* @__PURE__ */ jsxs9(
|
|
2242
2235
|
SidebarMenuButton,
|
|
2243
2236
|
{
|
|
2244
2237
|
size: "lg",
|
|
2245
2238
|
className: "w-full justify-start gap-2 border border-sidebar-border shadow-sm hover:bg-sidebar-accent hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:justify-center",
|
|
2246
2239
|
tooltip: config.labels?.newChat || "New Chat",
|
|
2247
2240
|
children: [
|
|
2248
|
-
/* @__PURE__ */
|
|
2249
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ jsx17(Plus, { className: "size-4" }),
|
|
2242
|
+
/* @__PURE__ */ jsx17("span", { className: "group-data-[collapsible=icon]:hidden", children: config.labels?.newChat || "New Chat" })
|
|
2250
2243
|
]
|
|
2251
2244
|
}
|
|
2252
2245
|
) }) })
|
|
@@ -2254,8 +2247,8 @@ var Sidebar2 = ({
|
|
|
2254
2247
|
),
|
|
2255
2248
|
/* @__PURE__ */ jsxs9("div", { className: "px-2 py-1 mt-4", children: [
|
|
2256
2249
|
/* @__PURE__ */ jsxs9("div", { className: "relative group-data-[collapsible=icon]:hidden", children: [
|
|
2257
|
-
/* @__PURE__ */
|
|
2258
|
-
/* @__PURE__ */
|
|
2250
|
+
/* @__PURE__ */ jsx17(Search, { className: "pointer-events-none absolute left-2 top-1/2 size-4 -translate-y-1/2 select-none opacity-50" }),
|
|
2251
|
+
/* @__PURE__ */ jsx17(
|
|
2259
2252
|
Input,
|
|
2260
2253
|
{
|
|
2261
2254
|
className: "pl-8 h-8 bg-sidebar-accent/50 border-sidebar-border focus-visible:ring-1 focus-visible:ring-sidebar-ring",
|
|
@@ -2265,7 +2258,7 @@ var Sidebar2 = ({
|
|
|
2265
2258
|
}
|
|
2266
2259
|
)
|
|
2267
2260
|
] }),
|
|
2268
|
-
/* @__PURE__ */
|
|
2261
|
+
/* @__PURE__ */ jsx17("div", { className: "hidden group-data-[collapsible=icon]:flex justify-center", children: /* @__PURE__ */ jsx17(
|
|
2269
2262
|
Button,
|
|
2270
2263
|
{
|
|
2271
2264
|
variant: "ghost",
|
|
@@ -2273,13 +2266,13 @@ var Sidebar2 = ({
|
|
|
2273
2266
|
className: "h-7 w-7",
|
|
2274
2267
|
onClick: () => setOpen(true),
|
|
2275
2268
|
title: config.labels?.search || "Search",
|
|
2276
|
-
children: /* @__PURE__ */
|
|
2269
|
+
children: /* @__PURE__ */ jsx17(Search, { className: "h-4 w-4" })
|
|
2277
2270
|
}
|
|
2278
2271
|
) })
|
|
2279
2272
|
] })
|
|
2280
2273
|
] }),
|
|
2281
2274
|
/* @__PURE__ */ jsxs9(SidebarContent, { children: [
|
|
2282
|
-
threads.some((t) => t.isArchived) && /* @__PURE__ */
|
|
2275
|
+
threads.some((t) => t.isArchived) && /* @__PURE__ */ jsx17("div", { className: "px-4 py-2 mt-2 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsxs9(
|
|
2283
2276
|
Button,
|
|
2284
2277
|
{
|
|
2285
2278
|
variant: "ghost",
|
|
@@ -2287,18 +2280,18 @@ var Sidebar2 = ({
|
|
|
2287
2280
|
onClick: () => setShowArchived(!showArchived),
|
|
2288
2281
|
className: "h-6 text-xs w-full justify-start text-muted-foreground",
|
|
2289
2282
|
children: [
|
|
2290
|
-
/* @__PURE__ */
|
|
2283
|
+
/* @__PURE__ */ jsx17(Filter, { className: "mr-2 h-3 w-3" }),
|
|
2291
2284
|
showArchived ? config.labels?.hideArchived || "Hide Archived" : config.labels?.showArchived || "Show Archived"
|
|
2292
2285
|
]
|
|
2293
2286
|
}
|
|
2294
2287
|
) }),
|
|
2295
2288
|
Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs9("div", { className: "px-4 py-8 text-center text-muted-foreground group-data-[collapsible=icon]:hidden", children: [
|
|
2296
|
-
/* @__PURE__ */
|
|
2297
|
-
/* @__PURE__ */
|
|
2289
|
+
/* @__PURE__ */ jsx17("div", { className: "mx-auto h-8 w-8 mb-2 flex items-center justify-center rounded-full bg-muted/50", children: /* @__PURE__ */ jsx17(Plus, { className: "h-4 w-4 opacity-50" }) }),
|
|
2290
|
+
/* @__PURE__ */ jsx17("p", { className: "text-xs", children: searchQuery ? config.labels?.noThreadsFound || "No conversations found" : config.labels?.noThreadsYet || "No conversations yet" })
|
|
2298
2291
|
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs9(SidebarGroup, { className: "mt-2", children: [
|
|
2299
|
-
/* @__PURE__ */
|
|
2300
|
-
/* @__PURE__ */
|
|
2301
|
-
editingThreadId === thread.id ? /* @__PURE__ */
|
|
2292
|
+
/* @__PURE__ */ jsx17(SidebarGroupLabel, { className: "group-data-[collapsible=icon]:hidden", children: group }),
|
|
2293
|
+
/* @__PURE__ */ jsx17(SidebarGroupContent, { children: /* @__PURE__ */ jsx17(SidebarMenu, { children: groupThreads.map((thread) => /* @__PURE__ */ jsxs9(SidebarMenuItem, { children: [
|
|
2294
|
+
editingThreadId === thread.id ? /* @__PURE__ */ jsx17("div", { className: "flex items-center gap-1 px-2 py-1", children: /* @__PURE__ */ jsx17(
|
|
2302
2295
|
Input,
|
|
2303
2296
|
{
|
|
2304
2297
|
ref: inputRef,
|
|
@@ -2318,35 +2311,35 @@ var Sidebar2 = ({
|
|
|
2318
2311
|
onClick: () => onSelectThread?.(thread.id),
|
|
2319
2312
|
tooltip: thread.title,
|
|
2320
2313
|
children: [
|
|
2321
|
-
/* @__PURE__ */
|
|
2322
|
-
/* @__PURE__ */
|
|
2323
|
-
thread.isArchived && /* @__PURE__ */
|
|
2314
|
+
/* @__PURE__ */ jsx17(ThreadInitialsIcon, { title: thread.title || "?" }),
|
|
2315
|
+
/* @__PURE__ */ jsx17("div", { className: "flex flex-col items-start gap-0.5 flex-1 min-w-0 group-data-[collapsible=icon]:hidden", children: /* @__PURE__ */ jsx17("span", { className: "truncate w-full", children: thread.title || "New Chat" }) }),
|
|
2316
|
+
thread.isArchived && /* @__PURE__ */ jsx17(Archive, { className: "ml-auto h-3 w-3 opacity-50 group-data-[collapsible=icon]:hidden" })
|
|
2324
2317
|
]
|
|
2325
2318
|
}
|
|
2326
2319
|
),
|
|
2327
2320
|
!editingThreadId && /* @__PURE__ */ jsxs9(DropdownMenu, { children: [
|
|
2328
|
-
/* @__PURE__ */
|
|
2329
|
-
/* @__PURE__ */
|
|
2330
|
-
/* @__PURE__ */
|
|
2321
|
+
/* @__PURE__ */ jsx17(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs9(SidebarMenuAction, { showOnHover: true, children: [
|
|
2322
|
+
/* @__PURE__ */ jsx17(MoreHorizontal, {}),
|
|
2323
|
+
/* @__PURE__ */ jsx17("span", { className: "sr-only", children: "More" })
|
|
2331
2324
|
] }) }),
|
|
2332
2325
|
/* @__PURE__ */ jsxs9(DropdownMenuContent, { className: "w-48", side: "right", align: "start", children: [
|
|
2333
2326
|
/* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: () => startEditing(thread), children: [
|
|
2334
|
-
/* @__PURE__ */
|
|
2335
|
-
/* @__PURE__ */
|
|
2327
|
+
/* @__PURE__ */ jsx17(Edit2, { className: "mr-2 h-4 w-4" }),
|
|
2328
|
+
/* @__PURE__ */ jsx17("span", { children: config.labels?.renameThread || "Rename" })
|
|
2336
2329
|
] }),
|
|
2337
2330
|
/* @__PURE__ */ jsxs9(DropdownMenuItem, { onClick: () => onArchiveThread?.(thread.id), children: [
|
|
2338
|
-
/* @__PURE__ */
|
|
2339
|
-
/* @__PURE__ */
|
|
2331
|
+
/* @__PURE__ */ jsx17(Archive, { className: "mr-2 h-4 w-4" }),
|
|
2332
|
+
/* @__PURE__ */ jsx17("span", { children: thread.isArchived ? config.labels?.unarchiveThread || "Unarchive" : config.labels?.archiveThread || "Archive" })
|
|
2340
2333
|
] }),
|
|
2341
|
-
/* @__PURE__ */
|
|
2334
|
+
/* @__PURE__ */ jsx17(DropdownMenuSeparator, {}),
|
|
2342
2335
|
/* @__PURE__ */ jsxs9(
|
|
2343
2336
|
DropdownMenuItem,
|
|
2344
2337
|
{
|
|
2345
2338
|
onClick: () => setDeleteThreadId(thread.id),
|
|
2346
2339
|
className: "text-destructive focus:text-destructive",
|
|
2347
2340
|
children: [
|
|
2348
|
-
/* @__PURE__ */
|
|
2349
|
-
/* @__PURE__ */
|
|
2341
|
+
/* @__PURE__ */ jsx17(Trash2, { className: "mr-2 h-4 w-4" }),
|
|
2342
|
+
/* @__PURE__ */ jsx17("span", { children: config.labels?.deleteThread || "Delete" })
|
|
2350
2343
|
]
|
|
2351
2344
|
}
|
|
2352
2345
|
)
|
|
@@ -2355,7 +2348,7 @@ var Sidebar2 = ({
|
|
|
2355
2348
|
] }, thread.id)) }) })
|
|
2356
2349
|
] }, group))
|
|
2357
2350
|
] }),
|
|
2358
|
-
/* @__PURE__ */
|
|
2351
|
+
/* @__PURE__ */ jsx17(SidebarFooter, { children: /* @__PURE__ */ jsx17(
|
|
2359
2352
|
UserMenu,
|
|
2360
2353
|
{
|
|
2361
2354
|
user,
|
|
@@ -2366,15 +2359,15 @@ var Sidebar2 = ({
|
|
|
2366
2359
|
additionalItems: userMenuAdditionalItems
|
|
2367
2360
|
}
|
|
2368
2361
|
) }),
|
|
2369
|
-
/* @__PURE__ */
|
|
2370
|
-
deleteThreadId && /* @__PURE__ */
|
|
2362
|
+
/* @__PURE__ */ jsx17(SidebarRail, {}),
|
|
2363
|
+
deleteThreadId && /* @__PURE__ */ jsx17(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs9(AlertDialogContent, { children: [
|
|
2371
2364
|
/* @__PURE__ */ jsxs9(AlertDialogHeader, { children: [
|
|
2372
|
-
/* @__PURE__ */
|
|
2373
|
-
/* @__PURE__ */
|
|
2365
|
+
/* @__PURE__ */ jsx17(AlertDialogTitle, { children: config.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
2366
|
+
/* @__PURE__ */ jsx17(AlertDialogDescription, { children: config.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
2374
2367
|
] }),
|
|
2375
2368
|
/* @__PURE__ */ jsxs9(AlertDialogFooter, { children: [
|
|
2376
|
-
/* @__PURE__ */
|
|
2377
|
-
/* @__PURE__ */
|
|
2369
|
+
/* @__PURE__ */ jsx17(AlertDialogCancel, { children: config.labels?.cancel || "Cancel" }),
|
|
2370
|
+
/* @__PURE__ */ jsx17(
|
|
2378
2371
|
AlertDialogAction,
|
|
2379
2372
|
{
|
|
2380
2373
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|
|
@@ -2402,7 +2395,7 @@ import {
|
|
|
2402
2395
|
ChevronDown as ChevronDown2,
|
|
2403
2396
|
Check as Check2
|
|
2404
2397
|
} from "lucide-react";
|
|
2405
|
-
import { Fragment as Fragment3, jsx as
|
|
2398
|
+
import { Fragment as Fragment3, jsx as jsx18, jsxs as jsxs10 } from "react/jsx-runtime";
|
|
2406
2399
|
var ChatHeader = ({
|
|
2407
2400
|
config,
|
|
2408
2401
|
currentThreadTitle,
|
|
@@ -2470,35 +2463,35 @@ var ChatHeader = ({
|
|
|
2470
2463
|
};
|
|
2471
2464
|
const selectedAgent = agentOptions.find((agent) => agent.id === selectedAgentId) || null;
|
|
2472
2465
|
const agentPlaceholder = config.agentSelector?.label || "Select agent";
|
|
2473
|
-
return /* @__PURE__ */
|
|
2466
|
+
return /* @__PURE__ */ jsx18(
|
|
2474
2467
|
Card,
|
|
2475
2468
|
{
|
|
2476
2469
|
"data-chat-header": true,
|
|
2477
2470
|
className: `py-0 border-b rounded-none relative z-10 bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/80 ${className}`,
|
|
2478
2471
|
style: isMobile ? { paddingTop: "env(safe-area-inset-top)" } : void 0,
|
|
2479
|
-
children: /* @__PURE__ */
|
|
2472
|
+
children: /* @__PURE__ */ jsx18(CardHeader, { className: "p-2", children: /* @__PURE__ */ jsxs10("div", { className: "flex items-center justify-between gap-2", children: [
|
|
2480
2473
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2481
2474
|
/* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
2482
|
-
/* @__PURE__ */
|
|
2483
|
-
/* @__PURE__ */
|
|
2475
|
+
/* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(SidebarTrigger, { className: "-ml-1" }) }),
|
|
2476
|
+
/* @__PURE__ */ jsx18(TooltipContent, { children: config.labels?.sidebarToggle || "Toggle Sidebar" })
|
|
2484
2477
|
] }),
|
|
2485
2478
|
showAgentSelector && /* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2486
|
-
/* @__PURE__ */
|
|
2479
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsxs10(
|
|
2487
2480
|
Button,
|
|
2488
2481
|
{
|
|
2489
2482
|
variant: "ghost",
|
|
2490
2483
|
className: "h-9 px-3 gap-1.5 font-medium text-base hover:bg-accent/50",
|
|
2491
2484
|
children: [
|
|
2492
2485
|
selectedAgent?.avatarUrl ? /* @__PURE__ */ jsxs10(Avatar, { className: "h-5 w-5", children: [
|
|
2493
|
-
/* @__PURE__ */
|
|
2494
|
-
/* @__PURE__ */
|
|
2486
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: selectedAgent.avatarUrl, alt: selectedAgent.name }),
|
|
2487
|
+
/* @__PURE__ */ jsx18(AvatarFallback, { className: "text-[10px]", children: selectedAgent.name.charAt(0).toUpperCase() })
|
|
2495
2488
|
] }) : null,
|
|
2496
|
-
/* @__PURE__ */
|
|
2497
|
-
/* @__PURE__ */
|
|
2489
|
+
/* @__PURE__ */ jsx18("span", { className: "max-w-[200px] truncate", children: selectedAgent?.name || agentPlaceholder }),
|
|
2490
|
+
/* @__PURE__ */ jsx18(ChevronDown2, { className: "h-4 w-4 opacity-50" })
|
|
2498
2491
|
]
|
|
2499
2492
|
}
|
|
2500
2493
|
) }),
|
|
2501
|
-
/* @__PURE__ */
|
|
2494
|
+
/* @__PURE__ */ jsx18(DropdownMenuContent, { align: "start", className: "w-[280px]", children: agentOptions.map((agent) => {
|
|
2502
2495
|
const isSelected = agent.id === selectedAgentId;
|
|
2503
2496
|
return /* @__PURE__ */ jsxs10(
|
|
2504
2497
|
DropdownMenuItem,
|
|
@@ -2507,15 +2500,15 @@ var ChatHeader = ({
|
|
|
2507
2500
|
className: "flex items-start gap-3 p-3 cursor-pointer",
|
|
2508
2501
|
children: [
|
|
2509
2502
|
agent.avatarUrl ? /* @__PURE__ */ jsxs10(Avatar, { className: "h-6 w-6 mt-0.5 shrink-0", children: [
|
|
2510
|
-
/* @__PURE__ */
|
|
2511
|
-
/* @__PURE__ */
|
|
2512
|
-
] }) : /* @__PURE__ */
|
|
2503
|
+
/* @__PURE__ */ jsx18(AvatarImage, { src: agent.avatarUrl, alt: agent.name }),
|
|
2504
|
+
/* @__PURE__ */ jsx18(AvatarFallback, { className: "text-[10px]", children: agent.name.charAt(0).toUpperCase() })
|
|
2505
|
+
] }) : /* @__PURE__ */ jsx18("div", { className: "h-6 w-6 mt-0.5 shrink-0 flex items-center justify-center rounded-full bg-primary/10", children: /* @__PURE__ */ jsx18(Bot2, { className: "h-3.5 w-3.5 text-primary" }) }),
|
|
2513
2506
|
/* @__PURE__ */ jsxs10("div", { className: "flex-1 min-w-0", children: [
|
|
2514
2507
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-2", children: [
|
|
2515
|
-
/* @__PURE__ */
|
|
2516
|
-
isSelected && /* @__PURE__ */
|
|
2508
|
+
/* @__PURE__ */ jsx18("span", { className: "font-medium text-sm", children: agent.name }),
|
|
2509
|
+
isSelected && /* @__PURE__ */ jsx18(Check2, { className: "h-4 w-4 text-primary shrink-0" })
|
|
2517
2510
|
] }),
|
|
2518
|
-
agent.description && /* @__PURE__ */
|
|
2511
|
+
agent.description && /* @__PURE__ */ jsx18("p", { className: "text-xs text-muted-foreground mt-0.5 line-clamp-2", children: agent.description })
|
|
2519
2512
|
] })
|
|
2520
2513
|
]
|
|
2521
2514
|
},
|
|
@@ -2523,59 +2516,59 @@ var ChatHeader = ({
|
|
|
2523
2516
|
);
|
|
2524
2517
|
}) })
|
|
2525
2518
|
] }),
|
|
2526
|
-
!showAgentSelector && isMobile && /* @__PURE__ */
|
|
2519
|
+
!showAgentSelector && isMobile && /* @__PURE__ */ jsx18("span", { className: "text-sm font-medium truncate max-w-[150px] ml-2", children: currentThreadTitle || config.branding?.title || "Chat" })
|
|
2527
2520
|
] }),
|
|
2528
|
-
/* @__PURE__ */
|
|
2521
|
+
/* @__PURE__ */ jsx18("div", { className: "flex-1" }),
|
|
2529
2522
|
/* @__PURE__ */ jsxs10("div", { className: "flex items-center gap-1", children: [
|
|
2530
2523
|
showCustomComponentButton && config.customComponent && /* @__PURE__ */ jsxs10(Tooltip, { children: [
|
|
2531
|
-
/* @__PURE__ */
|
|
2524
|
+
/* @__PURE__ */ jsx18(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(
|
|
2532
2525
|
Button,
|
|
2533
2526
|
{
|
|
2534
2527
|
variant: "ghost",
|
|
2535
2528
|
size: "icon",
|
|
2536
2529
|
className: "h-8 w-8",
|
|
2537
2530
|
onClick: onCustomComponentToggle,
|
|
2538
|
-
children: config.customComponent.icon || /* @__PURE__ */
|
|
2531
|
+
children: config.customComponent.icon || /* @__PURE__ */ jsx18(Menu, { className: "h-4 w-4" })
|
|
2539
2532
|
}
|
|
2540
2533
|
) }),
|
|
2541
|
-
/* @__PURE__ */
|
|
2534
|
+
/* @__PURE__ */ jsx18(TooltipContent, { children: config.customComponent.label || config.labels?.customComponentToggle || "Toggle" })
|
|
2542
2535
|
] }),
|
|
2543
2536
|
config.headerActions,
|
|
2544
2537
|
/* @__PURE__ */ jsxs10(DropdownMenu, { children: [
|
|
2545
|
-
/* @__PURE__ */
|
|
2538
|
+
/* @__PURE__ */ jsx18(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx18(Button, { variant: "ghost", size: "icon", className: "h-8 w-8", children: /* @__PURE__ */ jsx18(MoreVertical, { className: "h-4 w-4" }) }) }),
|
|
2546
2539
|
/* @__PURE__ */ jsxs10(DropdownMenuContent, { align: "end", children: [
|
|
2547
2540
|
onNewThread && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2548
2541
|
/* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: () => onNewThread?.(), className: "font-medium text-primary", children: [
|
|
2549
|
-
/* @__PURE__ */
|
|
2542
|
+
/* @__PURE__ */ jsx18(Plus2, { className: "h-4 w-4 mr-2" }),
|
|
2550
2543
|
config.labels?.newThread || "New Thread"
|
|
2551
2544
|
] }),
|
|
2552
|
-
/* @__PURE__ */
|
|
2545
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {})
|
|
2553
2546
|
] }),
|
|
2554
2547
|
onExportData && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: onExportData, children: [
|
|
2555
|
-
/* @__PURE__ */
|
|
2548
|
+
/* @__PURE__ */ jsx18(Download, { className: "h-4 w-4 mr-2" }),
|
|
2556
2549
|
config.labels?.exportData || "Export Data"
|
|
2557
2550
|
] }),
|
|
2558
2551
|
onImportData && /* @__PURE__ */ jsxs10(DropdownMenuItem, { onClick: handleImportClick, children: [
|
|
2559
|
-
/* @__PURE__ */
|
|
2552
|
+
/* @__PURE__ */ jsx18(Upload, { className: "h-4 w-4 mr-2" }),
|
|
2560
2553
|
config.labels?.importData || "Import Data"
|
|
2561
2554
|
] }),
|
|
2562
|
-
(onExportData || onImportData) && /* @__PURE__ */
|
|
2563
|
-
/* @__PURE__ */
|
|
2564
|
-
/* @__PURE__ */
|
|
2555
|
+
(onExportData || onImportData) && /* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2556
|
+
/* @__PURE__ */ jsx18(DropdownMenuItem, { onClick: toggleDarkMode, children: isDarkMode ? /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2557
|
+
/* @__PURE__ */ jsx18(Sun2, { className: "h-4 w-4 mr-2" }),
|
|
2565
2558
|
config.labels?.lightMode || "Light Mode"
|
|
2566
2559
|
] }) : /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2567
|
-
/* @__PURE__ */
|
|
2560
|
+
/* @__PURE__ */ jsx18(Moon2, { className: "h-4 w-4 mr-2" }),
|
|
2568
2561
|
config.labels?.darkMode || "Dark Mode"
|
|
2569
2562
|
] }) }),
|
|
2570
2563
|
onClearAll && /* @__PURE__ */ jsxs10(Fragment3, { children: [
|
|
2571
|
-
/* @__PURE__ */
|
|
2564
|
+
/* @__PURE__ */ jsx18(DropdownMenuSeparator, {}),
|
|
2572
2565
|
/* @__PURE__ */ jsxs10(
|
|
2573
2566
|
DropdownMenuItem,
|
|
2574
2567
|
{
|
|
2575
2568
|
onClick: onClearAll,
|
|
2576
2569
|
className: "text-destructive",
|
|
2577
2570
|
children: [
|
|
2578
|
-
/* @__PURE__ */
|
|
2571
|
+
/* @__PURE__ */ jsx18(Trash22, { className: "h-4 w-4 mr-2" }),
|
|
2579
2572
|
config.labels?.clearAll || "Clear All"
|
|
2580
2573
|
]
|
|
2581
2574
|
}
|
|
@@ -2594,7 +2587,7 @@ import { useState as useState6, useRef as useRef6, useCallback as useCallback3,
|
|
|
2594
2587
|
|
|
2595
2588
|
// src/components/chat/UserContext.tsx
|
|
2596
2589
|
import { createContext as createContext2, useCallback as useCallback2, useContext as useContext2, useEffect as useEffect8, useMemo as useMemo2, useState as useState5 } from "react";
|
|
2597
|
-
import { jsx as
|
|
2590
|
+
import { jsx as jsx19 } from "react/jsx-runtime";
|
|
2598
2591
|
var Ctx = createContext2(void 0);
|
|
2599
2592
|
var ChatUserContextProvider = ({ children, initial }) => {
|
|
2600
2593
|
const [ctx, setCtx] = useState5(() => ({
|
|
@@ -2620,7 +2613,7 @@ var ChatUserContextProvider = ({ children, initial }) => {
|
|
|
2620
2613
|
setContext: setPartial,
|
|
2621
2614
|
resetContext: () => setCtx({ updatedAt: Date.now() })
|
|
2622
2615
|
}), [ctx, setPartial]);
|
|
2623
|
-
return /* @__PURE__ */
|
|
2616
|
+
return /* @__PURE__ */ jsx19(Ctx.Provider, { value, children });
|
|
2624
2617
|
};
|
|
2625
2618
|
function useChatUserContext() {
|
|
2626
2619
|
const v = useContext2(Ctx);
|
|
@@ -2630,13 +2623,13 @@ function useChatUserContext() {
|
|
|
2630
2623
|
|
|
2631
2624
|
// src/components/ui/progress.tsx
|
|
2632
2625
|
import * as ProgressPrimitive from "@radix-ui/react-progress";
|
|
2633
|
-
import { jsx as
|
|
2626
|
+
import { jsx as jsx20 } from "react/jsx-runtime";
|
|
2634
2627
|
function Progress({
|
|
2635
2628
|
className,
|
|
2636
2629
|
value,
|
|
2637
2630
|
...props
|
|
2638
2631
|
}) {
|
|
2639
|
-
return /* @__PURE__ */
|
|
2632
|
+
return /* @__PURE__ */ jsx20(
|
|
2640
2633
|
ProgressPrimitive.Root,
|
|
2641
2634
|
{
|
|
2642
2635
|
"data-slot": "progress",
|
|
@@ -2645,7 +2638,7 @@ function Progress({
|
|
|
2645
2638
|
className
|
|
2646
2639
|
),
|
|
2647
2640
|
...props,
|
|
2648
|
-
children: /* @__PURE__ */
|
|
2641
|
+
children: /* @__PURE__ */ jsx20(
|
|
2649
2642
|
ProgressPrimitive.Indicator,
|
|
2650
2643
|
{
|
|
2651
2644
|
"data-slot": "progress-indicator",
|
|
@@ -2671,7 +2664,7 @@ import {
|
|
|
2671
2664
|
Pause as Pause2,
|
|
2672
2665
|
Loader2
|
|
2673
2666
|
} from "lucide-react";
|
|
2674
|
-
import { Fragment as Fragment4, jsx as
|
|
2667
|
+
import { Fragment as Fragment4, jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2675
2668
|
var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }) {
|
|
2676
2669
|
const guessTypeFromName = (name) => {
|
|
2677
2670
|
const ext = (name || "").split(".").pop()?.toLowerCase();
|
|
@@ -2700,10 +2693,10 @@ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }
|
|
|
2700
2693
|
};
|
|
2701
2694
|
const getFileIcon = (type, name) => {
|
|
2702
2695
|
const t = typeof type === "string" && type.length > 0 ? type : guessTypeFromName(name);
|
|
2703
|
-
if (t.startsWith("image/")) return /* @__PURE__ */
|
|
2704
|
-
if (t.startsWith("video/")) return /* @__PURE__ */
|
|
2705
|
-
if (t.startsWith("audio/")) return /* @__PURE__ */
|
|
2706
|
-
return /* @__PURE__ */
|
|
2696
|
+
if (t.startsWith("image/")) return /* @__PURE__ */ jsx21(Image2, { className: "h-4 w-4" });
|
|
2697
|
+
if (t.startsWith("video/")) return /* @__PURE__ */ jsx21(Video, { className: "h-4 w-4" });
|
|
2698
|
+
if (t.startsWith("audio/")) return /* @__PURE__ */ jsx21(Mic, { className: "h-4 w-4" });
|
|
2699
|
+
return /* @__PURE__ */ jsx21(FileText, { className: "h-4 w-4" });
|
|
2707
2700
|
};
|
|
2708
2701
|
const formatFileSize = (bytes) => {
|
|
2709
2702
|
if (bytes === 0) return "0 Bytes";
|
|
@@ -2712,21 +2705,21 @@ var FileUploadItem = memo2(function FileUploadItem2({ file, progress, onCancel }
|
|
|
2712
2705
|
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
2713
2706
|
return parseFloat((bytes / Math.pow(k, i)).toFixed(2)) + " " + sizes[i];
|
|
2714
2707
|
};
|
|
2715
|
-
return /* @__PURE__ */
|
|
2708
|
+
return /* @__PURE__ */ jsx21(Card, { className: "relative", children: /* @__PURE__ */ jsx21(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
|
|
2716
2709
|
getFileIcon(file.type, file.name),
|
|
2717
2710
|
/* @__PURE__ */ jsxs11("div", { className: "flex-1 min-w-0", children: [
|
|
2718
|
-
/* @__PURE__ */
|
|
2719
|
-
/* @__PURE__ */
|
|
2720
|
-
/* @__PURE__ */
|
|
2711
|
+
/* @__PURE__ */ jsx21("p", { className: "text-sm font-medium truncate", children: file.name }),
|
|
2712
|
+
/* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: formatFileSize(file.size ?? 0) }),
|
|
2713
|
+
/* @__PURE__ */ jsx21(Progress, { value: progress, className: "h-1 mt-1" })
|
|
2721
2714
|
] }),
|
|
2722
|
-
/* @__PURE__ */
|
|
2715
|
+
/* @__PURE__ */ jsx21(
|
|
2723
2716
|
Button,
|
|
2724
2717
|
{
|
|
2725
2718
|
variant: "ghost",
|
|
2726
2719
|
size: "icon",
|
|
2727
2720
|
className: "h-6 w-6",
|
|
2728
2721
|
onClick: onCancel,
|
|
2729
|
-
children: /* @__PURE__ */
|
|
2722
|
+
children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
|
|
2730
2723
|
}
|
|
2731
2724
|
)
|
|
2732
2725
|
] }) }) });
|
|
@@ -2750,9 +2743,9 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
2750
2743
|
const minutes = Math.floor(seconds / 60);
|
|
2751
2744
|
return `${minutes}:${(seconds % 60).toString().padStart(2, "0")}`;
|
|
2752
2745
|
};
|
|
2753
|
-
return /* @__PURE__ */
|
|
2746
|
+
return /* @__PURE__ */ jsx21(Card, { className: "relative group", children: /* @__PURE__ */ jsxs11(CardContent, { className: "p-2", children: [
|
|
2754
2747
|
attachment.kind === "image" && /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
|
|
2755
|
-
/* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ jsx21(
|
|
2756
2749
|
"img",
|
|
2757
2750
|
{
|
|
2758
2751
|
src: attachment.dataUrl,
|
|
@@ -2760,19 +2753,19 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
2760
2753
|
className: "w-full h-20 object-cover rounded"
|
|
2761
2754
|
}
|
|
2762
2755
|
),
|
|
2763
|
-
/* @__PURE__ */
|
|
2756
|
+
/* @__PURE__ */ jsx21("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx21(
|
|
2764
2757
|
Button,
|
|
2765
2758
|
{
|
|
2766
2759
|
variant: "destructive",
|
|
2767
2760
|
size: "icon",
|
|
2768
2761
|
className: "h-6 w-6",
|
|
2769
2762
|
onClick: onRemove,
|
|
2770
|
-
children: /* @__PURE__ */
|
|
2763
|
+
children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
|
|
2771
2764
|
}
|
|
2772
2765
|
) })
|
|
2773
2766
|
] }),
|
|
2774
2767
|
attachment.kind === "video" && /* @__PURE__ */ jsxs11("div", { className: "relative", children: [
|
|
2775
|
-
/* @__PURE__ */
|
|
2768
|
+
/* @__PURE__ */ jsx21(
|
|
2776
2769
|
"video",
|
|
2777
2770
|
{
|
|
2778
2771
|
src: attachment.dataUrl,
|
|
@@ -2781,34 +2774,34 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
2781
2774
|
muted: true
|
|
2782
2775
|
}
|
|
2783
2776
|
),
|
|
2784
|
-
/* @__PURE__ */
|
|
2777
|
+
/* @__PURE__ */ jsx21("div", { className: "absolute inset-0 bg-black/50 opacity-0 group-hover:opacity-100 transition-opacity rounded flex items-center justify-center", children: /* @__PURE__ */ jsx21(
|
|
2785
2778
|
Button,
|
|
2786
2779
|
{
|
|
2787
2780
|
variant: "destructive",
|
|
2788
2781
|
size: "icon",
|
|
2789
2782
|
className: "h-6 w-6",
|
|
2790
2783
|
onClick: onRemove,
|
|
2791
|
-
children: /* @__PURE__ */
|
|
2784
|
+
children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
|
|
2792
2785
|
}
|
|
2793
2786
|
) }),
|
|
2794
|
-
/* @__PURE__ */
|
|
2787
|
+
/* @__PURE__ */ jsx21(Badge, { className: "absolute bottom-1 right-1 text-xs", children: formatDuration(attachment.durationMs) })
|
|
2795
2788
|
] }),
|
|
2796
2789
|
attachment.kind === "audio" && /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2 p-2", children: [
|
|
2797
|
-
/* @__PURE__ */
|
|
2790
|
+
/* @__PURE__ */ jsx21(
|
|
2798
2791
|
Button,
|
|
2799
2792
|
{
|
|
2800
2793
|
variant: "outline",
|
|
2801
2794
|
size: "icon",
|
|
2802
2795
|
className: "h-8 w-8",
|
|
2803
2796
|
onClick: handlePlayPause,
|
|
2804
|
-
children: isPlaying ? /* @__PURE__ */
|
|
2797
|
+
children: isPlaying ? /* @__PURE__ */ jsx21(Pause2, { className: "h-3 w-3" }) : /* @__PURE__ */ jsx21(Play2, { className: "h-3 w-3" })
|
|
2805
2798
|
}
|
|
2806
2799
|
),
|
|
2807
2800
|
/* @__PURE__ */ jsxs11("div", { className: "flex-1", children: [
|
|
2808
|
-
/* @__PURE__ */
|
|
2809
|
-
/* @__PURE__ */
|
|
2801
|
+
/* @__PURE__ */ jsx21("p", { className: "text-xs font-medium", children: attachment.fileName || "\xC1udio" }),
|
|
2802
|
+
/* @__PURE__ */ jsx21("p", { className: "text-xs text-muted-foreground", children: formatDuration(attachment.durationMs) })
|
|
2810
2803
|
] }),
|
|
2811
|
-
/* @__PURE__ */
|
|
2804
|
+
/* @__PURE__ */ jsx21(
|
|
2812
2805
|
"audio",
|
|
2813
2806
|
{
|
|
2814
2807
|
ref: audioRef,
|
|
@@ -2818,18 +2811,18 @@ var AttachmentPreview = memo2(function AttachmentPreview2({ attachment, onRemove
|
|
|
2818
2811
|
onEnded: () => setIsPlaying(false)
|
|
2819
2812
|
}
|
|
2820
2813
|
),
|
|
2821
|
-
/* @__PURE__ */
|
|
2814
|
+
/* @__PURE__ */ jsx21(
|
|
2822
2815
|
Button,
|
|
2823
2816
|
{
|
|
2824
2817
|
variant: "ghost",
|
|
2825
2818
|
size: "icon",
|
|
2826
2819
|
className: "h-6 w-6 opacity-0 group-hover:opacity-100 transition-opacity",
|
|
2827
2820
|
onClick: onRemove,
|
|
2828
|
-
children: /* @__PURE__ */
|
|
2821
|
+
children: /* @__PURE__ */ jsx21(X2, { className: "h-3 w-3" })
|
|
2829
2822
|
}
|
|
2830
2823
|
)
|
|
2831
2824
|
] }),
|
|
2832
|
-
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */
|
|
2825
|
+
attachment.fileName && attachment.kind !== "audio" && /* @__PURE__ */ jsx21("div", { className: "absolute bottom-0 left-0 right-0 bg-black/70 text-white text-xs p-1 rounded-b", children: /* @__PURE__ */ jsx21("p", { className: "truncate", children: attachment.fileName }) })
|
|
2833
2826
|
] }) });
|
|
2834
2827
|
});
|
|
2835
2828
|
var AudioRecorder = memo2(function AudioRecorder2({ isRecording, onStartRecording, onStopRecording, onCancel, recordingDuration, config }) {
|
|
@@ -2840,25 +2833,25 @@ var AudioRecorder = memo2(function AudioRecorder2({ isRecording, onStartRecordin
|
|
|
2840
2833
|
};
|
|
2841
2834
|
if (!isRecording) {
|
|
2842
2835
|
return /* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
2843
|
-
/* @__PURE__ */
|
|
2836
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
2844
2837
|
Button,
|
|
2845
2838
|
{
|
|
2846
2839
|
variant: "outline",
|
|
2847
2840
|
size: "icon",
|
|
2848
2841
|
onClick: onStartRecording,
|
|
2849
2842
|
className: "h-10 w-10",
|
|
2850
|
-
children: /* @__PURE__ */
|
|
2843
|
+
children: /* @__PURE__ */ jsx21(Mic, { className: "h-4 w-4" })
|
|
2851
2844
|
}
|
|
2852
2845
|
) }),
|
|
2853
|
-
/* @__PURE__ */
|
|
2846
|
+
/* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.recordAudioTooltip })
|
|
2854
2847
|
] });
|
|
2855
2848
|
}
|
|
2856
|
-
return /* @__PURE__ */
|
|
2849
|
+
return /* @__PURE__ */ jsx21(Card, { className: "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950", children: /* @__PURE__ */ jsx21(CardContent, { className: "p-3", children: /* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-3", children: [
|
|
2857
2850
|
/* @__PURE__ */ jsxs11("div", { className: "flex items-center gap-2", children: [
|
|
2858
|
-
/* @__PURE__ */
|
|
2859
|
-
/* @__PURE__ */
|
|
2851
|
+
/* @__PURE__ */ jsx21("div", { className: "h-3 w-3 bg-red-500 rounded-full animate-pulse" }),
|
|
2852
|
+
/* @__PURE__ */ jsx21("span", { className: "text-sm font-medium text-red-700 dark:text-red-300", children: "Gravando" })
|
|
2860
2853
|
] }),
|
|
2861
|
-
/* @__PURE__ */
|
|
2854
|
+
/* @__PURE__ */ jsx21(Badge, { variant: "outline", className: "text-xs", children: formatTime(recordingDuration) }),
|
|
2862
2855
|
/* @__PURE__ */ jsxs11("div", { className: "flex gap-1 ml-auto", children: [
|
|
2863
2856
|
/* @__PURE__ */ jsxs11(
|
|
2864
2857
|
Button,
|
|
@@ -2867,7 +2860,7 @@ var AudioRecorder = memo2(function AudioRecorder2({ isRecording, onStartRecordin
|
|
|
2867
2860
|
size: "sm",
|
|
2868
2861
|
onClick: onCancel,
|
|
2869
2862
|
children: [
|
|
2870
|
-
/* @__PURE__ */
|
|
2863
|
+
/* @__PURE__ */ jsx21(X2, { className: "h-3 w-3 mr-1" }),
|
|
2871
2864
|
"Cancelar"
|
|
2872
2865
|
]
|
|
2873
2866
|
}
|
|
@@ -2879,7 +2872,7 @@ var AudioRecorder = memo2(function AudioRecorder2({ isRecording, onStartRecordin
|
|
|
2879
2872
|
size: "sm",
|
|
2880
2873
|
onClick: onStopRecording,
|
|
2881
2874
|
children: [
|
|
2882
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ jsx21(Square, { className: "h-3 w-3 mr-1" }),
|
|
2883
2876
|
"Parar"
|
|
2884
2877
|
]
|
|
2885
2878
|
}
|
|
@@ -3105,8 +3098,8 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3105
3098
|
onAttachmentsChange(newAttachments);
|
|
3106
3099
|
};
|
|
3107
3100
|
const canAddMoreAttachments = attachments.length < maxAttachments;
|
|
3108
|
-
return /* @__PURE__ */
|
|
3109
|
-
uploadProgress.size > 0 && /* @__PURE__ */
|
|
3101
|
+
return /* @__PURE__ */ jsx21(TooltipProvider, { children: /* @__PURE__ */ jsx21("div", { className: `border-t py-0 bg-transparent ${className}`, children: /* @__PURE__ */ jsxs11("div", { className: "px-0 md:p-2 pb-1 space-y-4 bg-transparent", children: [
|
|
3102
|
+
uploadProgress.size > 0 && /* @__PURE__ */ jsx21("div", { className: "space-y-2", children: Array.from(uploadProgress.entries()).map(([id, progress]) => /* @__PURE__ */ jsx21(
|
|
3110
3103
|
FileUploadItem,
|
|
3111
3104
|
{
|
|
3112
3105
|
file: { name: progress.fileName },
|
|
@@ -3121,7 +3114,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3121
3114
|
},
|
|
3122
3115
|
id
|
|
3123
3116
|
)) }),
|
|
3124
|
-
isRecording && /* @__PURE__ */
|
|
3117
|
+
isRecording && /* @__PURE__ */ jsx21(
|
|
3125
3118
|
AudioRecorder,
|
|
3126
3119
|
{
|
|
3127
3120
|
isRecording,
|
|
@@ -3132,7 +3125,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3132
3125
|
config
|
|
3133
3126
|
}
|
|
3134
3127
|
),
|
|
3135
|
-
attachments.length > 0 && /* @__PURE__ */
|
|
3128
|
+
attachments.length > 0 && /* @__PURE__ */ jsx21("div", { className: "grid grid-cols-4 gap-2", children: attachments.map((attachment, index) => /* @__PURE__ */ jsx21(
|
|
3136
3129
|
AttachmentPreview,
|
|
3137
3130
|
{
|
|
3138
3131
|
attachment,
|
|
@@ -3140,7 +3133,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3140
3133
|
},
|
|
3141
3134
|
index
|
|
3142
3135
|
)) }),
|
|
3143
|
-
/* @__PURE__ */
|
|
3136
|
+
/* @__PURE__ */ jsx21("form", { onSubmit: handleSubmit, className: "mb-1 flex justify-center", children: /* @__PURE__ */ jsxs11(
|
|
3144
3137
|
"div",
|
|
3145
3138
|
{
|
|
3146
3139
|
className: "flex items-end gap-2 p-3 border rounded-lg bg-background w-full md:min-w-3xl max-w-3xl",
|
|
@@ -3148,7 +3141,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3148
3141
|
onDragOver: handleDragOver,
|
|
3149
3142
|
children: [
|
|
3150
3143
|
enableFileUpload && canAddMoreAttachments && /* @__PURE__ */ jsxs11(Fragment4, { children: [
|
|
3151
|
-
/* @__PURE__ */
|
|
3144
|
+
/* @__PURE__ */ jsx21(
|
|
3152
3145
|
"input",
|
|
3153
3146
|
{
|
|
3154
3147
|
ref: fileInputRef,
|
|
@@ -3160,7 +3153,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3160
3153
|
}
|
|
3161
3154
|
),
|
|
3162
3155
|
/* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
3163
|
-
/* @__PURE__ */
|
|
3156
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
3164
3157
|
Button,
|
|
3165
3158
|
{
|
|
3166
3159
|
type: "button",
|
|
@@ -3173,13 +3166,13 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3173
3166
|
fileInputRef.current?.click();
|
|
3174
3167
|
},
|
|
3175
3168
|
disabled,
|
|
3176
|
-
children: /* @__PURE__ */
|
|
3169
|
+
children: /* @__PURE__ */ jsx21(Paperclip, { className: "h-4 w-4" })
|
|
3177
3170
|
}
|
|
3178
3171
|
) }),
|
|
3179
|
-
/* @__PURE__ */
|
|
3172
|
+
/* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.attachFileTooltip })
|
|
3180
3173
|
] })
|
|
3181
3174
|
] }),
|
|
3182
|
-
/* @__PURE__ */
|
|
3175
|
+
/* @__PURE__ */ jsx21("div", { className: "flex-1", children: /* @__PURE__ */ jsx21(
|
|
3183
3176
|
Textarea,
|
|
3184
3177
|
{
|
|
3185
3178
|
ref: textareaRef,
|
|
@@ -3192,7 +3185,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3192
3185
|
rows: 1
|
|
3193
3186
|
}
|
|
3194
3187
|
) }),
|
|
3195
|
-
enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */
|
|
3188
|
+
enableAudioRecording && !isRecording && canAddMoreAttachments && !value.trim() && /* @__PURE__ */ jsx21(
|
|
3196
3189
|
AudioRecorder,
|
|
3197
3190
|
{
|
|
3198
3191
|
isRecording,
|
|
@@ -3204,7 +3197,7 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3204
3197
|
}
|
|
3205
3198
|
),
|
|
3206
3199
|
isGenerating ? /* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
3207
|
-
/* @__PURE__ */
|
|
3200
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
3208
3201
|
Button,
|
|
3209
3202
|
{
|
|
3210
3203
|
type: "button",
|
|
@@ -3212,22 +3205,22 @@ var ChatInput = memo2(function ChatInput2({
|
|
|
3212
3205
|
size: "icon",
|
|
3213
3206
|
className: "h-10 w-10",
|
|
3214
3207
|
onClick: onStopGeneration,
|
|
3215
|
-
children: /* @__PURE__ */
|
|
3208
|
+
children: /* @__PURE__ */ jsx21(Square, { className: "h-4 w-4" })
|
|
3216
3209
|
}
|
|
3217
3210
|
) }),
|
|
3218
|
-
/* @__PURE__ */
|
|
3211
|
+
/* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.stopGenerationTooltip })
|
|
3219
3212
|
] }) : /* @__PURE__ */ jsxs11(Tooltip, { children: [
|
|
3220
|
-
/* @__PURE__ */
|
|
3213
|
+
/* @__PURE__ */ jsx21(TooltipTrigger, { asChild: true, children: /* @__PURE__ */ jsx21(
|
|
3221
3214
|
Button,
|
|
3222
3215
|
{
|
|
3223
3216
|
type: "submit",
|
|
3224
3217
|
size: "icon",
|
|
3225
3218
|
className: "h-10 w-10",
|
|
3226
3219
|
disabled: disabled || !value.trim() && attachments.length === 0,
|
|
3227
|
-
children: disabled ? /* @__PURE__ */
|
|
3220
|
+
children: disabled ? /* @__PURE__ */ jsx21(Loader2, { className: "h-4 w-4 animate-spin" }) : /* @__PURE__ */ jsx21(Send, { className: "h-4 w-4" })
|
|
3228
3221
|
}
|
|
3229
3222
|
) }),
|
|
3230
|
-
/* @__PURE__ */
|
|
3223
|
+
/* @__PURE__ */ jsx21(TooltipContent, { children: config?.labels?.sendMessageTooltip })
|
|
3231
3224
|
] })
|
|
3232
3225
|
]
|
|
3233
3226
|
}
|
|
@@ -3255,7 +3248,7 @@ import { useState as useState7 } from "react";
|
|
|
3255
3248
|
// src/components/ui/scroll-area.tsx
|
|
3256
3249
|
import * as React11 from "react";
|
|
3257
3250
|
import * as ScrollAreaPrimitive from "@radix-ui/react-scroll-area";
|
|
3258
|
-
import { jsx as
|
|
3251
|
+
import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
|
|
3259
3252
|
var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, onScroll, onScrollCapture, ...props }, ref) => {
|
|
3260
3253
|
return /* @__PURE__ */ jsxs12(
|
|
3261
3254
|
ScrollAreaPrimitive.Root,
|
|
@@ -3264,7 +3257,7 @@ var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, o
|
|
|
3264
3257
|
className: cn("relative", className),
|
|
3265
3258
|
...props,
|
|
3266
3259
|
children: [
|
|
3267
|
-
/* @__PURE__ */
|
|
3260
|
+
/* @__PURE__ */ jsx22(
|
|
3268
3261
|
ScrollAreaPrimitive.Viewport,
|
|
3269
3262
|
{
|
|
3270
3263
|
ref,
|
|
@@ -3278,8 +3271,8 @@ var ScrollArea = React11.forwardRef(({ className, children, viewportClassName, o
|
|
|
3278
3271
|
children
|
|
3279
3272
|
}
|
|
3280
3273
|
),
|
|
3281
|
-
/* @__PURE__ */
|
|
3282
|
-
/* @__PURE__ */
|
|
3274
|
+
/* @__PURE__ */ jsx22(ScrollBar, {}),
|
|
3275
|
+
/* @__PURE__ */ jsx22(ScrollAreaPrimitive.Corner, {})
|
|
3283
3276
|
]
|
|
3284
3277
|
}
|
|
3285
3278
|
);
|
|
@@ -3290,7 +3283,7 @@ function ScrollBar({
|
|
|
3290
3283
|
orientation = "vertical",
|
|
3291
3284
|
...props
|
|
3292
3285
|
}) {
|
|
3293
|
-
return /* @__PURE__ */
|
|
3286
|
+
return /* @__PURE__ */ jsx22(
|
|
3294
3287
|
ScrollAreaPrimitive.ScrollAreaScrollbar,
|
|
3295
3288
|
{
|
|
3296
3289
|
"data-slot": "scroll-area-scrollbar",
|
|
@@ -3302,7 +3295,7 @@ function ScrollBar({
|
|
|
3302
3295
|
className
|
|
3303
3296
|
),
|
|
3304
3297
|
...props,
|
|
3305
|
-
children: /* @__PURE__ */
|
|
3298
|
+
children: /* @__PURE__ */ jsx22(
|
|
3306
3299
|
ScrollAreaPrimitive.ScrollAreaThumb,
|
|
3307
3300
|
{
|
|
3308
3301
|
"data-slot": "scroll-area-thumb",
|
|
@@ -3341,7 +3334,7 @@ import {
|
|
|
3341
3334
|
Check as Check3,
|
|
3342
3335
|
X as X3
|
|
3343
3336
|
} from "lucide-react";
|
|
3344
|
-
import { Fragment as Fragment5, jsx as
|
|
3337
|
+
import { Fragment as Fragment5, jsx as jsx23, jsxs as jsxs13 } from "react/jsx-runtime";
|
|
3345
3338
|
var getInitials2 = (name, email) => {
|
|
3346
3339
|
if (name) {
|
|
3347
3340
|
return name.split(" ").map((n) => n[0]).slice(0, 2).join("").toUpperCase();
|
|
@@ -3355,29 +3348,29 @@ var getFieldIcon = (type, key) => {
|
|
|
3355
3348
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
3356
3349
|
switch (type) {
|
|
3357
3350
|
case "email":
|
|
3358
|
-
return /* @__PURE__ */
|
|
3351
|
+
return /* @__PURE__ */ jsx23(Mail, { className: iconClass });
|
|
3359
3352
|
case "phone":
|
|
3360
|
-
return /* @__PURE__ */
|
|
3353
|
+
return /* @__PURE__ */ jsx23(Phone, { className: iconClass });
|
|
3361
3354
|
case "url":
|
|
3362
|
-
return /* @__PURE__ */
|
|
3355
|
+
return /* @__PURE__ */ jsx23(Globe, { className: iconClass });
|
|
3363
3356
|
case "date":
|
|
3364
|
-
return /* @__PURE__ */
|
|
3357
|
+
return /* @__PURE__ */ jsx23(Calendar, { className: iconClass });
|
|
3365
3358
|
}
|
|
3366
3359
|
const lowerKey = key?.toLowerCase() || "";
|
|
3367
|
-
if (lowerKey.includes("follower")) return /* @__PURE__ */
|
|
3368
|
-
if (lowerKey.includes("following")) return /* @__PURE__ */
|
|
3369
|
-
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */
|
|
3370
|
-
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */
|
|
3371
|
-
if (lowerKey.includes("bio")) return /* @__PURE__ */
|
|
3372
|
-
if (lowerKey.includes("email")) return /* @__PURE__ */
|
|
3373
|
-
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */
|
|
3374
|
-
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */
|
|
3375
|
-
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */
|
|
3376
|
-
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */
|
|
3377
|
-
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */
|
|
3378
|
-
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */
|
|
3379
|
-
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */
|
|
3380
|
-
return /* @__PURE__ */
|
|
3360
|
+
if (lowerKey.includes("follower")) return /* @__PURE__ */ jsx23(Users, { className: iconClass });
|
|
3361
|
+
if (lowerKey.includes("following")) return /* @__PURE__ */ jsx23(UserPlus, { className: iconClass });
|
|
3362
|
+
if (lowerKey.includes("post") || lowerKey.includes("publication")) return /* @__PURE__ */ jsx23(Image3, { className: iconClass });
|
|
3363
|
+
if (lowerKey.includes("verified") || lowerKey.includes("badge")) return /* @__PURE__ */ jsx23(BadgeCheck, { className: iconClass });
|
|
3364
|
+
if (lowerKey.includes("bio")) return /* @__PURE__ */ jsx23(FileText2, { className: iconClass });
|
|
3365
|
+
if (lowerKey.includes("email")) return /* @__PURE__ */ jsx23(Mail, { className: iconClass });
|
|
3366
|
+
if (lowerKey.includes("phone") || lowerKey.includes("tel")) return /* @__PURE__ */ jsx23(Phone, { className: iconClass });
|
|
3367
|
+
if (lowerKey.includes("location") || lowerKey.includes("address") || lowerKey.includes("city")) return /* @__PURE__ */ jsx23(MapPin, { className: iconClass });
|
|
3368
|
+
if (lowerKey.includes("company") || lowerKey.includes("org")) return /* @__PURE__ */ jsx23(Building, { className: iconClass });
|
|
3369
|
+
if (lowerKey.includes("job") || lowerKey.includes("role") || lowerKey.includes("title") || lowerKey.includes("position")) return /* @__PURE__ */ jsx23(Briefcase, { className: iconClass });
|
|
3370
|
+
if (lowerKey.includes("website") || lowerKey.includes("url") || lowerKey.includes("link")) return /* @__PURE__ */ jsx23(Globe, { className: iconClass });
|
|
3371
|
+
if (lowerKey.includes("username") || lowerKey.includes("handle")) return /* @__PURE__ */ jsx23(AtSign, { className: iconClass });
|
|
3372
|
+
if (lowerKey.includes("date") || lowerKey.includes("birthday") || lowerKey.includes("joined")) return /* @__PURE__ */ jsx23(Calendar, { className: iconClass });
|
|
3373
|
+
return /* @__PURE__ */ jsx23(User2, { className: iconClass });
|
|
3381
3374
|
};
|
|
3382
3375
|
var formatValue = (value, type, key) => {
|
|
3383
3376
|
if (value === null || value === void 0) return "-";
|
|
@@ -3411,15 +3404,15 @@ var getMemoryCategoryIcon = (category) => {
|
|
|
3411
3404
|
const iconClass = "h-4 w-4 text-muted-foreground";
|
|
3412
3405
|
switch (category) {
|
|
3413
3406
|
case "preference":
|
|
3414
|
-
return /* @__PURE__ */
|
|
3407
|
+
return /* @__PURE__ */ jsx23(Heart, { className: iconClass });
|
|
3415
3408
|
case "fact":
|
|
3416
|
-
return /* @__PURE__ */
|
|
3409
|
+
return /* @__PURE__ */ jsx23(Info, { className: iconClass });
|
|
3417
3410
|
case "goal":
|
|
3418
|
-
return /* @__PURE__ */
|
|
3411
|
+
return /* @__PURE__ */ jsx23(Target, { className: iconClass });
|
|
3419
3412
|
case "context":
|
|
3420
|
-
return /* @__PURE__ */
|
|
3413
|
+
return /* @__PURE__ */ jsx23(Lightbulb, { className: iconClass });
|
|
3421
3414
|
default:
|
|
3422
|
-
return /* @__PURE__ */
|
|
3415
|
+
return /* @__PURE__ */ jsx23(Brain, { className: iconClass });
|
|
3423
3416
|
}
|
|
3424
3417
|
};
|
|
3425
3418
|
var getMemoryCategoryLabel = (category) => {
|
|
@@ -3489,66 +3482,66 @@ var UserProfile = ({
|
|
|
3489
3482
|
const displayName = user?.name || user?.email?.split("@")[0] || "User";
|
|
3490
3483
|
const initials = getInitials2(user?.name, user?.email);
|
|
3491
3484
|
const normalizedFields = normalizeCustomFields(customFields);
|
|
3492
|
-
return /* @__PURE__ */
|
|
3485
|
+
return /* @__PURE__ */ jsx23(Sheet, { open: isOpen, onOpenChange: (open) => !open && onClose(), children: /* @__PURE__ */ jsxs13(
|
|
3493
3486
|
SheetContent,
|
|
3494
3487
|
{
|
|
3495
3488
|
side: "right",
|
|
3496
3489
|
className: cn("w-full sm:max-w-md p-0 flex flex-col h-full overflow-hidden", className),
|
|
3497
3490
|
children: [
|
|
3498
|
-
/* @__PURE__ */
|
|
3499
|
-
/* @__PURE__ */
|
|
3491
|
+
/* @__PURE__ */ jsx23(SheetHeader, { className: "px-6 py-4 border-b shrink-0", children: /* @__PURE__ */ jsx23("div", { className: "flex items-center justify-between", children: /* @__PURE__ */ jsx23(SheetTitle, { children: labels.title }) }) }),
|
|
3492
|
+
/* @__PURE__ */ jsx23(ScrollArea, { className: "flex-1 min-h-0", children: /* @__PURE__ */ jsxs13("div", { className: "p-6 space-y-6", children: [
|
|
3500
3493
|
/* @__PURE__ */ jsxs13("div", { className: "flex flex-col items-center text-center space-y-4", children: [
|
|
3501
3494
|
/* @__PURE__ */ jsxs13(Avatar, { className: "h-24 w-24 shrink-0", children: [
|
|
3502
|
-
user?.avatar && /* @__PURE__ */
|
|
3503
|
-
/* @__PURE__ */
|
|
3495
|
+
user?.avatar && /* @__PURE__ */ jsx23(AvatarImage, { src: user.avatar, alt: displayName }),
|
|
3496
|
+
/* @__PURE__ */ jsx23(AvatarFallback, { className: "text-2xl bg-primary/10 text-primary", children: initials })
|
|
3504
3497
|
] }),
|
|
3505
3498
|
/* @__PURE__ */ jsxs13("div", { className: "w-full px-2", children: [
|
|
3506
|
-
/* @__PURE__ */
|
|
3507
|
-
user?.email && /* @__PURE__ */
|
|
3499
|
+
/* @__PURE__ */ jsx23("h2", { className: "text-xl font-semibold break-words", children: displayName }),
|
|
3500
|
+
user?.email && /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground break-words", children: user.email })
|
|
3508
3501
|
] })
|
|
3509
3502
|
] }),
|
|
3510
|
-
/* @__PURE__ */
|
|
3503
|
+
/* @__PURE__ */ jsx23(Separator, {}),
|
|
3511
3504
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
|
|
3512
|
-
/* @__PURE__ */
|
|
3505
|
+
/* @__PURE__ */ jsx23("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.basicInfo }),
|
|
3513
3506
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
3514
3507
|
/* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
3515
|
-
/* @__PURE__ */
|
|
3508
|
+
/* @__PURE__ */ jsx23(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
3516
3509
|
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3517
|
-
/* @__PURE__ */
|
|
3518
|
-
/* @__PURE__ */
|
|
3510
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: "Name" }),
|
|
3511
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm font-medium break-words", children: displayName })
|
|
3519
3512
|
] })
|
|
3520
3513
|
] }),
|
|
3521
3514
|
user?.email && /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
3522
|
-
/* @__PURE__ */
|
|
3515
|
+
/* @__PURE__ */ jsx23(AtSign, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
3523
3516
|
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3524
|
-
/* @__PURE__ */
|
|
3525
|
-
/* @__PURE__ */
|
|
3517
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: "Handle" }),
|
|
3518
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm font-medium break-words", children: user.email })
|
|
3526
3519
|
] })
|
|
3527
3520
|
] }),
|
|
3528
3521
|
user?.id && user.id !== user?.name && user.id !== user?.email && /* @__PURE__ */ jsxs13("div", { className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50", children: [
|
|
3529
|
-
/* @__PURE__ */
|
|
3522
|
+
/* @__PURE__ */ jsx23(User2, { className: "h-4 w-4 text-muted-foreground mt-0.5 shrink-0" }),
|
|
3530
3523
|
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3531
|
-
/* @__PURE__ */
|
|
3532
|
-
/* @__PURE__ */
|
|
3524
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: "ID" }),
|
|
3525
|
+
/* @__PURE__ */ jsx23("p", { className: "text-sm font-medium break-words", children: user.id })
|
|
3533
3526
|
] })
|
|
3534
3527
|
] })
|
|
3535
3528
|
] })
|
|
3536
3529
|
] }),
|
|
3537
3530
|
normalizedFields.length > 0 && /* @__PURE__ */ jsxs13(Fragment5, { children: [
|
|
3538
|
-
/* @__PURE__ */
|
|
3531
|
+
/* @__PURE__ */ jsx23(Separator, {}),
|
|
3539
3532
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
|
|
3540
|
-
/* @__PURE__ */
|
|
3541
|
-
/* @__PURE__ */
|
|
3533
|
+
/* @__PURE__ */ jsx23("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider", children: labels.customFields }),
|
|
3534
|
+
/* @__PURE__ */ jsx23("div", { className: "space-y-2", children: normalizedFields.map((field) => {
|
|
3542
3535
|
const isBioField = field.key.toLowerCase().includes("bio");
|
|
3543
3536
|
return /* @__PURE__ */ jsxs13(
|
|
3544
3537
|
"div",
|
|
3545
3538
|
{
|
|
3546
3539
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50",
|
|
3547
3540
|
children: [
|
|
3548
|
-
/* @__PURE__ */
|
|
3541
|
+
/* @__PURE__ */ jsx23("div", { className: "mt-0.5 shrink-0", children: field.icon || getFieldIcon(field.type, field.key) }),
|
|
3549
3542
|
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3550
|
-
/* @__PURE__ */
|
|
3551
|
-
/* @__PURE__ */
|
|
3543
|
+
/* @__PURE__ */ jsx23("p", { className: "text-xs text-muted-foreground", children: field.label }),
|
|
3544
|
+
/* @__PURE__ */ jsx23("p", { className: cn(
|
|
3552
3545
|
"text-sm font-medium",
|
|
3553
3546
|
isBioField ? "whitespace-pre-wrap break-words" : "break-words"
|
|
3554
3547
|
), children: formatValue(field.value, field.type, field.key) })
|
|
@@ -3560,26 +3553,26 @@ var UserProfile = ({
|
|
|
3560
3553
|
}) })
|
|
3561
3554
|
] })
|
|
3562
3555
|
] }),
|
|
3563
|
-
/* @__PURE__ */
|
|
3556
|
+
/* @__PURE__ */ jsx23(Separator, {}),
|
|
3564
3557
|
/* @__PURE__ */ jsxs13("div", { className: "space-y-3", children: [
|
|
3565
3558
|
/* @__PURE__ */ jsxs13("div", { className: "flex items-center justify-between", children: [
|
|
3566
3559
|
/* @__PURE__ */ jsxs13("h3", { className: "text-sm font-medium text-muted-foreground uppercase tracking-wider flex items-center gap-2", children: [
|
|
3567
|
-
/* @__PURE__ */
|
|
3560
|
+
/* @__PURE__ */ jsx23(Brain, { className: "h-4 w-4" }),
|
|
3568
3561
|
labels.memories
|
|
3569
3562
|
] }),
|
|
3570
|
-
onAddMemory && /* @__PURE__ */
|
|
3563
|
+
onAddMemory && /* @__PURE__ */ jsx23(
|
|
3571
3564
|
Button,
|
|
3572
3565
|
{
|
|
3573
3566
|
variant: "ghost",
|
|
3574
3567
|
size: "sm",
|
|
3575
3568
|
className: "h-7 px-2",
|
|
3576
3569
|
onClick: () => setIsAddingMemory(true),
|
|
3577
|
-
children: /* @__PURE__ */
|
|
3570
|
+
children: /* @__PURE__ */ jsx23(Plus3, { className: "h-4 w-4" })
|
|
3578
3571
|
}
|
|
3579
3572
|
)
|
|
3580
3573
|
] }),
|
|
3581
3574
|
isAddingMemory && onAddMemory && /* @__PURE__ */ jsxs13("div", { className: "flex gap-2", children: [
|
|
3582
|
-
/* @__PURE__ */
|
|
3575
|
+
/* @__PURE__ */ jsx23(
|
|
3583
3576
|
Input,
|
|
3584
3577
|
{
|
|
3585
3578
|
value: newMemoryContent,
|
|
@@ -3596,24 +3589,24 @@ var UserProfile = ({
|
|
|
3596
3589
|
autoFocus: true
|
|
3597
3590
|
}
|
|
3598
3591
|
),
|
|
3599
|
-
/* @__PURE__ */
|
|
3592
|
+
/* @__PURE__ */ jsx23(Button, { size: "sm", onClick: handleAddMemory, disabled: !newMemoryContent.trim(), children: "Salvar" })
|
|
3600
3593
|
] }),
|
|
3601
|
-
/* @__PURE__ */
|
|
3594
|
+
/* @__PURE__ */ jsx23("div", { className: "space-y-2", children: memories.length === 0 ? /* @__PURE__ */ jsx23("p", { className: "text-sm text-muted-foreground text-center py-4", children: labels.noMemories }) : memories.map((memory) => {
|
|
3602
3595
|
const isEditing = editingMemoryId === memory.id;
|
|
3603
3596
|
return /* @__PURE__ */ jsxs13(
|
|
3604
3597
|
"div",
|
|
3605
3598
|
{
|
|
3606
3599
|
className: "flex items-start gap-3 p-3 rounded-lg bg-muted/50 group",
|
|
3607
3600
|
children: [
|
|
3608
|
-
/* @__PURE__ */
|
|
3601
|
+
/* @__PURE__ */ jsx23("div", { className: "mt-0.5 shrink-0", children: memory.source === "agent" ? /* @__PURE__ */ jsx23(Bot3, { className: "h-4 w-4 text-primary" }) : getMemoryCategoryIcon(memory.category) }),
|
|
3609
3602
|
/* @__PURE__ */ jsxs13("div", { className: "flex-1 min-w-0", children: [
|
|
3610
3603
|
/* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-2 mb-0.5", children: [
|
|
3611
|
-
/* @__PURE__ */
|
|
3612
|
-
/* @__PURE__ */
|
|
3613
|
-
/* @__PURE__ */
|
|
3604
|
+
/* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: getMemoryCategoryLabel(memory.category) }),
|
|
3605
|
+
/* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: "\u2022" }),
|
|
3606
|
+
/* @__PURE__ */ jsx23("span", { className: "text-xs text-muted-foreground", children: memory.source === "agent" ? "IA" : "Voc\xEA" })
|
|
3614
3607
|
] }),
|
|
3615
3608
|
isEditing ? /* @__PURE__ */ jsxs13("div", { className: "space-y-2", children: [
|
|
3616
|
-
/* @__PURE__ */
|
|
3609
|
+
/* @__PURE__ */ jsx23(
|
|
3617
3610
|
Textarea,
|
|
3618
3611
|
{
|
|
3619
3612
|
value: editingMemoryContent,
|
|
@@ -3639,7 +3632,7 @@ var UserProfile = ({
|
|
|
3639
3632
|
className: "h-7 px-2",
|
|
3640
3633
|
onClick: handleCancelEdit,
|
|
3641
3634
|
children: [
|
|
3642
|
-
/* @__PURE__ */
|
|
3635
|
+
/* @__PURE__ */ jsx23(X3, { className: "h-3.5 w-3.5 mr-1" }),
|
|
3643
3636
|
"Cancelar"
|
|
3644
3637
|
]
|
|
3645
3638
|
}
|
|
@@ -3652,33 +3645,33 @@ var UserProfile = ({
|
|
|
3652
3645
|
onClick: handleSaveEdit,
|
|
3653
3646
|
disabled: !editingMemoryContent.trim(),
|
|
3654
3647
|
children: [
|
|
3655
|
-
/* @__PURE__ */
|
|
3648
|
+
/* @__PURE__ */ jsx23(Check3, { className: "h-3.5 w-3.5 mr-1" }),
|
|
3656
3649
|
"Salvar"
|
|
3657
3650
|
]
|
|
3658
3651
|
}
|
|
3659
3652
|
)
|
|
3660
3653
|
] })
|
|
3661
|
-
] }) : /* @__PURE__ */
|
|
3654
|
+
] }) : /* @__PURE__ */ jsx23("p", { className: "text-sm break-words", children: memory.content })
|
|
3662
3655
|
] }),
|
|
3663
3656
|
!isEditing && (onUpdateMemory || onDeleteMemory) && /* @__PURE__ */ jsxs13("div", { className: "flex gap-1 opacity-0 group-hover:opacity-100 transition-opacity shrink-0", children: [
|
|
3664
|
-
onUpdateMemory && /* @__PURE__ */
|
|
3657
|
+
onUpdateMemory && /* @__PURE__ */ jsx23(
|
|
3665
3658
|
Button,
|
|
3666
3659
|
{
|
|
3667
3660
|
variant: "ghost",
|
|
3668
3661
|
size: "icon",
|
|
3669
3662
|
className: "h-7 w-7",
|
|
3670
3663
|
onClick: () => handleStartEdit(memory),
|
|
3671
|
-
children: /* @__PURE__ */
|
|
3664
|
+
children: /* @__PURE__ */ jsx23(Pencil, { className: "h-3.5 w-3.5 text-muted-foreground" })
|
|
3672
3665
|
}
|
|
3673
3666
|
),
|
|
3674
|
-
onDeleteMemory && /* @__PURE__ */
|
|
3667
|
+
onDeleteMemory && /* @__PURE__ */ jsx23(
|
|
3675
3668
|
Button,
|
|
3676
3669
|
{
|
|
3677
3670
|
variant: "ghost",
|
|
3678
3671
|
size: "icon",
|
|
3679
3672
|
className: "h-7 w-7",
|
|
3680
3673
|
onClick: () => onDeleteMemory(memory.id),
|
|
3681
|
-
children: /* @__PURE__ */
|
|
3674
|
+
children: /* @__PURE__ */ jsx23(Trash23, { className: "h-3.5 w-3.5 text-destructive" })
|
|
3682
3675
|
}
|
|
3683
3676
|
)
|
|
3684
3677
|
] })
|
|
@@ -3690,7 +3683,7 @@ var UserProfile = ({
|
|
|
3690
3683
|
] })
|
|
3691
3684
|
] }) }),
|
|
3692
3685
|
/* @__PURE__ */ jsxs13("div", { className: "p-4 border-t space-y-2 shrink-0", children: [
|
|
3693
|
-
onEditProfile && /* @__PURE__ */
|
|
3686
|
+
onEditProfile && /* @__PURE__ */ jsx23(
|
|
3694
3687
|
Button,
|
|
3695
3688
|
{
|
|
3696
3689
|
variant: "outline",
|
|
@@ -3699,7 +3692,7 @@ var UserProfile = ({
|
|
|
3699
3692
|
children: "Edit Profile"
|
|
3700
3693
|
}
|
|
3701
3694
|
),
|
|
3702
|
-
onLogout && /* @__PURE__ */
|
|
3695
|
+
onLogout && /* @__PURE__ */ jsx23(
|
|
3703
3696
|
Button,
|
|
3704
3697
|
{
|
|
3705
3698
|
variant: "destructive",
|
|
@@ -3716,7 +3709,7 @@ var UserProfile = ({
|
|
|
3716
3709
|
|
|
3717
3710
|
// src/components/chat/ChatUI.tsx
|
|
3718
3711
|
import { Sparkles, ArrowRight, MessageSquare, Lightbulb as Lightbulb2, Zap, HelpCircle } from "lucide-react";
|
|
3719
|
-
import { jsx as
|
|
3712
|
+
import { Fragment as Fragment6, jsx as jsx24, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
3720
3713
|
var ChatUI = ({
|
|
3721
3714
|
messages = [],
|
|
3722
3715
|
threads = [],
|
|
@@ -3724,6 +3717,7 @@ var ChatUI = ({
|
|
|
3724
3717
|
config: userConfig,
|
|
3725
3718
|
sidebar: _sidebar,
|
|
3726
3719
|
isGenerating = false,
|
|
3720
|
+
isMessagesLoading = false,
|
|
3727
3721
|
callbacks = {},
|
|
3728
3722
|
user,
|
|
3729
3723
|
assistant,
|
|
@@ -3739,7 +3733,10 @@ var ChatUI = ({
|
|
|
3739
3733
|
initialInput,
|
|
3740
3734
|
onInitialInputConsumed
|
|
3741
3735
|
}) => {
|
|
3742
|
-
const config =
|
|
3736
|
+
const config = useMemo3(
|
|
3737
|
+
() => mergeConfig(defaultChatConfig, userConfig),
|
|
3738
|
+
[userConfig]
|
|
3739
|
+
);
|
|
3743
3740
|
const [isMobile, setIsMobile] = useState8(false);
|
|
3744
3741
|
const [isUserProfileOpen, setIsUserProfileOpen] = useState8(false);
|
|
3745
3742
|
let userContext;
|
|
@@ -3905,11 +3902,11 @@ var ChatUI = ({
|
|
|
3905
3902
|
if (messages.length > 0 || !suggestions.length) return null;
|
|
3906
3903
|
return /* @__PURE__ */ jsxs14("div", { className: "flex flex-col items-center justify-center min-h-[60vh] py-8 px-4", children: [
|
|
3907
3904
|
/* @__PURE__ */ jsxs14("div", { className: "text-center mb-8", children: [
|
|
3908
|
-
/* @__PURE__ */
|
|
3909
|
-
/* @__PURE__ */
|
|
3910
|
-
/* @__PURE__ */
|
|
3905
|
+
/* @__PURE__ */ jsx24("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__ */ jsx24(Sparkles, { className: "w-7 h-7 text-primary" }) }),
|
|
3906
|
+
/* @__PURE__ */ jsx24("h2", { className: "text-xl font-semibold mb-2", children: config.branding.title }),
|
|
3907
|
+
/* @__PURE__ */ jsx24("p", { className: "text-muted-foreground text-sm max-w-md", children: config.branding.subtitle })
|
|
3911
3908
|
] }),
|
|
3912
|
-
/* @__PURE__ */
|
|
3909
|
+
/* @__PURE__ */ jsx24("div", { className: "grid grid-cols-1 sm:grid-cols-2 gap-3 w-full max-w-2xl", children: suggestions.map((suggestion, index) => /* @__PURE__ */ jsxs14(
|
|
3913
3910
|
"button",
|
|
3914
3911
|
{
|
|
3915
3912
|
type: "button",
|
|
@@ -3918,10 +3915,10 @@ var ChatUI = ({
|
|
|
3918
3915
|
children: [
|
|
3919
3916
|
(() => {
|
|
3920
3917
|
const IconComponent = SuggestionIconComponents[index % SuggestionIconComponents.length];
|
|
3921
|
-
return /* @__PURE__ */
|
|
3918
|
+
return /* @__PURE__ */ jsx24("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__ */ jsx24(IconComponent, { className: "h-4 w-4" }) });
|
|
3922
3919
|
})(),
|
|
3923
|
-
/* @__PURE__ */
|
|
3924
|
-
/* @__PURE__ */
|
|
3920
|
+
/* @__PURE__ */ jsx24("div", { className: "flex-1 min-w-0 pr-6", children: /* @__PURE__ */ jsx24("p", { className: "text-sm font-medium leading-snug line-clamp-2", children: suggestion }) }),
|
|
3921
|
+
/* @__PURE__ */ jsx24(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" })
|
|
3925
3922
|
]
|
|
3926
3923
|
},
|
|
3927
3924
|
index
|
|
@@ -3931,25 +3928,100 @@ var ChatUI = ({
|
|
|
3931
3928
|
const renderInlineSuggestions = (messageId) => {
|
|
3932
3929
|
const items = messageSuggestions?.[messageId];
|
|
3933
3930
|
if (!items || items.length === 0) return null;
|
|
3934
|
-
return /* @__PURE__ */
|
|
3931
|
+
return /* @__PURE__ */ jsx24("div", { className: "flex flex-wrap gap-2 mt-2 ml-11", children: items.map((suggestion, index) => /* @__PURE__ */ jsxs14(
|
|
3935
3932
|
"button",
|
|
3936
3933
|
{
|
|
3937
3934
|
type: "button",
|
|
3938
3935
|
onClick: () => handleSendMessage(suggestion),
|
|
3939
3936
|
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",
|
|
3940
3937
|
children: [
|
|
3941
|
-
/* @__PURE__ */
|
|
3942
|
-
/* @__PURE__ */
|
|
3938
|
+
/* @__PURE__ */ jsx24(Sparkles, { className: "h-3 w-3 text-primary opacity-70 group-hover:opacity-100" }),
|
|
3939
|
+
/* @__PURE__ */ jsx24("span", { className: "max-w-[200px] truncate", children: suggestion })
|
|
3943
3940
|
]
|
|
3944
3941
|
},
|
|
3945
3942
|
`${messageId}-suggestion-${index}`
|
|
3946
3943
|
)) });
|
|
3947
3944
|
};
|
|
3945
|
+
const renderMessageLoadingSkeleton = () => /* @__PURE__ */ jsx24("div", { className: "space-y-6 py-2", children: [0, 1, 2, 3].map((index) => {
|
|
3946
|
+
const isUserRow = index % 2 === 1;
|
|
3947
|
+
return /* @__PURE__ */ jsxs14(
|
|
3948
|
+
"div",
|
|
3949
|
+
{
|
|
3950
|
+
className: `flex gap-3 ${isUserRow ? "justify-end" : "justify-start"}`,
|
|
3951
|
+
children: [
|
|
3952
|
+
!isUserRow && /* @__PURE__ */ jsx24(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" }),
|
|
3953
|
+
/* @__PURE__ */ jsxs14("div", { className: `space-y-2 ${isUserRow ? "w-[70%]" : "w-[75%]"}`, children: [
|
|
3954
|
+
/* @__PURE__ */ jsx24(Skeleton, { className: "h-4 w-24" }),
|
|
3955
|
+
/* @__PURE__ */ jsx24(Skeleton, { className: "h-4 w-full" }),
|
|
3956
|
+
/* @__PURE__ */ jsx24(Skeleton, { className: "h-4 w-[85%]" })
|
|
3957
|
+
] }),
|
|
3958
|
+
isUserRow && /* @__PURE__ */ jsx24(Skeleton, { className: "h-8 w-8 rounded-full shrink-0" })
|
|
3959
|
+
]
|
|
3960
|
+
},
|
|
3961
|
+
`message-skeleton-${index}`
|
|
3962
|
+
);
|
|
3963
|
+
}) });
|
|
3964
|
+
const renderedMessageList = useMemo3(() => {
|
|
3965
|
+
if (isMessagesLoading) return renderMessageLoadingSkeleton();
|
|
3966
|
+
return /* @__PURE__ */ jsxs14(Fragment6, { children: [
|
|
3967
|
+
renderSuggestions(),
|
|
3968
|
+
messages.map((message, index) => {
|
|
3969
|
+
const prevMessage = index > 0 ? messages[index - 1] : null;
|
|
3970
|
+
const isGrouped = prevMessage !== null && prevMessage.role === message.role;
|
|
3971
|
+
return /* @__PURE__ */ jsxs14("div", { className: isGrouped ? "space-y-1 -mt-2" : "space-y-2", children: [
|
|
3972
|
+
/* @__PURE__ */ jsx24(
|
|
3973
|
+
Message,
|
|
3974
|
+
{
|
|
3975
|
+
message,
|
|
3976
|
+
userAvatar: user?.avatar,
|
|
3977
|
+
userName: user?.name,
|
|
3978
|
+
assistantAvatar: assistant?.avatar,
|
|
3979
|
+
assistantName: assistant?.name,
|
|
3980
|
+
showTimestamp: config.ui.showTimestamps,
|
|
3981
|
+
showAvatar: config.ui.showAvatars,
|
|
3982
|
+
enableCopy: config.features.enableMessageCopy,
|
|
3983
|
+
enableEdit: config.features.enableMessageEditing,
|
|
3984
|
+
enableRegenerate: config.features.enableRegeneration,
|
|
3985
|
+
enableToolCallsDisplay: config.features.enableToolCallsDisplay,
|
|
3986
|
+
compactMode: config.ui.compactMode,
|
|
3987
|
+
onAction: handleMessageAction,
|
|
3988
|
+
toolUsedLabel: config.labels.toolUsed,
|
|
3989
|
+
thinkingLabel: config.labels.thinking,
|
|
3990
|
+
isGrouped
|
|
3991
|
+
}
|
|
3992
|
+
),
|
|
3993
|
+
message.role === "assistant" && renderInlineSuggestions(message.id)
|
|
3994
|
+
] }, message.id);
|
|
3995
|
+
})
|
|
3996
|
+
] });
|
|
3997
|
+
}, [
|
|
3998
|
+
isMessagesLoading,
|
|
3999
|
+
messages,
|
|
4000
|
+
handleSendMessage,
|
|
4001
|
+
user?.avatar,
|
|
4002
|
+
user?.name,
|
|
4003
|
+
assistant?.avatar,
|
|
4004
|
+
assistant?.name,
|
|
4005
|
+
config.branding.title,
|
|
4006
|
+
config.branding.subtitle,
|
|
4007
|
+
config.ui.showTimestamps,
|
|
4008
|
+
config.ui.showAvatars,
|
|
4009
|
+
config.ui.compactMode,
|
|
4010
|
+
config.features.enableMessageCopy,
|
|
4011
|
+
config.features.enableMessageEditing,
|
|
4012
|
+
config.features.enableRegeneration,
|
|
4013
|
+
config.features.enableToolCallsDisplay,
|
|
4014
|
+
config.labels.toolUsed,
|
|
4015
|
+
config.labels.thinking,
|
|
4016
|
+
handleMessageAction,
|
|
4017
|
+
messageSuggestions,
|
|
4018
|
+
suggestions
|
|
4019
|
+
]);
|
|
3948
4020
|
const shouldShowAgentSelector = Boolean(
|
|
3949
4021
|
config.agentSelector?.enabled && onSelectAgent && agentOptions.length > 0 && (!config.agentSelector?.hideIfSingle || agentOptions.length > 1)
|
|
3950
4022
|
);
|
|
3951
|
-
return /* @__PURE__ */
|
|
3952
|
-
/* @__PURE__ */
|
|
4023
|
+
return /* @__PURE__ */ jsx24(TooltipProvider, { children: /* @__PURE__ */ jsx24(SidebarProvider, { defaultOpen: true, children: /* @__PURE__ */ jsxs14("div", { className: `flex h-[100svh] md:h-screen bg-background w-full overflow-hidden ${className}`, children: [
|
|
4024
|
+
/* @__PURE__ */ jsx24(
|
|
3953
4025
|
Sidebar2,
|
|
3954
4026
|
{
|
|
3955
4027
|
threads,
|
|
@@ -3979,8 +4051,8 @@ var ChatUI = ({
|
|
|
3979
4051
|
showThemeOptions: !!callbacks.onThemeChange
|
|
3980
4052
|
}
|
|
3981
4053
|
),
|
|
3982
|
-
/* @__PURE__ */
|
|
3983
|
-
/* @__PURE__ */
|
|
4054
|
+
/* @__PURE__ */ jsx24(SidebarInset, { children: /* @__PURE__ */ jsxs14("div", { className: "flex flex-col h-full min-h-0", children: [
|
|
4055
|
+
/* @__PURE__ */ jsx24(
|
|
3984
4056
|
ChatHeader,
|
|
3985
4057
|
{
|
|
3986
4058
|
config,
|
|
@@ -3997,7 +4069,7 @@ var ChatUI = ({
|
|
|
3997
4069
|
),
|
|
3998
4070
|
/* @__PURE__ */ jsxs14("div", { className: "flex flex-1 flex-row min-h-0 overflow-hidden", children: [
|
|
3999
4071
|
/* @__PURE__ */ jsxs14("div", { className: "flex-1 flex flex-col min-h-0", children: [
|
|
4000
|
-
/* @__PURE__ */
|
|
4072
|
+
/* @__PURE__ */ jsx24(
|
|
4001
4073
|
ScrollArea,
|
|
4002
4074
|
{
|
|
4003
4075
|
ref: scrollAreaRef,
|
|
@@ -4005,40 +4077,12 @@ var ChatUI = ({
|
|
|
4005
4077
|
viewportClassName: "p-4 overscroll-contain",
|
|
4006
4078
|
onScrollCapture: handleScroll,
|
|
4007
4079
|
children: /* @__PURE__ */ jsxs14("div", { className: "max-w-4xl mx-auto space-y-4 pb-4", children: [
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
const prevMessage = index > 0 ? messages[index - 1] : null;
|
|
4011
|
-
const isGrouped = prevMessage !== null && prevMessage.role === message.role;
|
|
4012
|
-
return /* @__PURE__ */ jsxs14("div", { className: isGrouped ? "space-y-1 -mt-2" : "space-y-2", children: [
|
|
4013
|
-
/* @__PURE__ */ jsx23(
|
|
4014
|
-
Message,
|
|
4015
|
-
{
|
|
4016
|
-
message,
|
|
4017
|
-
userAvatar: user?.avatar,
|
|
4018
|
-
userName: user?.name,
|
|
4019
|
-
assistantAvatar: assistant?.avatar,
|
|
4020
|
-
assistantName: assistant?.name,
|
|
4021
|
-
showTimestamp: config.ui.showTimestamps,
|
|
4022
|
-
showAvatar: config.ui.showAvatars,
|
|
4023
|
-
enableCopy: config.features.enableMessageCopy,
|
|
4024
|
-
enableEdit: config.features.enableMessageEditing,
|
|
4025
|
-
enableRegenerate: config.features.enableRegeneration,
|
|
4026
|
-
enableToolCallsDisplay: config.features.enableToolCallsDisplay,
|
|
4027
|
-
compactMode: config.ui.compactMode,
|
|
4028
|
-
onAction: handleMessageAction,
|
|
4029
|
-
toolUsedLabel: config.labels.toolUsed,
|
|
4030
|
-
thinkingLabel: config.labels.thinking,
|
|
4031
|
-
isGrouped
|
|
4032
|
-
}
|
|
4033
|
-
),
|
|
4034
|
-
message.role === "assistant" && renderInlineSuggestions(message.id)
|
|
4035
|
-
] }, message.id);
|
|
4036
|
-
}),
|
|
4037
|
-
/* @__PURE__ */ jsx23("div", { ref: messagesEndRef })
|
|
4080
|
+
renderedMessageList,
|
|
4081
|
+
/* @__PURE__ */ jsx24("div", { ref: messagesEndRef })
|
|
4038
4082
|
] })
|
|
4039
4083
|
}
|
|
4040
4084
|
),
|
|
4041
|
-
/* @__PURE__ */
|
|
4085
|
+
/* @__PURE__ */ jsx24("div", { className: "bg-background pb-[env(safe-area-inset-bottom)]", children: /* @__PURE__ */ jsx24(
|
|
4042
4086
|
ChatInput,
|
|
4043
4087
|
{
|
|
4044
4088
|
value: inputValue,
|
|
@@ -4064,17 +4108,17 @@ var ChatUI = ({
|
|
|
4064
4108
|
}
|
|
4065
4109
|
) })
|
|
4066
4110
|
] }),
|
|
4067
|
-
config?.customComponent?.component && !isMobile && /* @__PURE__ */
|
|
4111
|
+
config?.customComponent?.component && !isMobile && /* @__PURE__ */ jsx24(
|
|
4068
4112
|
"div",
|
|
4069
4113
|
{
|
|
4070
4114
|
className: `h-full transition-all duration-300 ease-in-out overflow-hidden ${state.showSidebar ? "w-80" : "w-0"}`,
|
|
4071
|
-
children: state.showSidebar && /* @__PURE__ */
|
|
4115
|
+
children: state.showSidebar && /* @__PURE__ */ jsx24("div", { className: "flex flex-col h-full border-l bg-background animate-in slide-in-from-right-4 duration-300 w-80", children: renderCustomComponent() })
|
|
4072
4116
|
}
|
|
4073
4117
|
)
|
|
4074
4118
|
] })
|
|
4075
4119
|
] }) }),
|
|
4076
4120
|
isCustomMounted && config.customComponent?.component && isMobile && /* @__PURE__ */ jsxs14("div", { className: "fixed inset-0 z-50", children: [
|
|
4077
|
-
/* @__PURE__ */
|
|
4121
|
+
/* @__PURE__ */ jsx24(
|
|
4078
4122
|
"div",
|
|
4079
4123
|
{
|
|
4080
4124
|
className: `absolute inset-0 bg-background/80 backdrop-blur-sm transition-opacity duration-200 ease-out ${isCustomVisible ? "opacity-100" : "opacity-0"}`,
|
|
@@ -4082,16 +4126,16 @@ var ChatUI = ({
|
|
|
4082
4126
|
onClick: closeSidebar
|
|
4083
4127
|
}
|
|
4084
4128
|
),
|
|
4085
|
-
/* @__PURE__ */
|
|
4129
|
+
/* @__PURE__ */ jsx24(
|
|
4086
4130
|
"div",
|
|
4087
4131
|
{
|
|
4088
4132
|
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"}`,
|
|
4089
4133
|
style: { willChange: "transform" },
|
|
4090
|
-
children: /* @__PURE__ */
|
|
4134
|
+
children: /* @__PURE__ */ jsx24("div", { className: "h-full flex flex-col", children: renderCustomComponent() })
|
|
4091
4135
|
}
|
|
4092
4136
|
)
|
|
4093
4137
|
] }),
|
|
4094
|
-
isUserProfileOpen && /* @__PURE__ */
|
|
4138
|
+
isUserProfileOpen && /* @__PURE__ */ jsx24(
|
|
4095
4139
|
UserProfile,
|
|
4096
4140
|
{
|
|
4097
4141
|
isOpen: isUserProfileOpen,
|
|
@@ -4129,7 +4173,7 @@ import {
|
|
|
4129
4173
|
X as X4,
|
|
4130
4174
|
Check as Check4
|
|
4131
4175
|
} from "lucide-react";
|
|
4132
|
-
import { Fragment as
|
|
4176
|
+
import { Fragment as Fragment7, jsx as jsx25, jsxs as jsxs15 } from "react/jsx-runtime";
|
|
4133
4177
|
var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onArchive }) => {
|
|
4134
4178
|
const [isEditing, setIsEditing] = useState9(false);
|
|
4135
4179
|
const [editTitle, setEditTitle] = useState9(thread.title);
|
|
@@ -4158,9 +4202,9 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
|
|
|
4158
4202
|
handleCancelEdit();
|
|
4159
4203
|
}
|
|
4160
4204
|
};
|
|
4161
|
-
return /* @__PURE__ */
|
|
4162
|
-
/* @__PURE__ */
|
|
4163
|
-
/* @__PURE__ */
|
|
4205
|
+
return /* @__PURE__ */ jsx25(Card, { className: `cursor-pointer transition-all duration-200 hover:shadow-md py-0 ${isActive ? "ring-2 ring-primary bg-primary/5" : "hover:bg-muted/50"}`, children: /* @__PURE__ */ jsx25(CardContent, { className: "p-3 max-w-sm", children: /* @__PURE__ */ jsxs15("div", { className: "flex items-start justify-between gap-2", children: [
|
|
4206
|
+
/* @__PURE__ */ jsx25("div", { className: "flex-1 min-w-0", onClick: onSelect, children: isEditing ? /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
|
|
4207
|
+
/* @__PURE__ */ jsx25(
|
|
4164
4208
|
Input,
|
|
4165
4209
|
{
|
|
4166
4210
|
ref: inputRef,
|
|
@@ -4172,44 +4216,44 @@ var ThreadItem = ({ thread, isActive, config, onSelect, onRename, onDelete, onAr
|
|
|
4172
4216
|
placeholder: config?.labels?.threadNamePlaceholder || "Conversation name"
|
|
4173
4217
|
}
|
|
4174
4218
|
),
|
|
4175
|
-
/* @__PURE__ */
|
|
4176
|
-
/* @__PURE__ */
|
|
4177
|
-
] }) : /* @__PURE__ */ jsxs15(
|
|
4178
|
-
/* @__PURE__ */
|
|
4219
|
+
/* @__PURE__ */ jsx25(Button, { size: "sm", variant: "ghost", onClick: handleSaveEdit, children: /* @__PURE__ */ jsx25(Check4, { className: "h-3 w-3" }) }),
|
|
4220
|
+
/* @__PURE__ */ jsx25(Button, { size: "sm", variant: "ghost", onClick: handleCancelEdit, children: /* @__PURE__ */ jsx25(X4, { className: "h-3 w-3" }) })
|
|
4221
|
+
] }) : /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
4222
|
+
/* @__PURE__ */ jsx25("h4", { className: "font-medium text-sm truncate mb-1", children: thread.title }),
|
|
4179
4223
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
|
|
4180
4224
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
4181
|
-
/* @__PURE__ */
|
|
4225
|
+
/* @__PURE__ */ jsx25(Hash, { className: "h-3 w-3" }),
|
|
4182
4226
|
thread.messageCount,
|
|
4183
4227
|
" msgs"
|
|
4184
4228
|
] }),
|
|
4185
|
-
/* @__PURE__ */
|
|
4229
|
+
/* @__PURE__ */ jsx25(Separator, { orientation: "vertical", className: "h-3" }),
|
|
4186
4230
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-1", children: [
|
|
4187
|
-
/* @__PURE__ */
|
|
4231
|
+
/* @__PURE__ */ jsx25(Calendar2, { className: "h-3 w-3" }),
|
|
4188
4232
|
formatDate(thread.updatedAt, config?.labels)
|
|
4189
4233
|
] }),
|
|
4190
|
-
thread.isArchived && /* @__PURE__ */ jsxs15(
|
|
4191
|
-
/* @__PURE__ */
|
|
4234
|
+
thread.isArchived && /* @__PURE__ */ jsxs15(Fragment7, { children: [
|
|
4235
|
+
/* @__PURE__ */ jsx25(Separator, { orientation: "vertical", className: "h-3" }),
|
|
4192
4236
|
/* @__PURE__ */ jsxs15(Badge, { variant: "secondary", className: "text-xs", children: [
|
|
4193
|
-
/* @__PURE__ */
|
|
4237
|
+
/* @__PURE__ */ jsx25(Archive2, { className: "h-2 w-2 mr-1" }),
|
|
4194
4238
|
config?.labels?.archiveThread || "Archived"
|
|
4195
4239
|
] })
|
|
4196
4240
|
] })
|
|
4197
4241
|
] })
|
|
4198
4242
|
] }) }),
|
|
4199
4243
|
!isEditing && /* @__PURE__ */ jsxs15(DropdownMenu, { children: [
|
|
4200
|
-
/* @__PURE__ */
|
|
4244
|
+
/* @__PURE__ */ jsx25(DropdownMenuTrigger, { asChild: true, children: /* @__PURE__ */ jsx25(Button, { variant: "ghost", size: "icon", className: "h-6 w-6 m-auto", children: /* @__PURE__ */ jsx25(MoreVertical2, { className: "h-3 w-3" }) }) }),
|
|
4201
4245
|
/* @__PURE__ */ jsxs15(DropdownMenuContent, { align: "end", children: [
|
|
4202
4246
|
/* @__PURE__ */ jsxs15(DropdownMenuItem, { onClick: () => setIsEditing(true), children: [
|
|
4203
|
-
/* @__PURE__ */
|
|
4247
|
+
/* @__PURE__ */ jsx25(Edit22, { className: "h-4 w-4 mr-2" }),
|
|
4204
4248
|
config?.labels?.renameThread || "Rename"
|
|
4205
4249
|
] }),
|
|
4206
4250
|
/* @__PURE__ */ jsxs15(DropdownMenuItem, { onClick: onArchive, children: [
|
|
4207
|
-
/* @__PURE__ */
|
|
4251
|
+
/* @__PURE__ */ jsx25(Archive2, { className: "h-4 w-4 mr-2" }),
|
|
4208
4252
|
thread.isArchived ? config?.labels?.unarchiveThread || "Unarchive" : config?.labels?.archiveThread || "Archive"
|
|
4209
4253
|
] }),
|
|
4210
|
-
/* @__PURE__ */
|
|
4254
|
+
/* @__PURE__ */ jsx25(DropdownMenuSeparator, {}),
|
|
4211
4255
|
/* @__PURE__ */ jsxs15(DropdownMenuItem, { onClick: onDelete, className: "text-destructive", children: [
|
|
4212
|
-
/* @__PURE__ */
|
|
4256
|
+
/* @__PURE__ */ jsx25(Trash24, { className: "h-4 w-4 mr-2" }),
|
|
4213
4257
|
config?.labels?.deleteThread || "Delete"
|
|
4214
4258
|
] })
|
|
4215
4259
|
] })
|
|
@@ -4225,16 +4269,16 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
|
4225
4269
|
setIsOpen(false);
|
|
4226
4270
|
};
|
|
4227
4271
|
return /* @__PURE__ */ jsxs15(Dialog, { open: isOpen, onOpenChange: setIsOpen, children: [
|
|
4228
|
-
/* @__PURE__ */
|
|
4229
|
-
/* @__PURE__ */
|
|
4272
|
+
/* @__PURE__ */ jsx25(DialogTrigger, { asChild: true, children: /* @__PURE__ */ jsxs15(Button, { variant: "outline", className: "w-full", children: [
|
|
4273
|
+
/* @__PURE__ */ jsx25(Plus4, { className: "h-4 w-4 mr-2" }),
|
|
4230
4274
|
config?.labels?.createNewThread || "New Conversation"
|
|
4231
4275
|
] }) }),
|
|
4232
4276
|
/* @__PURE__ */ jsxs15(DialogContent, { children: [
|
|
4233
4277
|
/* @__PURE__ */ jsxs15(DialogHeader, { children: [
|
|
4234
|
-
/* @__PURE__ */
|
|
4235
|
-
/* @__PURE__ */
|
|
4278
|
+
/* @__PURE__ */ jsx25(DialogTitle, { children: config?.labels?.createNewThread || "Create New Conversation" }),
|
|
4279
|
+
/* @__PURE__ */ jsx25(DialogDescription, { children: "Give your new conversation a name or leave blank to auto-generate one." })
|
|
4236
4280
|
] }),
|
|
4237
|
-
/* @__PURE__ */
|
|
4281
|
+
/* @__PURE__ */ jsx25(
|
|
4238
4282
|
Input,
|
|
4239
4283
|
{
|
|
4240
4284
|
value: title,
|
|
@@ -4245,8 +4289,8 @@ var CreateThreadDialog2 = ({ onCreateThread, config }) => {
|
|
|
4245
4289
|
}
|
|
4246
4290
|
),
|
|
4247
4291
|
/* @__PURE__ */ jsxs15(DialogFooter, { children: [
|
|
4248
|
-
/* @__PURE__ */
|
|
4249
|
-
/* @__PURE__ */
|
|
4292
|
+
/* @__PURE__ */ jsx25(Button, { variant: "outline", onClick: () => setIsOpen(false), children: config?.labels?.cancel || "Cancel" }),
|
|
4293
|
+
/* @__PURE__ */ jsx25(Button, { onClick: handleCreate, children: config?.labels?.create || "Create" })
|
|
4250
4294
|
] })
|
|
4251
4295
|
] })
|
|
4252
4296
|
] });
|
|
@@ -4300,20 +4344,20 @@ var ThreadManager = ({
|
|
|
4300
4344
|
setDeleteThreadId(null);
|
|
4301
4345
|
};
|
|
4302
4346
|
if (!isOpen) return null;
|
|
4303
|
-
return /* @__PURE__ */
|
|
4304
|
-
/* @__PURE__ */
|
|
4347
|
+
return /* @__PURE__ */ jsx25(TooltipProvider, { children: /* @__PURE__ */ jsxs15("div", { className: `fixed inset-0 z-50 bg-background/80 backdrop-blur-sm ${className}`, children: [
|
|
4348
|
+
/* @__PURE__ */ jsx25("div", { className: "fixed left-0 top-0 h-full w-full max-w-md border-r bg-background shadow-lg", children: /* @__PURE__ */ jsxs15(Card, { className: "h-full border-0 rounded-none", children: [
|
|
4305
4349
|
/* @__PURE__ */ jsxs15(CardHeader, { className: "border-b", children: [
|
|
4306
4350
|
/* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between", children: [
|
|
4307
4351
|
/* @__PURE__ */ jsxs15(CardTitle, { className: "flex items-center gap-2", children: [
|
|
4308
|
-
/* @__PURE__ */
|
|
4352
|
+
/* @__PURE__ */ jsx25(MessageSquare2, { className: "h-5 w-5" }),
|
|
4309
4353
|
config?.labels?.newChat || "Conversations"
|
|
4310
4354
|
] }),
|
|
4311
|
-
/* @__PURE__ */
|
|
4355
|
+
/* @__PURE__ */ jsx25(Button, { variant: "ghost", size: "icon", onClick: onClose, children: /* @__PURE__ */ jsx25(X4, { className: "h-4 w-4" }) })
|
|
4312
4356
|
] }),
|
|
4313
4357
|
/* @__PURE__ */ jsxs15("div", { className: "space-y-3", children: [
|
|
4314
4358
|
/* @__PURE__ */ jsxs15("div", { className: "relative", children: [
|
|
4315
|
-
/* @__PURE__ */
|
|
4316
|
-
/* @__PURE__ */
|
|
4359
|
+
/* @__PURE__ */ jsx25(Search2, { className: "absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground" }),
|
|
4360
|
+
/* @__PURE__ */ jsx25(
|
|
4317
4361
|
Input,
|
|
4318
4362
|
{
|
|
4319
4363
|
placeholder: config?.labels?.search || "Search conversations...",
|
|
@@ -4332,7 +4376,7 @@ var ThreadManager = ({
|
|
|
4332
4376
|
onClick: () => setShowArchived(!showArchived),
|
|
4333
4377
|
className: "text-xs",
|
|
4334
4378
|
children: [
|
|
4335
|
-
/* @__PURE__ */
|
|
4379
|
+
/* @__PURE__ */ jsx25(Filter2, { className: "h-3 w-3 mr-1" }),
|
|
4336
4380
|
showArchived ? config?.labels?.hideArchived || "Hide Archived" : config?.labels?.showArchived || "Show Archived"
|
|
4337
4381
|
]
|
|
4338
4382
|
}
|
|
@@ -4346,13 +4390,13 @@ var ThreadManager = ({
|
|
|
4346
4390
|
] })
|
|
4347
4391
|
] }),
|
|
4348
4392
|
/* @__PURE__ */ jsxs15(CardContent, { className: "p-0 flex-1", children: [
|
|
4349
|
-
/* @__PURE__ */
|
|
4350
|
-
/* @__PURE__ */
|
|
4351
|
-
/* @__PURE__ */
|
|
4352
|
-
/* @__PURE__ */
|
|
4393
|
+
/* @__PURE__ */ jsx25("div", { className: "p-4", children: onCreateThread && /* @__PURE__ */ jsx25(CreateThreadDialog2, { onCreateThread, config }) }),
|
|
4394
|
+
/* @__PURE__ */ jsx25(ScrollArea, { className: "h-[calc(100vh-280px)]", children: /* @__PURE__ */ jsx25("div", { className: "px-4 pb-4 space-y-4", children: Object.keys(groupedThreads).length === 0 ? /* @__PURE__ */ jsxs15("div", { className: "text-center py-8 text-muted-foreground", children: [
|
|
4395
|
+
/* @__PURE__ */ jsx25(MessageSquare2, { className: "h-12 w-12 mx-auto mb-3 opacity-50" }),
|
|
4396
|
+
/* @__PURE__ */ jsx25("p", { className: "text-sm", children: searchQuery ? config?.labels?.noThreadsFound || "No conversations found" : config?.labels?.noThreadsYet || "No conversations yet" })
|
|
4353
4397
|
] }) : Object.entries(groupedThreads).map(([group, groupThreads]) => /* @__PURE__ */ jsxs15("div", { children: [
|
|
4354
|
-
/* @__PURE__ */
|
|
4355
|
-
/* @__PURE__ */
|
|
4398
|
+
/* @__PURE__ */ jsx25("h3", { className: "text-sm font-medium text-muted-foreground mb-2 px-2", children: group }),
|
|
4399
|
+
/* @__PURE__ */ jsx25("div", { className: "space-y-2", children: groupThreads.map((thread) => /* @__PURE__ */ jsx25(
|
|
4356
4400
|
ThreadItem,
|
|
4357
4401
|
{
|
|
4358
4402
|
thread,
|
|
@@ -4368,14 +4412,14 @@ var ThreadManager = ({
|
|
|
4368
4412
|
] }, group)) }) })
|
|
4369
4413
|
] })
|
|
4370
4414
|
] }) }),
|
|
4371
|
-
deleteThreadId && /* @__PURE__ */
|
|
4415
|
+
deleteThreadId && /* @__PURE__ */ jsx25(AlertDialog, { open: !!deleteThreadId, onOpenChange: () => setDeleteThreadId(null), children: /* @__PURE__ */ jsxs15(AlertDialogContent, { children: [
|
|
4372
4416
|
/* @__PURE__ */ jsxs15(AlertDialogHeader, { children: [
|
|
4373
|
-
/* @__PURE__ */
|
|
4374
|
-
/* @__PURE__ */
|
|
4417
|
+
/* @__PURE__ */ jsx25(AlertDialogTitle, { children: config?.labels?.deleteConfirmTitle || "Delete Conversation" }),
|
|
4418
|
+
/* @__PURE__ */ jsx25(AlertDialogDescription, { children: config?.labels?.deleteConfirmDescription || "Are you sure you want to delete this conversation? This action cannot be undone." })
|
|
4375
4419
|
] }),
|
|
4376
4420
|
/* @__PURE__ */ jsxs15(AlertDialogFooter, { children: [
|
|
4377
|
-
/* @__PURE__ */
|
|
4378
|
-
/* @__PURE__ */
|
|
4421
|
+
/* @__PURE__ */ jsx25(AlertDialogCancel, { children: config?.labels?.cancel || "Cancel" }),
|
|
4422
|
+
/* @__PURE__ */ jsx25(
|
|
4379
4423
|
AlertDialogAction,
|
|
4380
4424
|
{
|
|
4381
4425
|
onClick: () => deleteThreadId && handleDeleteThread(deleteThreadId),
|