@assistant-ui/react 0.5.40 → 0.5.41
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.d.mts +74 -16
- package/dist/index.d.ts +74 -16
- package/dist/index.js +291 -86
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +484 -279
- package/dist/index.mjs.map +1 -1
- package/package.json +6 -6
package/dist/index.js
CHANGED
@@ -204,7 +204,8 @@ var makeThreadActionStore = (runtimeStore) => {
|
|
204
204
|
startRun: (parentId) => runtimeStore.getState().startRun(parentId),
|
205
205
|
append: (message) => runtimeStore.getState().append(message),
|
206
206
|
cancelRun: () => runtimeStore.getState().cancelRun(),
|
207
|
-
addToolResult: (options) => runtimeStore.getState().addToolResult(options)
|
207
|
+
addToolResult: (options) => runtimeStore.getState().addToolResult(options),
|
208
|
+
speak: (messageId) => runtimeStore.getState().speak(messageId)
|
208
209
|
})
|
209
210
|
);
|
210
211
|
};
|
@@ -1057,31 +1058,77 @@ var EdgeChatAdapter = class {
|
|
1057
1058
|
var useEdgeRuntime = ({
|
1058
1059
|
initialMessages,
|
1059
1060
|
maxToolRoundtrips,
|
1061
|
+
adapters,
|
1060
1062
|
...options
|
1061
1063
|
}) => {
|
1062
1064
|
const [adapter] = _react.useState.call(void 0, () => new EdgeChatAdapter(options));
|
1063
|
-
return useLocalRuntime(adapter, {
|
1065
|
+
return useLocalRuntime(adapter, {
|
1066
|
+
initialMessages,
|
1067
|
+
maxToolRoundtrips,
|
1068
|
+
adapters
|
1069
|
+
});
|
1064
1070
|
};
|
1065
1071
|
|
1066
1072
|
// src/runtimes/local/shouldContinue.tsx
|
1067
1073
|
var shouldContinue = (result) => _optionalChain([result, 'access', _33 => _33.status, 'optionalAccess', _34 => _34.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
|
1068
1074
|
|
1075
|
+
// src/utils/getThreadMessageText.tsx
|
1076
|
+
var getThreadMessageText = (message) => {
|
1077
|
+
const textParts = message.content.filter(
|
1078
|
+
(part) => part.type === "text"
|
1079
|
+
);
|
1080
|
+
return textParts.map((part) => part.text).join("\n\n");
|
1081
|
+
};
|
1082
|
+
|
1083
|
+
// src/runtimes/speech/WebSpeechSynthesisAdapter.ts
|
1084
|
+
var WebSpeechSynthesisAdapter = class {
|
1085
|
+
speak(message) {
|
1086
|
+
const text = getThreadMessageText(message);
|
1087
|
+
const utterance = new SpeechSynthesisUtterance(text);
|
1088
|
+
let ended = false;
|
1089
|
+
const endHandlers = /* @__PURE__ */ new Set();
|
1090
|
+
const handleEnd = () => {
|
1091
|
+
if (ended) return;
|
1092
|
+
ended = true;
|
1093
|
+
endHandlers.forEach((handler) => handler());
|
1094
|
+
};
|
1095
|
+
utterance.addEventListener("end", handleEnd);
|
1096
|
+
utterance.addEventListener("error", handleEnd);
|
1097
|
+
window.speechSynthesis.speak(utterance);
|
1098
|
+
return {
|
1099
|
+
stop: () => {
|
1100
|
+
window.speechSynthesis.cancel();
|
1101
|
+
handleEnd();
|
1102
|
+
},
|
1103
|
+
onEnd: (callback) => {
|
1104
|
+
if (ended) {
|
1105
|
+
let cancelled = false;
|
1106
|
+
queueMicrotask(() => {
|
1107
|
+
if (!cancelled) callback();
|
1108
|
+
});
|
1109
|
+
return () => {
|
1110
|
+
cancelled = true;
|
1111
|
+
};
|
1112
|
+
} else {
|
1113
|
+
endHandlers.add(callback);
|
1114
|
+
return () => {
|
1115
|
+
endHandlers.delete(callback);
|
1116
|
+
};
|
1117
|
+
}
|
1118
|
+
}
|
1119
|
+
};
|
1120
|
+
}
|
1121
|
+
};
|
1122
|
+
|
1069
1123
|
// src/runtimes/local/LocalThreadRuntime.tsx
|
1070
|
-
var CAPABILITIES = Object.freeze({
|
1071
|
-
switchToBranch: true,
|
1072
|
-
edit: true,
|
1073
|
-
reload: true,
|
1074
|
-
cancel: true,
|
1075
|
-
copy: true
|
1076
|
-
});
|
1077
1124
|
var LocalThreadRuntime = (_class5 = class {
|
1078
|
-
constructor(configProvider, adapter, options) {;_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);
|
1125
|
+
constructor(configProvider, adapter, { initialMessages, ...options }) {;_class5.prototype.__init11.call(this);_class5.prototype.__init12.call(this);_class5.prototype.__init13.call(this);_class5.prototype.__init14.call(this);_class5.prototype.__init15.call(this);_class5.prototype.__init16.call(this);
|
1079
1126
|
this.configProvider = configProvider;
|
1080
1127
|
this.adapter = adapter;
|
1081
1128
|
this.options = options;
|
1082
|
-
if (
|
1129
|
+
if (initialMessages) {
|
1083
1130
|
let parentId = null;
|
1084
|
-
const messages = fromCoreMessages(
|
1131
|
+
const messages = fromCoreMessages(initialMessages);
|
1085
1132
|
for (const message of messages) {
|
1086
1133
|
this.repository.addOrUpdateMessage(parentId, message);
|
1087
1134
|
parentId = message.id;
|
@@ -1091,7 +1138,14 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1091
1138
|
__init11() {this._subscriptions = /* @__PURE__ */ new Set()}
|
1092
1139
|
__init12() {this.abortController = null}
|
1093
1140
|
__init13() {this.repository = new MessageRepository()}
|
1094
|
-
__init14() {this.capabilities =
|
1141
|
+
__init14() {this.capabilities = {
|
1142
|
+
switchToBranch: true,
|
1143
|
+
edit: true,
|
1144
|
+
reload: true,
|
1145
|
+
cancel: true,
|
1146
|
+
unstable_copy: true,
|
1147
|
+
speak: false
|
1148
|
+
}}
|
1095
1149
|
__init15() {this.isDisabled = false}
|
1096
1150
|
get messages() {
|
1097
1151
|
return this.repository.getMessages();
|
@@ -1103,6 +1157,15 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1103
1157
|
this.notifySubscribers();
|
1104
1158
|
}
|
1105
1159
|
}}
|
1160
|
+
|
1161
|
+
set options({ initialMessages, ...options }) {
|
1162
|
+
this._options = options;
|
1163
|
+
const canSpeak = _optionalChain([options, 'access', _35 => _35.adapters, 'optionalAccess', _36 => _36.speech]) !== void 0;
|
1164
|
+
if (this.capabilities.speak !== canSpeak) {
|
1165
|
+
this.capabilities.speak = canSpeak;
|
1166
|
+
this.notifySubscribers();
|
1167
|
+
}
|
1168
|
+
}
|
1106
1169
|
getBranches(messageId) {
|
1107
1170
|
return this.repository.getBranches(messageId);
|
1108
1171
|
}
|
@@ -1141,18 +1204,18 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1141
1204
|
}
|
1142
1205
|
async performRoundtrip(parentId, message) {
|
1143
1206
|
const messages = this.repository.getMessages();
|
1144
|
-
_optionalChain([this, 'access',
|
1207
|
+
_optionalChain([this, 'access', _37 => _37.abortController, 'optionalAccess', _38 => _38.abort, 'call', _39 => _39()]);
|
1145
1208
|
this.abortController = new AbortController();
|
1146
1209
|
const initialContent = message.content;
|
1147
|
-
const initialRoundtrips = _optionalChain([message, 'access',
|
1148
|
-
const initalCustom = _optionalChain([message, 'access',
|
1210
|
+
const initialRoundtrips = _optionalChain([message, 'access', _40 => _40.metadata, 'optionalAccess', _41 => _41.roundtrips]);
|
1211
|
+
const initalCustom = _optionalChain([message, 'access', _42 => _42.metadata, 'optionalAccess', _43 => _43.custom]);
|
1149
1212
|
const updateMessage = (m) => {
|
1150
1213
|
message = {
|
1151
1214
|
...message,
|
1152
1215
|
...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
|
1153
1216
|
status: _nullishCoalesce(m.status, () => ( message.status)),
|
1154
1217
|
// TODO deprecated, remove in v0.6
|
1155
|
-
..._optionalChain([m, 'access',
|
1218
|
+
..._optionalChain([m, 'access', _44 => _44.metadata, 'optionalAccess', _45 => _45.roundtrips]) ? {
|
1156
1219
|
roundtrips: [
|
1157
1220
|
..._nullishCoalesce(initialRoundtrips, () => ( [])),
|
1158
1221
|
...m.metadata.roundtrips
|
@@ -1167,7 +1230,7 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1167
1230
|
...m.metadata.roundtrips
|
1168
1231
|
]
|
1169
1232
|
} : void 0,
|
1170
|
-
..._optionalChain([m, 'access',
|
1233
|
+
..._optionalChain([m, 'access', _46 => _46.metadata, 'optionalAccess', _47 => _47.custom]) ? {
|
1171
1234
|
custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
|
1172
1235
|
} : void 0
|
1173
1236
|
}
|
@@ -1176,8 +1239,8 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1176
1239
|
this.repository.addOrUpdateMessage(parentId, message);
|
1177
1240
|
this.notifySubscribers();
|
1178
1241
|
};
|
1179
|
-
const maxToolRoundtrips = _nullishCoalesce(this.
|
1180
|
-
const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access',
|
1242
|
+
const maxToolRoundtrips = _nullishCoalesce(this._options.maxToolRoundtrips, () => ( 1));
|
1243
|
+
const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _48 => _48.metadata, 'optionalAccess', _49 => _49.roundtrips, 'optionalAccess', _50 => _50.length]), () => ( 0));
|
1181
1244
|
if (toolRoundtrips > maxToolRoundtrips) {
|
1182
1245
|
updateMessage({
|
1183
1246
|
status: {
|
@@ -1240,7 +1303,11 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1240
1303
|
this._subscriptions.add(callback);
|
1241
1304
|
return () => this._subscriptions.delete(callback);
|
1242
1305
|
}
|
1243
|
-
addToolResult({
|
1306
|
+
addToolResult({
|
1307
|
+
messageId,
|
1308
|
+
toolCallId,
|
1309
|
+
result
|
1310
|
+
}) {
|
1244
1311
|
let { parentId, message } = this.repository.getMessage(messageId);
|
1245
1312
|
if (message.role !== "assistant")
|
1246
1313
|
throw new Error("Tried to add tool result to non-assistant message");
|
@@ -1267,6 +1334,11 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1267
1334
|
this.performRoundtrip(parentId, message);
|
1268
1335
|
}
|
1269
1336
|
}
|
1337
|
+
speak(messageId) {
|
1338
|
+
const { message } = this.repository.getMessage(messageId);
|
1339
|
+
const adapter = new WebSpeechSynthesisAdapter();
|
1340
|
+
return adapter.speak(message);
|
1341
|
+
}
|
1270
1342
|
export() {
|
1271
1343
|
return this.repository.export();
|
1272
1344
|
}
|
@@ -1312,7 +1384,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
|
|
1312
1384
|
const messages = fromCoreMessages(initialMessages);
|
1313
1385
|
this.thread.import({
|
1314
1386
|
messages: messages.map((m, idx) => ({
|
1315
|
-
parentId: _nullishCoalesce(_optionalChain([messages, 'access',
|
1387
|
+
parentId: _nullishCoalesce(_optionalChain([messages, 'access', _51 => _51[idx - 1], 'optionalAccess', _52 => _52.id]), () => ( null)),
|
1316
1388
|
message: m
|
1317
1389
|
}))
|
1318
1390
|
});
|
@@ -1425,17 +1497,9 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
|
|
1425
1497
|
}
|
1426
1498
|
};
|
1427
1499
|
|
1428
|
-
// src/utils/getThreadMessageText.tsx
|
1429
|
-
var getThreadMessageText = (message) => {
|
1430
|
-
const textParts = message.content.filter(
|
1431
|
-
(part) => part.type === "text"
|
1432
|
-
);
|
1433
|
-
return textParts.map((part) => part.text).join("\n\n");
|
1434
|
-
};
|
1435
|
-
|
1436
1500
|
// src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
|
1437
1501
|
var hasUpcomingMessage = (isRunning, messages) => {
|
1438
|
-
return isRunning && _optionalChain([messages, 'access',
|
1502
|
+
return isRunning && _optionalChain([messages, 'access', _53 => _53[messages.length - 1], 'optionalAccess', _54 => _54.role]) !== "assistant";
|
1439
1503
|
};
|
1440
1504
|
var ExternalStoreThreadRuntime = (_class7 = class {
|
1441
1505
|
__init18() {this._subscriptions = /* @__PURE__ */ new Set()}
|
@@ -1446,7 +1510,8 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1446
1510
|
edit: false,
|
1447
1511
|
reload: false,
|
1448
1512
|
cancel: false,
|
1449
|
-
|
1513
|
+
unstable_copy: false,
|
1514
|
+
speak: false
|
1450
1515
|
}}
|
1451
1516
|
get capabilities() {
|
1452
1517
|
return this._capabilities;
|
@@ -1476,7 +1541,8 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1476
1541
|
edit: this._store.onEdit !== void 0,
|
1477
1542
|
reload: this._store.onReload !== void 0,
|
1478
1543
|
cancel: this._store.onCancel !== void 0,
|
1479
|
-
|
1544
|
+
unstable_copy: _optionalChain([this, 'access', _58 => _58._store, 'access', _59 => _59.unstable_capabilities, 'optionalAccess', _60 => _60.copy]) !== null,
|
1545
|
+
speak: this._store.onSpeak !== void 0
|
1480
1546
|
};
|
1481
1547
|
if (oldStore) {
|
1482
1548
|
if (oldStore.convertMessage !== store.convertMessage) {
|
@@ -1503,7 +1569,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1503
1569
|
for (let i = 0; i < messages.length; i++) {
|
1504
1570
|
const message = messages[i];
|
1505
1571
|
const parent = messages[i - 1];
|
1506
|
-
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
1572
|
+
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _61 => _61.id]), () => ( null)), message);
|
1507
1573
|
}
|
1508
1574
|
if (this.assistantOptimisticId) {
|
1509
1575
|
this.repository.deleteMessage(this.assistantOptimisticId);
|
@@ -1511,7 +1577,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1511
1577
|
}
|
1512
1578
|
if (hasUpcomingMessage(isRunning, messages)) {
|
1513
1579
|
this.assistantOptimisticId = this.repository.appendOptimisticMessage(
|
1514
|
-
_nullishCoalesce(_optionalChain([messages, 'access',
|
1580
|
+
_nullishCoalesce(_optionalChain([messages, 'access', _62 => _62.at, 'call', _63 => _63(-1), 'optionalAccess', _64 => _64.id]), () => ( null)),
|
1515
1581
|
{
|
1516
1582
|
role: "assistant",
|
1517
1583
|
content: []
|
@@ -1519,7 +1585,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1519
1585
|
);
|
1520
1586
|
}
|
1521
1587
|
this.repository.resetHead(
|
1522
|
-
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access',
|
1588
|
+
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _65 => _65.at, 'call', _66 => _66(-1), 'optionalAccess', _67 => _67.id]))), () => ( null))
|
1523
1589
|
);
|
1524
1590
|
this.messages = this.repository.getMessages();
|
1525
1591
|
this.notifySubscribers();
|
@@ -1537,7 +1603,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1537
1603
|
this.updateMessages(this.repository.getMessages());
|
1538
1604
|
}
|
1539
1605
|
async append(message) {
|
1540
|
-
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access',
|
1606
|
+
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _68 => _68.messages, 'access', _69 => _69.at, 'call', _70 => _70(-1), 'optionalAccess', _71 => _71.id]), () => ( null)))) {
|
1541
1607
|
if (!this._store.onEdit)
|
1542
1608
|
throw new Error("Runtime does not support editing messages.");
|
1543
1609
|
await this._store.onEdit(message);
|
@@ -1560,7 +1626,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1560
1626
|
}
|
1561
1627
|
let messages = this.repository.getMessages();
|
1562
1628
|
const previousMessage = messages[messages.length - 1];
|
1563
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
1629
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _72 => _72.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _73 => _73.at, 'call', _74 => _74(-1), 'optionalAccess', _75 => _75.id])) {
|
1564
1630
|
this.repository.deleteMessage(previousMessage.id);
|
1565
1631
|
if (!this.composer.text.trim()) {
|
1566
1632
|
this.composer.setText(getThreadMessageText(previousMessage));
|
@@ -1573,20 +1639,26 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1573
1639
|
this.updateMessages(messages);
|
1574
1640
|
}, 0);
|
1575
1641
|
}
|
1642
|
+
addToolResult(options) {
|
1643
|
+
if (!this._store.onAddToolResult)
|
1644
|
+
throw new Error("Runtime does not support tool results.");
|
1645
|
+
this._store.onAddToolResult(options);
|
1646
|
+
}
|
1647
|
+
speak(messageId) {
|
1648
|
+
if (!this._store.onSpeak)
|
1649
|
+
throw new Error("Runtime does not support speaking.");
|
1650
|
+
const { message } = this.repository.getMessage(messageId);
|
1651
|
+
return this._store.onSpeak(message);
|
1652
|
+
}
|
1576
1653
|
subscribe(callback) {
|
1577
1654
|
this._subscriptions.add(callback);
|
1578
1655
|
return () => this._subscriptions.delete(callback);
|
1579
1656
|
}
|
1580
1657
|
__init26() {this.updateMessages = (messages) => {
|
1581
|
-
_optionalChain([this, 'access',
|
1658
|
+
_optionalChain([this, 'access', _76 => _76._store, 'access', _77 => _77.setMessages, 'optionalCall', _78 => _78(
|
1582
1659
|
messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
|
1583
1660
|
)]);
|
1584
1661
|
}}
|
1585
|
-
addToolResult(options) {
|
1586
|
-
if (!this._store.onAddToolResult)
|
1587
|
-
throw new Error("Runtime does not support tool results.");
|
1588
|
-
this._store.onAddToolResult(options);
|
1589
|
-
}
|
1590
1662
|
}, _class7);
|
1591
1663
|
|
1592
1664
|
// src/runtimes/external-store/ExternalStoreRuntime.tsx
|
@@ -1794,7 +1866,7 @@ var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProvider
|
|
1794
1866
|
var MessageContext = _react.createContext.call(void 0, null);
|
1795
1867
|
function useMessageContext(options) {
|
1796
1868
|
const context = _react.useContext.call(void 0, MessageContext);
|
1797
|
-
if (!_optionalChain([options, 'optionalAccess',
|
1869
|
+
if (!_optionalChain([options, 'optionalAccess', _79 => _79.optional]) && !context)
|
1798
1870
|
throw new Error(
|
1799
1871
|
"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
|
1800
1872
|
);
|
@@ -1821,7 +1893,7 @@ var ContentPartContext = _react.createContext.call(void 0,
|
|
1821
1893
|
);
|
1822
1894
|
function useContentPartContext(options) {
|
1823
1895
|
const context = _react.useContext.call(void 0, ContentPartContext);
|
1824
|
-
if (!_optionalChain([options, 'optionalAccess',
|
1896
|
+
if (!_optionalChain([options, 'optionalAccess', _80 => _80.optional]) && !context)
|
1825
1897
|
throw new Error(
|
1826
1898
|
"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
|
1827
1899
|
);
|
@@ -1833,13 +1905,13 @@ function useContentPartContext(options) {
|
|
1833
1905
|
var toAppendMessage = (useThreadMessages, message) => {
|
1834
1906
|
if (typeof message === "string") {
|
1835
1907
|
return {
|
1836
|
-
parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access',
|
1908
|
+
parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access', _81 => _81.getState, 'call', _82 => _82(), 'access', _83 => _83.at, 'call', _84 => _84(-1), 'optionalAccess', _85 => _85.id]), () => ( null)),
|
1837
1909
|
role: "user",
|
1838
1910
|
content: [{ type: "text", text: message }]
|
1839
1911
|
};
|
1840
1912
|
}
|
1841
1913
|
return {
|
1842
|
-
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access',
|
1914
|
+
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access', _86 => _86.getState, 'call', _87 => _87(), 'access', _88 => _88.at, 'call', _89 => _89(-1), 'optionalAccess', _90 => _90.id]))), () => ( null)),
|
1843
1915
|
role: _nullishCoalesce(message.role, () => ( "user")),
|
1844
1916
|
content: message.content
|
1845
1917
|
};
|
@@ -1891,7 +1963,7 @@ var useAssistantTool = (tool) => {
|
|
1891
1963
|
const unsub2 = render ? setToolUI(toolName, render) : void 0;
|
1892
1964
|
return () => {
|
1893
1965
|
unsub1();
|
1894
|
-
_optionalChain([unsub2, 'optionalCall',
|
1966
|
+
_optionalChain([unsub2, 'optionalCall', _91 => _91()]);
|
1895
1967
|
};
|
1896
1968
|
}, [registerModelConfigProvider, setToolUI, tool]);
|
1897
1969
|
};
|
@@ -1977,8 +2049,8 @@ var useActionBarCopy = ({
|
|
1977
2049
|
const { useMessage, useMessageUtils, useEditComposer } = useMessageContext();
|
1978
2050
|
const hasCopyableContent = useCombinedStore(
|
1979
2051
|
[useMessage, useEditComposer],
|
1980
|
-
(
|
1981
|
-
return !c.isEditing &&
|
2052
|
+
({ message }, c) => {
|
2053
|
+
return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
|
1982
2054
|
}
|
1983
2055
|
);
|
1984
2056
|
const callback = _react.useCallback.call(void 0, () => {
|
@@ -2030,6 +2102,38 @@ var useActionBarReload = () => {
|
|
2030
2102
|
return callback;
|
2031
2103
|
};
|
2032
2104
|
|
2105
|
+
// src/primitive-hooks/actionBar/useActionBarSpeak.tsx
|
2106
|
+
|
2107
|
+
var useActionBarSpeak = () => {
|
2108
|
+
const { useThreadActions } = useThreadContext();
|
2109
|
+
const { useMessage, useEditComposer, useMessageUtils } = useMessageContext();
|
2110
|
+
const hasSpeakableContent = useCombinedStore(
|
2111
|
+
[useMessage, useEditComposer],
|
2112
|
+
({ message }, c) => {
|
2113
|
+
return !c.isEditing && (message.role !== "assistant" || message.status.type !== "running") && message.content.some((c2) => c2.type === "text" && c2.text.length > 0);
|
2114
|
+
}
|
2115
|
+
);
|
2116
|
+
const callback = _react.useCallback.call(void 0, async () => {
|
2117
|
+
const { message } = useMessage.getState();
|
2118
|
+
const utt = useThreadActions.getState().speak(message.id);
|
2119
|
+
useMessageUtils.getState().addUtterance(utt);
|
2120
|
+
}, [useThreadActions, useMessage, useMessageUtils]);
|
2121
|
+
if (!hasSpeakableContent) return null;
|
2122
|
+
return callback;
|
2123
|
+
};
|
2124
|
+
|
2125
|
+
// src/primitive-hooks/actionBar/useActionBarStopSpeaking.tsx
|
2126
|
+
|
2127
|
+
var useActionBarStopSpeaking = () => {
|
2128
|
+
const { useMessageUtils } = useMessageContext();
|
2129
|
+
const isSpeaking = useMessageUtils((u) => u.isSpeaking);
|
2130
|
+
const callback = _react.useCallback.call(void 0, async () => {
|
2131
|
+
useMessageUtils.getState().stopSpeaking();
|
2132
|
+
}, [useMessageUtils]);
|
2133
|
+
if (!isSpeaking) return null;
|
2134
|
+
return callback;
|
2135
|
+
};
|
2136
|
+
|
2033
2137
|
// src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
|
2034
2138
|
var useBranchPickerCount = () => {
|
2035
2139
|
const { useMessage } = useMessageContext();
|
@@ -2169,7 +2273,7 @@ var useMessageIf = (props) => {
|
|
2169
2273
|
const { useMessage, useMessageUtils } = useMessageContext();
|
2170
2274
|
return useCombinedStore(
|
2171
2275
|
[useMessage, useMessageUtils],
|
2172
|
-
({ message, branches, isLast }, { isCopied, isHovering }) => {
|
2276
|
+
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
|
2173
2277
|
if (props.hasBranches === true && branches.length < 2) return false;
|
2174
2278
|
if (props.user && message.role !== "user") return false;
|
2175
2279
|
if (props.assistant && message.role !== "assistant") return false;
|
@@ -2177,6 +2281,8 @@ var useMessageIf = (props) => {
|
|
2177
2281
|
if (props.lastOrHover === true && !isHovering && !isLast) return false;
|
2178
2282
|
if (props.copied === true && !isCopied) return false;
|
2179
2283
|
if (props.copied === false && isCopied) return false;
|
2284
|
+
if (props.speaking === true && !isSpeaking) return false;
|
2285
|
+
if (props.speaking === false && isSpeaking) return false;
|
2180
2286
|
return true;
|
2181
2287
|
}
|
2182
2288
|
);
|
@@ -2246,7 +2352,9 @@ _chunkDCHYNTHIjs.__export.call(void 0, actionBar_exports, {
|
|
2246
2352
|
Copy: () => ActionBarPrimitiveCopy,
|
2247
2353
|
Edit: () => ActionBarPrimitiveEdit,
|
2248
2354
|
Reload: () => ActionBarPrimitiveReload,
|
2249
|
-
Root: () => ActionBarPrimitiveRoot
|
2355
|
+
Root: () => ActionBarPrimitiveRoot,
|
2356
|
+
Speak: () => ActionBarPrimitiveSpeak,
|
2357
|
+
StopSpeaking: () => ActionBarPrimitiveStopSpeaking
|
2250
2358
|
});
|
2251
2359
|
|
2252
2360
|
// src/primitives/actionBar/ActionBarRoot.tsx
|
@@ -2320,7 +2428,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2320
2428
|
...primitiveProps,
|
2321
2429
|
ref: forwardedRef,
|
2322
2430
|
onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
|
2323
|
-
_optionalChain([callback, 'optionalCall',
|
2431
|
+
_optionalChain([callback, 'optionalCall', _92 => _92()]);
|
2324
2432
|
})
|
2325
2433
|
}
|
2326
2434
|
);
|
@@ -2348,6 +2456,40 @@ var ActionBarPrimitiveEdit = createActionButton(
|
|
2348
2456
|
useActionBarEdit
|
2349
2457
|
);
|
2350
2458
|
|
2459
|
+
// src/primitives/actionBar/ActionBarSpeak.tsx
|
2460
|
+
var ActionBarPrimitiveSpeak = createActionButton(
|
2461
|
+
"ActionBarPrimitive.Speak",
|
2462
|
+
useActionBarSpeak
|
2463
|
+
);
|
2464
|
+
|
2465
|
+
// src/primitives/actionBar/ActionBarStopSpeaking.tsx
|
2466
|
+
|
2467
|
+
var _reactuseescapekeydown = require('@radix-ui/react-use-escape-keydown');
|
2468
|
+
|
2469
|
+
|
2470
|
+
|
2471
|
+
var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref) => {
|
2472
|
+
const callback = useActionBarStopSpeaking();
|
2473
|
+
_reactuseescapekeydown.useEscapeKeydown.call(void 0, (e) => {
|
2474
|
+
if (callback) {
|
2475
|
+
e.preventDefault();
|
2476
|
+
callback();
|
2477
|
+
}
|
2478
|
+
});
|
2479
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
2480
|
+
_reactprimitive.Primitive.button,
|
2481
|
+
{
|
2482
|
+
type: "button",
|
2483
|
+
disabled: !callback,
|
2484
|
+
...props,
|
2485
|
+
ref,
|
2486
|
+
onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
|
2487
|
+
_optionalChain([callback, 'optionalCall', _93 => _93()]);
|
2488
|
+
})
|
2489
|
+
}
|
2490
|
+
);
|
2491
|
+
});
|
2492
|
+
|
2351
2493
|
// src/primitives/assistantModal/index.ts
|
2352
2494
|
var assistantModal_exports = {};
|
2353
2495
|
_chunkDCHYNTHIjs.__export.call(void 0, assistantModal_exports, {
|
@@ -2575,9 +2717,9 @@ var useIsHoveringRef = () => {
|
|
2575
2717
|
);
|
2576
2718
|
return useManagedRef(callbackRef);
|
2577
2719
|
};
|
2578
|
-
var MessagePrimitiveRoot = _react.forwardRef.call(void 0, ({ onMouseEnter, onMouseLeave, ...rest },
|
2720
|
+
var MessagePrimitiveRoot = _react.forwardRef.call(void 0, ({ onMouseEnter, onMouseLeave, ...rest }, forwardRef30) => {
|
2579
2721
|
const isHoveringRef = useIsHoveringRef();
|
2580
|
-
const ref = _reactcomposerefs.useComposedRefs.call(void 0,
|
2722
|
+
const ref = _reactcomposerefs.useComposedRefs.call(void 0, forwardRef30, isHoveringRef);
|
2581
2723
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactprimitive.Primitive.div, { ...rest, ref });
|
2582
2724
|
});
|
2583
2725
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
@@ -2628,7 +2770,7 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
|
|
2628
2770
|
}
|
2629
2771
|
}
|
2630
2772
|
const status = toContentPartStatus(message, partIndex, part);
|
2631
|
-
const currentState = _optionalChain([useContentPart, 'optionalAccess',
|
2773
|
+
const currentState = _optionalChain([useContentPart, 'optionalAccess', _94 => _94.getState, 'call', _95 => _95()]);
|
2632
2774
|
if (currentState && currentState.part === part && currentState.status === status)
|
2633
2775
|
return null;
|
2634
2776
|
return Object.freeze({ part, status });
|
@@ -2776,7 +2918,7 @@ var MessageContentPartImpl = ({
|
|
2776
2918
|
};
|
2777
2919
|
var MessageContentPart = _react.memo.call(void 0,
|
2778
2920
|
MessageContentPartImpl,
|
2779
|
-
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access',
|
2921
|
+
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _96 => _96.components, 'optionalAccess', _97 => _97.Text]) === _optionalChain([next, 'access', _98 => _98.components, 'optionalAccess', _99 => _99.Text]) && _optionalChain([prev, 'access', _100 => _100.components, 'optionalAccess', _101 => _101.Image]) === _optionalChain([next, 'access', _102 => _102.components, 'optionalAccess', _103 => _103.Image]) && _optionalChain([prev, 'access', _104 => _104.components, 'optionalAccess', _105 => _105.UI]) === _optionalChain([next, 'access', _106 => _106.components, 'optionalAccess', _107 => _107.UI]) && _optionalChain([prev, 'access', _108 => _108.components, 'optionalAccess', _109 => _109.tools]) === _optionalChain([next, 'access', _110 => _110.components, 'optionalAccess', _111 => _111.tools])
|
2780
2922
|
);
|
2781
2923
|
var MessagePrimitiveContent = ({
|
2782
2924
|
components
|
@@ -2856,7 +2998,7 @@ var _reactslot = require('@radix-ui/react-slot');
|
|
2856
2998
|
|
2857
2999
|
|
2858
3000
|
var _reacttextareaautosize = require('react-textarea-autosize'); var _reacttextareaautosize2 = _interopRequireDefault(_reacttextareaautosize);
|
2859
|
-
|
3001
|
+
|
2860
3002
|
|
2861
3003
|
var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
2862
3004
|
({
|
@@ -2891,7 +3033,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
|
2891
3033
|
const { isRunning } = useThread.getState();
|
2892
3034
|
if (!isRunning) {
|
2893
3035
|
e.preventDefault();
|
2894
|
-
_optionalChain([textareaRef, 'access',
|
3036
|
+
_optionalChain([textareaRef, 'access', _112 => _112.current, 'optionalAccess', _113 => _113.closest, 'call', _114 => _114("form"), 'optionalAccess', _115 => _115.requestSubmit, 'call', _116 => _116()]);
|
2895
3037
|
}
|
2896
3038
|
}
|
2897
3039
|
};
|
@@ -3180,29 +3322,43 @@ var makeEditComposerStore = ({
|
|
3180
3322
|
|
3181
3323
|
// src/context/stores/MessageUtils.ts
|
3182
3324
|
|
3183
|
-
var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) =>
|
3184
|
-
|
3185
|
-
|
3186
|
-
|
3187
|
-
|
3188
|
-
|
3189
|
-
|
3190
|
-
|
3191
|
-
|
3192
|
-
})
|
3325
|
+
var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
3326
|
+
let utterance = null;
|
3327
|
+
return {
|
3328
|
+
isCopied: false,
|
3329
|
+
setIsCopied: (value) => {
|
3330
|
+
set({ isCopied: value });
|
3331
|
+
},
|
3332
|
+
isHovering: false,
|
3333
|
+
setIsHovering: (value) => {
|
3334
|
+
set({ isHovering: value });
|
3335
|
+
},
|
3336
|
+
isSpeaking: false,
|
3337
|
+
stopSpeaking: () => {
|
3338
|
+
_optionalChain([utterance, 'optionalAccess', _117 => _117.stop, 'call', _118 => _118()]);
|
3339
|
+
},
|
3340
|
+
addUtterance: (utt) => {
|
3341
|
+
utterance = utt;
|
3342
|
+
set({ isSpeaking: true });
|
3343
|
+
utt.onEnd(() => {
|
3344
|
+
set({ isSpeaking: false });
|
3345
|
+
});
|
3346
|
+
}
|
3347
|
+
};
|
3348
|
+
});
|
3193
3349
|
|
3194
3350
|
// src/context/providers/MessageProvider.tsx
|
3195
3351
|
|
3196
3352
|
var getIsLast = (messages, message) => {
|
3197
|
-
return _optionalChain([messages, 'access',
|
3353
|
+
return _optionalChain([messages, 'access', _119 => _119[messages.length - 1], 'optionalAccess', _120 => _120.id]) === message.id;
|
3198
3354
|
};
|
3199
3355
|
var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
|
3200
|
-
const parentId = _nullishCoalesce(_optionalChain([messages, 'access',
|
3356
|
+
const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _121 => _121[messageIndex - 1], 'optionalAccess', _122 => _122.id]), () => ( null));
|
3201
3357
|
const message = messages[messageIndex];
|
3202
3358
|
if (!message) return null;
|
3203
3359
|
const isLast = getIsLast(messages, message);
|
3204
3360
|
const branches = getBranches(message.id);
|
3205
|
-
const currentState = _optionalChain([useMessage, 'optionalAccess',
|
3361
|
+
const currentState = _optionalChain([useMessage, 'optionalAccess', _123 => _123.getState, 'call', _124 => _124()]);
|
3206
3362
|
if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
|
3207
3363
|
return null;
|
3208
3364
|
return Object.freeze({
|
@@ -3329,7 +3485,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
3329
3485
|
ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
|
3330
3486
|
var ThreadPrimitiveMessages = _react.memo.call(void 0,
|
3331
3487
|
ThreadPrimitiveMessagesImpl,
|
3332
|
-
(prev, next) => _optionalChain([prev, 'access',
|
3488
|
+
(prev, next) => _optionalChain([prev, 'access', _125 => _125.components, 'optionalAccess', _126 => _126.Message]) === _optionalChain([next, 'access', _127 => _127.components, 'optionalAccess', _128 => _128.Message]) && _optionalChain([prev, 'access', _129 => _129.components, 'optionalAccess', _130 => _130.UserMessage]) === _optionalChain([next, 'access', _131 => _131.components, 'optionalAccess', _132 => _132.UserMessage]) && _optionalChain([prev, 'access', _133 => _133.components, 'optionalAccess', _134 => _134.EditComposer]) === _optionalChain([next, 'access', _135 => _135.components, 'optionalAccess', _136 => _136.EditComposer]) && _optionalChain([prev, 'access', _137 => _137.components, 'optionalAccess', _138 => _138.AssistantMessage]) === _optionalChain([next, 'access', _139 => _139.components, 'optionalAccess', _140 => _140.AssistantMessage]) && _optionalChain([prev, 'access', _141 => _141.components, 'optionalAccess', _142 => _142.SystemMessage]) === _optionalChain([next, 'access', _143 => _143.components, 'optionalAccess', _144 => _144.SystemMessage])
|
3333
3489
|
);
|
3334
3490
|
|
3335
3491
|
// src/primitives/thread/ThreadScrollToBottom.tsx
|
@@ -3361,7 +3517,7 @@ var ThreadConfigProvider = ({
|
|
3361
3517
|
}) => {
|
3362
3518
|
const assistant = useAssistantContext({ optional: true });
|
3363
3519
|
const configProvider = config && Object.keys(_nullishCoalesce(config, () => ( {}))).length > 0 ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadConfigContext.Provider, { value: config, children }) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _jsxruntime.Fragment, { children });
|
3364
|
-
if (!_optionalChain([config, 'optionalAccess',
|
3520
|
+
if (!_optionalChain([config, 'optionalAccess', _145 => _145.runtime])) return configProvider;
|
3365
3521
|
if (assistant) {
|
3366
3522
|
throw new Error(
|
3367
3523
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
@@ -3373,14 +3529,26 @@ ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
|
3373
3529
|
|
3374
3530
|
// src/ui/assistant-action-bar.tsx
|
3375
3531
|
|
3532
|
+
|
3533
|
+
|
3534
|
+
|
3535
|
+
|
3536
|
+
|
3537
|
+
|
3376
3538
|
var _lucidereact = require('lucide-react');
|
3377
3539
|
|
3378
3540
|
var useAllowCopy = () => {
|
3379
3541
|
const { assistantMessage: { allowCopy = true } = {} } = useThreadConfig();
|
3380
3542
|
const { useThread } = useThreadContext();
|
3381
|
-
const copySupported = useThread((t) => t.capabilities.
|
3543
|
+
const copySupported = useThread((t) => t.capabilities.unstable_copy);
|
3382
3544
|
return copySupported && allowCopy;
|
3383
3545
|
};
|
3546
|
+
var useAllowSpeak = () => {
|
3547
|
+
const { assistantMessage: { allowSpeak = true } = {} } = useThreadConfig();
|
3548
|
+
const { useThread } = useThreadContext();
|
3549
|
+
const speakSupported = useThread((t) => t.capabilities.speak);
|
3550
|
+
return speakSupported && allowSpeak;
|
3551
|
+
};
|
3384
3552
|
var useAllowReload = () => {
|
3385
3553
|
const { assistantMessage: { allowReload = true } = {} } = useThreadConfig();
|
3386
3554
|
const { useThread } = useThreadContext();
|
@@ -3398,6 +3566,7 @@ var AssistantActionBar = () => {
|
|
3398
3566
|
autohide: "not-last",
|
3399
3567
|
autohideFloat: "single-branch",
|
3400
3568
|
children: [
|
3569
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarSpeechControl, {}),
|
3401
3570
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarCopy, {}),
|
3402
3571
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarReload, {})
|
3403
3572
|
]
|
@@ -3412,7 +3581,7 @@ AssistantActionBarRoot.displayName = "AssistantActionBarRoot";
|
|
3412
3581
|
var AssistantActionBarCopy = _react.forwardRef.call(void 0, (props, ref) => {
|
3413
3582
|
const {
|
3414
3583
|
strings: {
|
3415
|
-
assistantMessage: {
|
3584
|
+
assistantMessage: { copy: { tooltip = "Copy" } = {} } = {}
|
3416
3585
|
} = {}
|
3417
3586
|
} = useThreadConfig();
|
3418
3587
|
const allowCopy = useAllowCopy();
|
@@ -3423,6 +3592,36 @@ var AssistantActionBarCopy = _react.forwardRef.call(void 0, (props, ref) => {
|
|
3423
3592
|
] }))) }) });
|
3424
3593
|
});
|
3425
3594
|
AssistantActionBarCopy.displayName = "AssistantActionBarCopy";
|
3595
|
+
var AssistantActionBarSpeechControl = () => {
|
3596
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
3597
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, message_exports.If, { speaking: false, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarSpeak, {}) }),
|
3598
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, message_exports.If, { speaking: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarStopSpeaking, {}) })
|
3599
|
+
] });
|
3600
|
+
};
|
3601
|
+
var AssistantActionBarSpeak = _react.forwardRef.call(void 0, (props, ref) => {
|
3602
|
+
const {
|
3603
|
+
strings: {
|
3604
|
+
assistantMessage: { speak: { tooltip = "Read aloud" } = {} } = {}
|
3605
|
+
} = {}
|
3606
|
+
} = useThreadConfig();
|
3607
|
+
const allowSpeak = useAllowSpeak();
|
3608
|
+
if (!allowSpeak) return null;
|
3609
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actionBar_exports.Speak, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipIconButton, { tooltip, ...props, ref, children: _nullishCoalesce(props.children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.AudioLinesIcon, {}))) }) });
|
3610
|
+
});
|
3611
|
+
AssistantActionBarSpeak.displayName = "AssistantActionBarSpeak";
|
3612
|
+
var AssistantActionBarStopSpeaking = _react.forwardRef.call(void 0, (props, ref) => {
|
3613
|
+
const {
|
3614
|
+
strings: {
|
3615
|
+
assistantMessage: {
|
3616
|
+
speak: { stop: { tooltip: stopTooltip = "Stop" } = {} } = {}
|
3617
|
+
} = {}
|
3618
|
+
} = {}
|
3619
|
+
} = useThreadConfig();
|
3620
|
+
const allowSpeak = useAllowSpeak();
|
3621
|
+
if (!allowSpeak) return null;
|
3622
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actionBar_exports.StopSpeaking, { asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipIconButton, { tooltip: stopTooltip, ...props, ref, children: _nullishCoalesce(props.children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.StopCircleIcon, {}))) }) });
|
3623
|
+
});
|
3624
|
+
AssistantActionBarStopSpeaking.displayName = "AssistantActionBarStopSpeaking";
|
3426
3625
|
var AssistantActionBarReload = _react.forwardRef.call(void 0, (props, ref) => {
|
3427
3626
|
const {
|
3428
3627
|
strings: {
|
@@ -3437,7 +3636,10 @@ AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
|
3437
3636
|
var exports = {
|
3438
3637
|
Root: AssistantActionBarRoot,
|
3439
3638
|
Reload: AssistantActionBarReload,
|
3440
|
-
Copy: AssistantActionBarCopy
|
3639
|
+
Copy: AssistantActionBarCopy,
|
3640
|
+
Speak: AssistantActionBarSpeak,
|
3641
|
+
StopSpeaking: AssistantActionBarStopSpeaking,
|
3642
|
+
SpeechControl: AssistantActionBarSpeechControl
|
3441
3643
|
};
|
3442
3644
|
var assistant_action_bar_default = Object.assign(
|
3443
3645
|
AssistantActionBar,
|
@@ -3577,7 +3779,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
|
|
3577
3779
|
{
|
3578
3780
|
components: {
|
3579
3781
|
...componentsProp,
|
3580
|
-
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess',
|
3782
|
+
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _146 => _146.Text]), () => ( components.Text)), () => ( content_part_default.Text))
|
3581
3783
|
}
|
3582
3784
|
}
|
3583
3785
|
) });
|
@@ -3754,7 +3956,7 @@ var ThreadWelcomeSuggestion = ({
|
|
3754
3956
|
};
|
3755
3957
|
var ThreadWelcomeSuggestions = () => {
|
3756
3958
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
3757
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess',
|
3959
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _147 => _147.map, 'call', _148 => _148((suggestion, idx) => {
|
3758
3960
|
const key = `${suggestion.prompt}-${idx}`;
|
3759
3961
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
|
3760
3962
|
})]) });
|
@@ -3832,7 +4034,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
|
|
3832
4034
|
{
|
3833
4035
|
components: {
|
3834
4036
|
...components,
|
3835
|
-
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4037
|
+
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _149 => _149.Text]), () => ( content_part_default.Text))
|
3836
4038
|
}
|
3837
4039
|
}
|
3838
4040
|
) });
|
@@ -3934,10 +4136,10 @@ var ThreadMessages = ({ components, ...rest }) => {
|
|
3934
4136
|
thread_exports.Messages,
|
3935
4137
|
{
|
3936
4138
|
components: {
|
3937
|
-
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3938
|
-
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3939
|
-
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3940
|
-
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4139
|
+
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _150 => _150.UserMessage]), () => ( user_message_default)),
|
4140
|
+
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _151 => _151.EditComposer]), () => ( edit_composer_default)),
|
4141
|
+
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _152 => _152.AssistantMessage]), () => ( assistant_message_default)),
|
4142
|
+
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _153 => _153.SystemMessage]), () => ( SystemMessage))
|
3941
4143
|
},
|
3942
4144
|
...rest
|
3943
4145
|
}
|
@@ -4116,5 +4318,8 @@ var assistant_modal_default = Object.assign(AssistantModal, exports11);
|
|
4116
4318
|
|
4117
4319
|
|
4118
4320
|
|
4119
|
-
|
4321
|
+
|
4322
|
+
|
4323
|
+
|
4324
|
+
exports.ActionBarPrimitive = actionBar_exports; exports.AssistantActionBar = assistant_action_bar_default; exports.AssistantMessage = assistant_message_default; exports.AssistantModal = assistant_modal_default; exports.AssistantModalPrimitive = assistantModal_exports; exports.AssistantRuntimeProvider = AssistantRuntimeProvider; exports.BranchPicker = branch_picker_default; exports.BranchPickerPrimitive = branchPicker_exports; exports.Composer = composer_default; exports.ComposerPrimitive = composer_exports; exports.ContentPart = content_part_default; exports.ContentPartPrimitive = contentPart_exports; exports.EdgeChatAdapter = EdgeChatAdapter; exports.EditComposer = edit_composer_default; exports.ExternalStoreRuntime = ExternalStoreRuntime; exports.INTERNAL = internal_exports; exports.MessagePrimitive = message_exports; exports.Thread = thread_default; exports.ThreadConfigProvider = ThreadConfigProvider; exports.ThreadPrimitive = thread_exports; exports.ThreadWelcome = thread_welcome_default; exports.UserActionBar = user_action_bar_default; exports.UserMessage = user_message_default; exports.WebSpeechSynthesisAdapter = WebSpeechSynthesisAdapter; exports.fromCoreMessage = fromCoreMessage; exports.fromCoreMessages = fromCoreMessages; exports.fromLanguageModelMessages = fromLanguageModelMessages; exports.fromLanguageModelTools = fromLanguageModelTools; exports.getExternalStoreMessage = getExternalStoreMessage; exports.makeAssistantTool = makeAssistantTool; exports.makeAssistantToolUI = makeAssistantToolUI; exports.streamUtils = streamUtils; exports.subscribeToMainThread = subscribeToMainThread; exports.toCoreMessage = _chunkBQ3MRWUVjs.toCoreMessage; exports.toCoreMessages = _chunkBQ3MRWUVjs.toCoreMessages; exports.toLanguageModelMessages = _chunkBQ3MRWUVjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkBQ3MRWUVjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadSuggestion = useThreadSuggestion;
|
4120
4325
|
//# sourceMappingURL=index.js.map
|