@makemore/agent-frontend 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -1
- package/dist/chat-widget.css +270 -0
- package/dist/chat-widget.js +209 -134
- package/package.json +2 -2
- package/src/components/ChatWidget.js +1 -0
- package/src/components/InputForm.js +199 -5
- package/src/components/Message.js +36 -1
- package/src/hooks/useChat.js +71 -20
- package/src/utils/api.js +5 -4
- package/src/utils/config.js +1 -0
- package/src/utils/helpers.js +23 -0
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ Most chat widgets are tightly coupled to specific frameworks or require complex
|
|
|
23
23
|
| Feature | Description |
|
|
24
24
|
|---------|-------------|
|
|
25
25
|
| 💬 **Real-time Streaming** | SSE-based message streaming for instant, token-by-token responses |
|
|
26
|
+
| 📎 **File Uploads** | Attach files to messages with drag-drop, preview chips, and progress indicators |
|
|
27
|
+
| 🖼️ **Document Preview** | Image thumbnails and file icons in chat messages |
|
|
26
28
|
| 🔊 **Text-to-Speech** | ElevenLabs integration with secure Django proxy support |
|
|
27
29
|
| 🎨 **Theming** | Customize colors, titles, messages, and position |
|
|
28
30
|
| 🌙 **Dark Mode** | Automatic dark mode based on system preferences |
|
|
@@ -842,7 +844,13 @@ This ensures conversations don't get mixed up between instances.
|
|
|
842
844
|
|
|
843
845
|
## Version History
|
|
844
846
|
|
|
845
|
-
### v2.
|
|
847
|
+
### v2.1.0 (Latest)
|
|
848
|
+
- 🎤 **Voice Input**: Speech-to-text input using Web Speech API
|
|
849
|
+
- 🎙️ Microphone button with visual recording indicator
|
|
850
|
+
- 🌐 Automatic language detection from browser settings
|
|
851
|
+
- ⚙️ Configurable via `enableVoice` option (enabled by default)
|
|
852
|
+
|
|
853
|
+
### v2.0.1
|
|
846
854
|
- 🔄 **Preact Rewrite**: Complete rewrite using Preact for better maintainability
|
|
847
855
|
- 🧩 **Component Architecture**: Modular components (ChatWidget, Header, InputForm, Message, MessageList, Sidebar)
|
|
848
856
|
- 🪝 **React-style Hooks**: useChat and useModels hooks for state management
|
package/dist/chat-widget.css
CHANGED
|
@@ -580,6 +580,54 @@
|
|
|
580
580
|
background-color: #dc2626 !important;
|
|
581
581
|
}
|
|
582
582
|
|
|
583
|
+
/* Voice input button */
|
|
584
|
+
.cw-voice-btn {
|
|
585
|
+
width: 40px;
|
|
586
|
+
height: 40px;
|
|
587
|
+
border: 1px solid var(--cw-border);
|
|
588
|
+
border-radius: var(--cw-radius-sm);
|
|
589
|
+
cursor: pointer;
|
|
590
|
+
display: flex;
|
|
591
|
+
align-items: center;
|
|
592
|
+
justify-content: center;
|
|
593
|
+
background: var(--cw-bg);
|
|
594
|
+
color: var(--cw-text-muted);
|
|
595
|
+
transition: all 0.15s ease;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
.cw-voice-btn:hover:not(:disabled) {
|
|
599
|
+
background: var(--cw-bg-muted);
|
|
600
|
+
color: var(--cw-text);
|
|
601
|
+
border-color: var(--cw-primary);
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
.cw-voice-btn:disabled {
|
|
605
|
+
opacity: 0.5;
|
|
606
|
+
cursor: not-allowed;
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
/* Recording state */
|
|
610
|
+
.cw-voice-btn.cw-voice-btn-recording {
|
|
611
|
+
background: #dc2626;
|
|
612
|
+
border-color: #dc2626;
|
|
613
|
+
color: white;
|
|
614
|
+
animation: cw-pulse 1.5s ease-in-out infinite;
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
.cw-voice-btn.cw-voice-btn-recording:hover {
|
|
618
|
+
background: #b91c1c;
|
|
619
|
+
border-color: #b91c1c;
|
|
620
|
+
}
|
|
621
|
+
|
|
622
|
+
@keyframes cw-pulse {
|
|
623
|
+
0%, 100% {
|
|
624
|
+
box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.4);
|
|
625
|
+
}
|
|
626
|
+
50% {
|
|
627
|
+
box-shadow: 0 0 0 8px rgba(220, 38, 38, 0);
|
|
628
|
+
}
|
|
629
|
+
}
|
|
630
|
+
|
|
583
631
|
/* Dropdown */
|
|
584
632
|
.cw-dropdown {
|
|
585
633
|
position: relative;
|
|
@@ -1399,3 +1447,225 @@
|
|
|
1399
1447
|
max-height: 300px;
|
|
1400
1448
|
overflow-y: auto;
|
|
1401
1449
|
}
|
|
1450
|
+
|
|
1451
|
+
/* ========================================
|
|
1452
|
+
File Upload Styles
|
|
1453
|
+
======================================== */
|
|
1454
|
+
|
|
1455
|
+
/* Attach button in input form */
|
|
1456
|
+
.cw-attach-btn {
|
|
1457
|
+
display: flex;
|
|
1458
|
+
align-items: center;
|
|
1459
|
+
justify-content: center;
|
|
1460
|
+
width: 36px;
|
|
1461
|
+
height: 36px;
|
|
1462
|
+
padding: 0;
|
|
1463
|
+
border: none;
|
|
1464
|
+
background: transparent;
|
|
1465
|
+
color: #666;
|
|
1466
|
+
font-size: 18px;
|
|
1467
|
+
cursor: pointer;
|
|
1468
|
+
border-radius: 6px;
|
|
1469
|
+
transition: background 0.15s, color 0.15s;
|
|
1470
|
+
flex-shrink: 0;
|
|
1471
|
+
}
|
|
1472
|
+
|
|
1473
|
+
.cw-attach-btn:hover {
|
|
1474
|
+
background: rgba(0, 0, 0, 0.05);
|
|
1475
|
+
color: #333;
|
|
1476
|
+
}
|
|
1477
|
+
|
|
1478
|
+
.cw-attach-btn:disabled {
|
|
1479
|
+
opacity: 0.5;
|
|
1480
|
+
cursor: not-allowed;
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1483
|
+
/* File chips container (preview of selected files) */
|
|
1484
|
+
.cw-file-chips {
|
|
1485
|
+
display: flex;
|
|
1486
|
+
flex-wrap: wrap;
|
|
1487
|
+
gap: 6px;
|
|
1488
|
+
padding: 8px 12px;
|
|
1489
|
+
border-bottom: 1px solid #e0e0e0;
|
|
1490
|
+
background: #fafafa;
|
|
1491
|
+
}
|
|
1492
|
+
|
|
1493
|
+
/* Individual file chip */
|
|
1494
|
+
.cw-file-chip {
|
|
1495
|
+
display: flex;
|
|
1496
|
+
align-items: center;
|
|
1497
|
+
gap: 6px;
|
|
1498
|
+
padding: 4px 8px;
|
|
1499
|
+
background: #fff;
|
|
1500
|
+
border: 1px solid #ddd;
|
|
1501
|
+
border-radius: 16px;
|
|
1502
|
+
font-size: 12px;
|
|
1503
|
+
max-width: 200px;
|
|
1504
|
+
}
|
|
1505
|
+
|
|
1506
|
+
.cw-file-chip-icon {
|
|
1507
|
+
font-size: 14px;
|
|
1508
|
+
flex-shrink: 0;
|
|
1509
|
+
}
|
|
1510
|
+
|
|
1511
|
+
.cw-file-chip-name {
|
|
1512
|
+
overflow: hidden;
|
|
1513
|
+
text-overflow: ellipsis;
|
|
1514
|
+
white-space: nowrap;
|
|
1515
|
+
color: #333;
|
|
1516
|
+
}
|
|
1517
|
+
|
|
1518
|
+
.cw-file-chip-size {
|
|
1519
|
+
color: #888;
|
|
1520
|
+
font-size: 11px;
|
|
1521
|
+
flex-shrink: 0;
|
|
1522
|
+
}
|
|
1523
|
+
|
|
1524
|
+
.cw-file-chip-remove {
|
|
1525
|
+
display: flex;
|
|
1526
|
+
align-items: center;
|
|
1527
|
+
justify-content: center;
|
|
1528
|
+
width: 16px;
|
|
1529
|
+
height: 16px;
|
|
1530
|
+
padding: 0;
|
|
1531
|
+
border: none;
|
|
1532
|
+
background: #e0e0e0;
|
|
1533
|
+
color: #666;
|
|
1534
|
+
font-size: 12px;
|
|
1535
|
+
line-height: 1;
|
|
1536
|
+
border-radius: 50%;
|
|
1537
|
+
cursor: pointer;
|
|
1538
|
+
flex-shrink: 0;
|
|
1539
|
+
}
|
|
1540
|
+
|
|
1541
|
+
.cw-file-chip-remove:hover {
|
|
1542
|
+
background: #d32f2f;
|
|
1543
|
+
color: #fff;
|
|
1544
|
+
}
|
|
1545
|
+
|
|
1546
|
+
/* Message attachments container */
|
|
1547
|
+
.cw-message-attachments {
|
|
1548
|
+
display: flex;
|
|
1549
|
+
flex-wrap: wrap;
|
|
1550
|
+
gap: 8px;
|
|
1551
|
+
margin-bottom: 8px;
|
|
1552
|
+
}
|
|
1553
|
+
|
|
1554
|
+
/* Image thumbnail attachment */
|
|
1555
|
+
.cw-attachment-thumbnail {
|
|
1556
|
+
display: block;
|
|
1557
|
+
width: 120px;
|
|
1558
|
+
height: 90px;
|
|
1559
|
+
border-radius: 8px;
|
|
1560
|
+
overflow: hidden;
|
|
1561
|
+
border: 1px solid #ddd;
|
|
1562
|
+
transition: transform 0.15s, box-shadow 0.15s;
|
|
1563
|
+
}
|
|
1564
|
+
|
|
1565
|
+
.cw-attachment-thumbnail:hover {
|
|
1566
|
+
transform: scale(1.02);
|
|
1567
|
+
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1570
|
+
.cw-attachment-thumbnail img {
|
|
1571
|
+
width: 100%;
|
|
1572
|
+
height: 100%;
|
|
1573
|
+
object-fit: cover;
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
/* File attachment (non-image) */
|
|
1577
|
+
.cw-attachment-file {
|
|
1578
|
+
display: flex;
|
|
1579
|
+
align-items: center;
|
|
1580
|
+
gap: 8px;
|
|
1581
|
+
padding: 8px 12px;
|
|
1582
|
+
background: #f5f5f5;
|
|
1583
|
+
border: 1px solid #ddd;
|
|
1584
|
+
border-radius: 8px;
|
|
1585
|
+
text-decoration: none;
|
|
1586
|
+
color: inherit;
|
|
1587
|
+
transition: background 0.15s;
|
|
1588
|
+
max-width: 200px;
|
|
1589
|
+
}
|
|
1590
|
+
|
|
1591
|
+
.cw-attachment-file:hover {
|
|
1592
|
+
background: #eee;
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
.cw-attachment-icon {
|
|
1596
|
+
font-size: 20px;
|
|
1597
|
+
flex-shrink: 0;
|
|
1598
|
+
}
|
|
1599
|
+
|
|
1600
|
+
.cw-attachment-info {
|
|
1601
|
+
display: flex;
|
|
1602
|
+
flex-direction: column;
|
|
1603
|
+
overflow: hidden;
|
|
1604
|
+
}
|
|
1605
|
+
|
|
1606
|
+
.cw-attachment-name {
|
|
1607
|
+
font-size: 13px;
|
|
1608
|
+
font-weight: 500;
|
|
1609
|
+
color: #333;
|
|
1610
|
+
overflow: hidden;
|
|
1611
|
+
text-overflow: ellipsis;
|
|
1612
|
+
white-space: nowrap;
|
|
1613
|
+
}
|
|
1614
|
+
|
|
1615
|
+
.cw-attachment-size {
|
|
1616
|
+
font-size: 11px;
|
|
1617
|
+
color: #888;
|
|
1618
|
+
}
|
|
1619
|
+
|
|
1620
|
+
/* Dark mode adjustments for file upload */
|
|
1621
|
+
@media (prefers-color-scheme: dark) {
|
|
1622
|
+
.cw-attach-btn {
|
|
1623
|
+
color: #999;
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
.cw-attach-btn:hover {
|
|
1627
|
+
background: rgba(255, 255, 255, 0.1);
|
|
1628
|
+
color: #fff;
|
|
1629
|
+
}
|
|
1630
|
+
|
|
1631
|
+
.cw-file-chips {
|
|
1632
|
+
background: #1a1a1a;
|
|
1633
|
+
border-bottom-color: #333;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.cw-file-chip {
|
|
1637
|
+
background: #2a2a2a;
|
|
1638
|
+
border-color: #444;
|
|
1639
|
+
}
|
|
1640
|
+
|
|
1641
|
+
.cw-file-chip-name {
|
|
1642
|
+
color: #e0e0e0;
|
|
1643
|
+
}
|
|
1644
|
+
|
|
1645
|
+
.cw-file-chip-remove {
|
|
1646
|
+
background: #444;
|
|
1647
|
+
color: #999;
|
|
1648
|
+
}
|
|
1649
|
+
|
|
1650
|
+
.cw-file-chip-remove:hover {
|
|
1651
|
+
background: #d32f2f;
|
|
1652
|
+
color: #fff;
|
|
1653
|
+
}
|
|
1654
|
+
|
|
1655
|
+
.cw-attachment-thumbnail {
|
|
1656
|
+
border-color: #444;
|
|
1657
|
+
}
|
|
1658
|
+
|
|
1659
|
+
.cw-attachment-file {
|
|
1660
|
+
background: #2a2a2a;
|
|
1661
|
+
border-color: #444;
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
.cw-attachment-file:hover {
|
|
1665
|
+
background: #333;
|
|
1666
|
+
}
|
|
1667
|
+
|
|
1668
|
+
.cw-attachment-name {
|
|
1669
|
+
color: #e0e0e0;
|
|
1670
|
+
}
|
|
1671
|
+
}
|