@vettvangur/ai-sdk 0.8.0 → 0.8.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/README.md +2 -1
- package/dist/index.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -154,7 +154,8 @@ does. Then an `__notice--joined` divider names them, the `agent` event fires, `d
|
|
|
154
154
|
on the root goes from `waiting` to `agent`, and elements marked `data-ai-chat-agent-name` and
|
|
155
155
|
`data-ai-chat-agent-initials` are filled in. An agent's messages are `__message--person` with
|
|
156
156
|
`__initials` and a `__sender` (their first name, then the `live-chat-team` label when set), and
|
|
157
|
-
the buttons a message carries (`actions`)
|
|
157
|
+
the buttons a message carries (`actions`) in its `__text` bubble (or in the message when it has
|
|
158
|
+
no text) in `renderActions` markup, the first primary. A
|
|
158
159
|
link button opens in a new tab. A `sheet` button opens its page in a `__sheet` dialog appended to
|
|
159
160
|
the root: a `__sheet-header` with a `__sheet-title` (the button's text) and a `__sheet-close`
|
|
160
161
|
button (the `sheet-close` label), and the page in a `__sheet-frame`. Escape closes it too, and
|
package/dist/index.js
CHANGED
|
@@ -1025,6 +1025,7 @@ function bindChat(root, options = {}) {
|
|
|
1025
1025
|
bubble.className = part("text");
|
|
1026
1026
|
bubble.append(renderMarkdown(root.ownerDocument, text));
|
|
1027
1027
|
parent.append(bubble);
|
|
1028
|
+
return bubble;
|
|
1028
1029
|
}
|
|
1029
1030
|
function appendStreamedMarkdown(text) {
|
|
1030
1031
|
if (!activeAssistant) return;
|
|
@@ -1295,7 +1296,7 @@ function bindChat(root, options = {}) {
|
|
|
1295
1296
|
const shown = name ? firstName(name) : labels.liveChatAgent;
|
|
1296
1297
|
sender.append(labels.liveChatTeam ? `${shown} · ${labels.liveChatTeam}` : shown);
|
|
1297
1298
|
message.append(sender);
|
|
1298
|
-
|
|
1299
|
+
const bubble = text ? appendMarkdown(message, text) : null;
|
|
1299
1300
|
const buttons = renderActions(root.ownerDocument, actions.map((action, index) => action.sheet ? {
|
|
1300
1301
|
label: action.label,
|
|
1301
1302
|
action: SHEET_ACTION,
|
|
@@ -1306,7 +1307,7 @@ function bindChat(root, options = {}) {
|
|
|
1306
1307
|
url: action.url,
|
|
1307
1308
|
primary: index === 0
|
|
1308
1309
|
}));
|
|
1309
|
-
if (buttons) message.append(buttons);
|
|
1310
|
+
if (buttons) (bubble ?? message).append(buttons);
|
|
1310
1311
|
scrollToEnd();
|
|
1311
1312
|
}
|
|
1312
1313
|
function showSheet(url, title) {
|