@makemore/agent-frontend 2.11.0 → 2.11.1
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/chat-widget.cjs.js +233 -231
- package/dist/chat-widget.esm.js +267 -265
- package/dist/chat-widget.js +207 -205
- package/dist/react.cjs.js +233 -231
- package/dist/react.esm.js +267 -265
- package/package.json +1 -1
- package/src/components/ChatWidget.js +1 -0
- package/src/components/Message.js +6 -3
- package/src/components/MessageList.js +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@makemore/agent-frontend",
|
|
3
|
-
"version": "2.11.
|
|
3
|
+
"version": "2.11.1",
|
|
4
4
|
"description": "A lightweight chat widget for AI agents. Use as an embeddable script tag or import directly into React/Preact projects.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/chat-widget.cjs.js",
|
|
@@ -305,6 +305,7 @@ export function ChatWidget({ config, onStateChange, markdownParser, apiRef }) {
|
|
|
305
305
|
onLoadMore=${chat.loadMoreMessages}
|
|
306
306
|
onEditMessage=${chat.editMessage}
|
|
307
307
|
onRetryMessage=${chat.retryMessage}
|
|
308
|
+
onSendMessage=${handleSend}
|
|
308
309
|
debugMode=${debugMode}
|
|
309
310
|
markdownParser=${markdownParser}
|
|
310
311
|
emptyStateTitle=${config.emptyStateTitle}
|
|
@@ -120,7 +120,7 @@ function InlineEditForm({ initialContent, onSave, onCancel }) {
|
|
|
120
120
|
`;
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
export function Message({ msg, debugMode, markdownParser, onEdit, onRetry, isLoading, messageIndex }) {
|
|
123
|
+
export function Message({ msg, debugMode, markdownParser, onEdit, onRetry, onSendMessage, isLoading, messageIndex }) {
|
|
124
124
|
const [expanded, setExpanded] = useState(false);
|
|
125
125
|
const [showPayload, setShowPayload] = useState(false);
|
|
126
126
|
const [isEditing, setIsEditing] = useState(false);
|
|
@@ -156,12 +156,15 @@ export function Message({ msg, debugMode, markdownParser, onEdit, onRetry, isLoa
|
|
|
156
156
|
// Content blocks: render rich structured UI elements
|
|
157
157
|
if (msg.type === 'content_blocks' && msg.metadata?.blocks) {
|
|
158
158
|
const handleBlockAction = (action) => {
|
|
159
|
-
if (action.type === 'message' &&
|
|
160
|
-
|
|
159
|
+
if (action.type === 'message' && onSendMessage) {
|
|
160
|
+
onSendMessage(action.message);
|
|
161
161
|
}
|
|
162
162
|
if (action.type === 'callback' && msg._onCallback) {
|
|
163
163
|
msg._onCallback(action.callbackId);
|
|
164
164
|
}
|
|
165
|
+
if (action.type === 'link' && action.url) {
|
|
166
|
+
window.open(action.url, '_blank', 'noopener');
|
|
167
|
+
}
|
|
165
168
|
};
|
|
166
169
|
return html`
|
|
167
170
|
<div class="cw-message-row" style="position: relative;">
|
|
@@ -15,6 +15,7 @@ export function MessageList({
|
|
|
15
15
|
onLoadMore,
|
|
16
16
|
onEditMessage,
|
|
17
17
|
onRetryMessage,
|
|
18
|
+
onSendMessage,
|
|
18
19
|
debugMode,
|
|
19
20
|
markdownParser,
|
|
20
21
|
emptyStateTitle,
|
|
@@ -94,6 +95,7 @@ export function MessageList({
|
|
|
94
95
|
markdownParser=${markdownParser}
|
|
95
96
|
onEdit=${onEditMessage}
|
|
96
97
|
onRetry=${onRetryMessage}
|
|
98
|
+
onSendMessage=${onSendMessage}
|
|
97
99
|
isLoading=${isLoading}
|
|
98
100
|
/>
|
|
99
101
|
`)}
|