@assistant-ui/react 0.5.42 → 0.5.46
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +36 -6
- package/dist/index.d.ts +36 -6
- package/dist/index.js +253 -67
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +208 -22
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +3 -0
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
@@ -164,6 +164,7 @@ var makeComposerStore = (useThreadRuntime) => {
|
|
164
164
|
var getThreadStateFromRuntime = (runtime) => {
|
165
165
|
const lastMessage = runtime.messages.at(-1);
|
166
166
|
return Object.freeze({
|
167
|
+
threadId: runtime.threadId,
|
167
168
|
capabilities: runtime.capabilities,
|
168
169
|
isDisabled: runtime.isDisabled,
|
169
170
|
isRunning: _optionalChain([lastMessage, 'optionalAccess', _10 => _10.role]) !== "assistant" ? false : lastMessage.status.type === "running"
|
@@ -636,6 +637,9 @@ var useSmooth = (state, smooth = false) => {
|
|
636
637
|
setDisplayedText(text2);
|
637
638
|
_optionalChain([useSmoothStatus2, 'optionalAccess', _29 => _29.setState, 'call', _30 => _30(text2 !== state.part.text ? SMOOTH_STATUS : state.status)]);
|
638
639
|
});
|
640
|
+
_react.useEffect.call(void 0, () => {
|
641
|
+
_optionalChain([useSmoothStatus2, 'optionalAccess', _31 => _31.setState, 'call', _32 => _32(text !== displayedText ? SMOOTH_STATUS : state.status)]);
|
642
|
+
}, [useSmoothStatus2, text, displayedText, state.status]);
|
639
643
|
const [animatorRef] = _react.useState.call(void 0,
|
640
644
|
new TextStreamAnimator(text, setText)
|
641
645
|
);
|
@@ -828,7 +832,7 @@ var fromLanguageModelMessages = (lm, { mergeRoundtrips }) => {
|
|
828
832
|
});
|
829
833
|
if (mergeRoundtrips) {
|
830
834
|
const previousMessage = messages[messages.length - 1];
|
831
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
835
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _33 => _33.role]) === "assistant") {
|
832
836
|
previousMessage.content.push(...newContent);
|
833
837
|
break;
|
834
838
|
}
|
@@ -841,7 +845,7 @@ var fromLanguageModelMessages = (lm, { mergeRoundtrips }) => {
|
|
841
845
|
}
|
842
846
|
case "tool": {
|
843
847
|
const previousMessage = messages[messages.length - 1];
|
844
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
848
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _34 => _34.role]) !== "assistant")
|
845
849
|
throw new Error(
|
846
850
|
"A tool message must be preceded by an assistant message."
|
847
851
|
);
|
@@ -1070,13 +1074,14 @@ var useEdgeRuntime = ({
|
|
1070
1074
|
};
|
1071
1075
|
|
1072
1076
|
// src/runtimes/local/shouldContinue.tsx
|
1073
|
-
var shouldContinue = (result) => _optionalChain([result, 'access',
|
1077
|
+
var shouldContinue = (result) => _optionalChain([result, 'access', _35 => _35.status, 'optionalAccess', _36 => _36.type]) === "requires-action" && result.status.reason === "tool-calls" && result.content.every((c) => c.type !== "tool-call" || !!c.result);
|
1074
1078
|
|
1075
1079
|
// src/runtimes/local/LocalThreadRuntime.tsx
|
1076
1080
|
var LocalThreadRuntime = (_class5 = class {
|
1077
1081
|
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);
|
1078
1082
|
this.configProvider = configProvider;
|
1079
1083
|
this.adapter = adapter;
|
1084
|
+
this.threadId = generateId();
|
1080
1085
|
this.options = options;
|
1081
1086
|
if (initialMessages) {
|
1082
1087
|
let parentId = null;
|
@@ -1098,6 +1103,7 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1098
1103
|
unstable_copy: true,
|
1099
1104
|
speak: false
|
1100
1105
|
}}
|
1106
|
+
|
1101
1107
|
__init15() {this.isDisabled = false}
|
1102
1108
|
get messages() {
|
1103
1109
|
return this.repository.getMessages();
|
@@ -1115,7 +1121,7 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1115
1121
|
}
|
1116
1122
|
set options({ initialMessages, ...options }) {
|
1117
1123
|
this._options = options;
|
1118
|
-
const canSpeak = _optionalChain([options, 'access',
|
1124
|
+
const canSpeak = _optionalChain([options, 'access', _37 => _37.adapters, 'optionalAccess', _38 => _38.speech]) !== void 0;
|
1119
1125
|
if (this.capabilities.speak !== canSpeak) {
|
1120
1126
|
this.capabilities.speak = canSpeak;
|
1121
1127
|
this.notifySubscribers();
|
@@ -1159,18 +1165,18 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1159
1165
|
}
|
1160
1166
|
async performRoundtrip(parentId, message) {
|
1161
1167
|
const messages = this.repository.getMessages();
|
1162
|
-
_optionalChain([this, 'access',
|
1168
|
+
_optionalChain([this, 'access', _39 => _39.abortController, 'optionalAccess', _40 => _40.abort, 'call', _41 => _41()]);
|
1163
1169
|
this.abortController = new AbortController();
|
1164
1170
|
const initialContent = message.content;
|
1165
|
-
const initialRoundtrips = _optionalChain([message, 'access',
|
1166
|
-
const initalCustom = _optionalChain([message, 'access',
|
1171
|
+
const initialRoundtrips = _optionalChain([message, 'access', _42 => _42.metadata, 'optionalAccess', _43 => _43.roundtrips]);
|
1172
|
+
const initalCustom = _optionalChain([message, 'access', _44 => _44.metadata, 'optionalAccess', _45 => _45.custom]);
|
1167
1173
|
const updateMessage = (m) => {
|
1168
1174
|
message = {
|
1169
1175
|
...message,
|
1170
1176
|
...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
|
1171
1177
|
status: _nullishCoalesce(m.status, () => ( message.status)),
|
1172
1178
|
// TODO deprecated, remove in v0.6
|
1173
|
-
..._optionalChain([m, 'access',
|
1179
|
+
..._optionalChain([m, 'access', _46 => _46.metadata, 'optionalAccess', _47 => _47.roundtrips]) ? {
|
1174
1180
|
roundtrips: [
|
1175
1181
|
..._nullishCoalesce(initialRoundtrips, () => ( [])),
|
1176
1182
|
...m.metadata.roundtrips
|
@@ -1185,7 +1191,7 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1185
1191
|
...m.metadata.roundtrips
|
1186
1192
|
]
|
1187
1193
|
} : void 0,
|
1188
|
-
..._optionalChain([m, 'access',
|
1194
|
+
..._optionalChain([m, 'access', _48 => _48.metadata, 'optionalAccess', _49 => _49.custom]) ? {
|
1189
1195
|
custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
|
1190
1196
|
} : void 0
|
1191
1197
|
}
|
@@ -1195,7 +1201,7 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1195
1201
|
this.notifySubscribers();
|
1196
1202
|
};
|
1197
1203
|
const maxToolRoundtrips = _nullishCoalesce(this.options.maxToolRoundtrips, () => ( 1));
|
1198
|
-
const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access',
|
1204
|
+
const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _50 => _50.metadata, 'optionalAccess', _51 => _51.roundtrips, 'optionalAccess', _52 => _52.length]), () => ( 0));
|
1199
1205
|
if (toolRoundtrips > maxToolRoundtrips) {
|
1200
1206
|
updateMessage({
|
1201
1207
|
status: {
|
@@ -1292,7 +1298,7 @@ var LocalThreadRuntime = (_class5 = class {
|
|
1292
1298
|
// TODO lift utterance state to thread runtime
|
1293
1299
|
|
1294
1300
|
speak(messageId) {
|
1295
|
-
const adapter = _optionalChain([this, 'access',
|
1301
|
+
const adapter = _optionalChain([this, 'access', _53 => _53.options, 'access', _54 => _54.adapters, 'optionalAccess', _55 => _55.speech]);
|
1296
1302
|
if (!adapter) throw new Error("Speech adapter not configured");
|
1297
1303
|
const { message } = this.repository.getMessage(messageId);
|
1298
1304
|
if (this._utterance) {
|
@@ -1353,7 +1359,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
|
|
1353
1359
|
const messages = fromCoreMessages(initialMessages);
|
1354
1360
|
this.thread.import({
|
1355
1361
|
messages: messages.map((m, idx) => ({
|
1356
|
-
parentId: _nullishCoalesce(_optionalChain([messages, 'access',
|
1362
|
+
parentId: _nullishCoalesce(_optionalChain([messages, 'access', _56 => _56[idx - 1], 'optionalAccess', _57 => _57.id]), () => ( null)),
|
1357
1363
|
message: m
|
1358
1364
|
}))
|
1359
1365
|
});
|
@@ -1400,11 +1406,12 @@ var getAutoStatus = (isLast, isRunning) => isLast && isRunning ? AUTO_STATUS_RUN
|
|
1400
1406
|
|
1401
1407
|
// src/runtimes/external-store/ThreadMessageLike.tsx
|
1402
1408
|
var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
|
1403
|
-
const { role,
|
1409
|
+
const { role, id, createdAt, status } = like;
|
1404
1410
|
const common = {
|
1405
1411
|
id: _nullishCoalesce(id, () => ( fallbackId)),
|
1406
1412
|
createdAt: _nullishCoalesce(createdAt, () => ( /* @__PURE__ */ new Date()))
|
1407
1413
|
};
|
1414
|
+
const content = typeof like.content === "string" ? [{ type: "text", text: like.content }] : like.content;
|
1408
1415
|
switch (role) {
|
1409
1416
|
case "assistant":
|
1410
1417
|
return {
|
@@ -1414,6 +1421,8 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
|
|
1414
1421
|
const type = part.type;
|
1415
1422
|
switch (type) {
|
1416
1423
|
case "text":
|
1424
|
+
if (part.text.trim().length === 0) return null;
|
1425
|
+
return part;
|
1417
1426
|
case "ui":
|
1418
1427
|
return part;
|
1419
1428
|
case "tool-call": {
|
@@ -1428,7 +1437,7 @@ var fromThreadMessageLike = (like, fallbackId, fallbackStatus) => {
|
|
1428
1437
|
throw new Error(`Unknown content part type: ${unhandledType}`);
|
1429
1438
|
}
|
1430
1439
|
}
|
1431
|
-
}),
|
1440
|
+
}).filter((c) => !!c),
|
1432
1441
|
status: _nullishCoalesce(status, () => ( fallbackStatus))
|
1433
1442
|
};
|
1434
1443
|
case "user":
|
@@ -1476,7 +1485,7 @@ var getThreadMessageText = (message) => {
|
|
1476
1485
|
|
1477
1486
|
// src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
|
1478
1487
|
var hasUpcomingMessage = (isRunning, messages) => {
|
1479
|
-
return isRunning && _optionalChain([messages, 'access',
|
1488
|
+
return isRunning && _optionalChain([messages, 'access', _58 => _58[messages.length - 1], 'optionalAccess', _59 => _59.role]) !== "assistant";
|
1480
1489
|
};
|
1481
1490
|
var ExternalStoreThreadRuntime = (_class7 = class {
|
1482
1491
|
__init18() {this._subscriptions = /* @__PURE__ */ new Set()}
|
@@ -1493,22 +1502,27 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1493
1502
|
get capabilities() {
|
1494
1503
|
return this._capabilities;
|
1495
1504
|
}
|
1496
|
-
__init22() {this.messages = []}
|
1497
|
-
__init23() {this.isDisabled = false}
|
1498
|
-
__init24() {this.converter = new ThreadMessageConverter()}
|
1499
1505
|
|
1500
|
-
|
1506
|
+
|
1507
|
+
|
1508
|
+
__init22() {this.converter = new ThreadMessageConverter()}
|
1509
|
+
|
1510
|
+
__init23() {this.composer = {
|
1501
1511
|
text: "",
|
1502
1512
|
setText: (value) => {
|
1503
1513
|
this.composer.text = value;
|
1504
1514
|
this.notifySubscribers();
|
1505
1515
|
}
|
1506
1516
|
}}
|
1507
|
-
constructor(store) {;_class7.prototype.__init18.call(this);_class7.prototype.__init19.call(this);_class7.prototype.__init20.call(this);_class7.prototype.__init21.call(this);_class7.prototype.__init22.call(this);_class7.prototype.__init23.call(this);_class7.prototype.__init24.call(this);
|
1517
|
+
constructor(store) {;_class7.prototype.__init18.call(this);_class7.prototype.__init19.call(this);_class7.prototype.__init20.call(this);_class7.prototype.__init21.call(this);_class7.prototype.__init22.call(this);_class7.prototype.__init23.call(this);_class7.prototype.__init24.call(this);
|
1508
1518
|
this.store = store;
|
1509
1519
|
}
|
1520
|
+
get store() {
|
1521
|
+
return this._store;
|
1522
|
+
}
|
1510
1523
|
set store(store) {
|
1511
1524
|
if (this._store === store) return;
|
1525
|
+
this.threadId = _nullishCoalesce(_nullishCoalesce(store.threadId, () => ( this.threadId)), () => ( generateId()));
|
1512
1526
|
const isRunning = _nullishCoalesce(store.isRunning, () => ( false));
|
1513
1527
|
this.isDisabled = _nullishCoalesce(store.isDisabled, () => ( false));
|
1514
1528
|
const oldStore = this._store;
|
@@ -1518,7 +1532,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1518
1532
|
edit: this._store.onEdit !== void 0,
|
1519
1533
|
reload: this._store.onReload !== void 0,
|
1520
1534
|
cancel: this._store.onCancel !== void 0,
|
1521
|
-
unstable_copy: _optionalChain([this, 'access',
|
1535
|
+
unstable_copy: _optionalChain([this, 'access', _63 => _63._store, 'access', _64 => _64.unstable_capabilities, 'optionalAccess', _65 => _65.copy]) !== null,
|
1522
1536
|
speak: this._store.onSpeak !== void 0
|
1523
1537
|
};
|
1524
1538
|
if (oldStore) {
|
@@ -1546,7 +1560,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1546
1560
|
for (let i = 0; i < messages.length; i++) {
|
1547
1561
|
const message = messages[i];
|
1548
1562
|
const parent = messages[i - 1];
|
1549
|
-
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
1563
|
+
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _66 => _66.id]), () => ( null)), message);
|
1550
1564
|
}
|
1551
1565
|
if (this.assistantOptimisticId) {
|
1552
1566
|
this.repository.deleteMessage(this.assistantOptimisticId);
|
@@ -1554,7 +1568,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1554
1568
|
}
|
1555
1569
|
if (hasUpcomingMessage(isRunning, messages)) {
|
1556
1570
|
this.assistantOptimisticId = this.repository.appendOptimisticMessage(
|
1557
|
-
_nullishCoalesce(_optionalChain([messages, 'access',
|
1571
|
+
_nullishCoalesce(_optionalChain([messages, 'access', _67 => _67.at, 'call', _68 => _68(-1), 'optionalAccess', _69 => _69.id]), () => ( null)),
|
1558
1572
|
{
|
1559
1573
|
role: "assistant",
|
1560
1574
|
content: []
|
@@ -1562,7 +1576,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1562
1576
|
);
|
1563
1577
|
}
|
1564
1578
|
this.repository.resetHead(
|
1565
|
-
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access',
|
1579
|
+
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _70 => _70.at, 'call', _71 => _71(-1), 'optionalAccess', _72 => _72.id]))), () => ( null))
|
1566
1580
|
);
|
1567
1581
|
this.messages = this.repository.getMessages();
|
1568
1582
|
this.notifySubscribers();
|
@@ -1580,7 +1594,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1580
1594
|
this.updateMessages(this.repository.getMessages());
|
1581
1595
|
}
|
1582
1596
|
async append(message) {
|
1583
|
-
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access',
|
1597
|
+
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _73 => _73.messages, 'access', _74 => _74.at, 'call', _75 => _75(-1), 'optionalAccess', _76 => _76.id]), () => ( null)))) {
|
1584
1598
|
if (!this._store.onEdit)
|
1585
1599
|
throw new Error("Runtime does not support editing messages.");
|
1586
1600
|
await this._store.onEdit(message);
|
@@ -1603,7 +1617,7 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1603
1617
|
}
|
1604
1618
|
let messages = this.repository.getMessages();
|
1605
1619
|
const previousMessage = messages[messages.length - 1];
|
1606
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
1620
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _77 => _77.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _78 => _78.at, 'call', _79 => _79(-1), 'optionalAccess', _80 => _80.id])) {
|
1607
1621
|
this.repository.deleteMessage(previousMessage.id);
|
1608
1622
|
if (!this.composer.text.trim()) {
|
1609
1623
|
this.composer.setText(getThreadMessageText(previousMessage));
|
@@ -1631,8 +1645,8 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1631
1645
|
this._subscriptions.add(callback);
|
1632
1646
|
return () => this._subscriptions.delete(callback);
|
1633
1647
|
}
|
1634
|
-
|
1635
|
-
_optionalChain([this, 'access',
|
1648
|
+
__init24() {this.updateMessages = (messages) => {
|
1649
|
+
_optionalChain([this, 'access', _81 => _81._store, 'access', _82 => _82.setMessages, 'optionalCall', _83 => _83(
|
1636
1650
|
messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
|
1637
1651
|
)]);
|
1638
1652
|
}}
|
@@ -1640,9 +1654,12 @@ var ExternalStoreThreadRuntime = (_class7 = class {
|
|
1640
1654
|
|
1641
1655
|
// src/runtimes/external-store/ExternalStoreRuntime.tsx
|
1642
1656
|
var ExternalStoreRuntime = (_class8 = class extends BaseAssistantRuntime {
|
1643
|
-
|
1657
|
+
__init25() {this._proxyConfigProvider = new ProxyConfigProvider()}
|
1644
1658
|
constructor(store) {
|
1645
|
-
super(new ExternalStoreThreadRuntime(store));_class8.prototype.
|
1659
|
+
super(new ExternalStoreThreadRuntime(store));_class8.prototype.__init25.call(this);;
|
1660
|
+
}
|
1661
|
+
get store() {
|
1662
|
+
return this.thread.store;
|
1646
1663
|
}
|
1647
1664
|
set store(store) {
|
1648
1665
|
this.thread.store = store;
|
@@ -1684,6 +1701,153 @@ var useExternalStoreRuntime = (store) => {
|
|
1684
1701
|
return runtime;
|
1685
1702
|
};
|
1686
1703
|
|
1704
|
+
// src/runtimes/external-store/external-message-converter.tsx
|
1705
|
+
|
1706
|
+
var joinExternalMessages = (messages) => {
|
1707
|
+
const assistantMessage = {
|
1708
|
+
role: "assistant",
|
1709
|
+
content: []
|
1710
|
+
};
|
1711
|
+
for (const output of messages) {
|
1712
|
+
if (output.role === "tool") {
|
1713
|
+
const toolCallIdx = assistantMessage.content.findIndex(
|
1714
|
+
(c) => c.type === "tool-call" && c.toolCallId === output.toolCallId
|
1715
|
+
);
|
1716
|
+
if (toolCallIdx !== -1) {
|
1717
|
+
const toolCall = assistantMessage.content[toolCallIdx];
|
1718
|
+
if (output.toolName) {
|
1719
|
+
if (toolCall.toolName !== output.toolName)
|
1720
|
+
throw new Error(
|
1721
|
+
`Tool call name ${output.toolCallId} ${output.toolName} does not match existing tool call ${toolCall.toolName}`
|
1722
|
+
);
|
1723
|
+
}
|
1724
|
+
assistantMessage.content[toolCallIdx] = {
|
1725
|
+
...toolCall,
|
1726
|
+
result: output.result
|
1727
|
+
};
|
1728
|
+
} else {
|
1729
|
+
throw new Error(
|
1730
|
+
`Tool call ${output.toolCallId} ${output.toolName} not found in assistant message`
|
1731
|
+
);
|
1732
|
+
}
|
1733
|
+
} else {
|
1734
|
+
const content = output.content;
|
1735
|
+
const role = output.role;
|
1736
|
+
switch (role) {
|
1737
|
+
case "system":
|
1738
|
+
case "user":
|
1739
|
+
return { role, content };
|
1740
|
+
case "assistant":
|
1741
|
+
if (assistantMessage.content.length === 0) {
|
1742
|
+
assistantMessage.id = output.id;
|
1743
|
+
assistantMessage.createdAt ??= output.createdAt;
|
1744
|
+
assistantMessage.status ??= output.status;
|
1745
|
+
}
|
1746
|
+
assistantMessage.content.push(...content);
|
1747
|
+
break;
|
1748
|
+
default: {
|
1749
|
+
const unsupportedRole = role;
|
1750
|
+
throw new Error(`Unknown message role: ${unsupportedRole}`);
|
1751
|
+
}
|
1752
|
+
}
|
1753
|
+
}
|
1754
|
+
}
|
1755
|
+
return assistantMessage;
|
1756
|
+
};
|
1757
|
+
var chunkExternalMessages = (callbackResults) => {
|
1758
|
+
const results = [];
|
1759
|
+
let isAssistant = false;
|
1760
|
+
let inputs = [];
|
1761
|
+
let outputs = [];
|
1762
|
+
const flush = () => {
|
1763
|
+
if (outputs.length) {
|
1764
|
+
results.push({
|
1765
|
+
inputs,
|
1766
|
+
outputs
|
1767
|
+
});
|
1768
|
+
}
|
1769
|
+
inputs = [];
|
1770
|
+
outputs = [];
|
1771
|
+
};
|
1772
|
+
for (const callbackResult of callbackResults) {
|
1773
|
+
for (const output of callbackResult.outputs) {
|
1774
|
+
if (!isAssistant || output.role === "user" || output.role === "system") {
|
1775
|
+
flush();
|
1776
|
+
}
|
1777
|
+
isAssistant = output.role === "assistant" || output.role === "tool";
|
1778
|
+
if (inputs.at(-1) !== callbackResult.input) {
|
1779
|
+
inputs.push(callbackResult.input);
|
1780
|
+
}
|
1781
|
+
outputs.push(output);
|
1782
|
+
}
|
1783
|
+
}
|
1784
|
+
flush();
|
1785
|
+
return results;
|
1786
|
+
};
|
1787
|
+
var useExternalMessageConverter = ({
|
1788
|
+
callback,
|
1789
|
+
messages,
|
1790
|
+
isRunning
|
1791
|
+
}) => {
|
1792
|
+
const state = _react.useMemo.call(void 0,
|
1793
|
+
() => ({
|
1794
|
+
callback,
|
1795
|
+
callbackCache: /* @__PURE__ */ new WeakMap(),
|
1796
|
+
chunkCache: /* @__PURE__ */ new WeakMap(),
|
1797
|
+
converterCache: new ThreadMessageConverter()
|
1798
|
+
}),
|
1799
|
+
[callback]
|
1800
|
+
);
|
1801
|
+
return _react.useMemo.call(void 0, () => {
|
1802
|
+
const callbackResults = [];
|
1803
|
+
for (const message of messages) {
|
1804
|
+
let result = state.callbackCache.get(message);
|
1805
|
+
if (!result) {
|
1806
|
+
const output = state.callback(message);
|
1807
|
+
const outputs = Array.isArray(output) ? output : [output];
|
1808
|
+
result = { input: message, outputs };
|
1809
|
+
state.callbackCache.set(message, result);
|
1810
|
+
}
|
1811
|
+
callbackResults.push(result);
|
1812
|
+
}
|
1813
|
+
const chunks = chunkExternalMessages(callbackResults).map((m) => {
|
1814
|
+
const key = m.outputs[0];
|
1815
|
+
if (!key) return m;
|
1816
|
+
const cached = state.chunkCache.get(key);
|
1817
|
+
if (cached && shallowArrayEqual(cached.outputs, m.outputs)) return cached;
|
1818
|
+
state.chunkCache.set(key, m);
|
1819
|
+
return m;
|
1820
|
+
});
|
1821
|
+
return state.converterCache.convertMessages(
|
1822
|
+
chunks,
|
1823
|
+
(cache, message, idx) => {
|
1824
|
+
const isLast = idx === chunks.length - 1;
|
1825
|
+
const autoStatus = getAutoStatus(isLast, isRunning);
|
1826
|
+
if (cache && (cache.role !== "assistant" || !isAutoStatus(cache.status) || cache.status === autoStatus)) {
|
1827
|
+
const inputs = getExternalStoreMessage(cache);
|
1828
|
+
if (shallowArrayEqual(inputs, message.inputs)) {
|
1829
|
+
return cache;
|
1830
|
+
}
|
1831
|
+
}
|
1832
|
+
const newMessage = fromThreadMessageLike(
|
1833
|
+
joinExternalMessages(message.outputs),
|
1834
|
+
idx.toString(),
|
1835
|
+
autoStatus
|
1836
|
+
);
|
1837
|
+
newMessage[symbolInnerMessage] = message.inputs;
|
1838
|
+
return newMessage;
|
1839
|
+
}
|
1840
|
+
);
|
1841
|
+
}, [state, messages, isRunning]);
|
1842
|
+
};
|
1843
|
+
var shallowArrayEqual = (a, b) => {
|
1844
|
+
if (a.length !== b.length) return false;
|
1845
|
+
for (let i = 0; i < a.length; i++) {
|
1846
|
+
if (a[i] !== b[i]) return false;
|
1847
|
+
}
|
1848
|
+
return true;
|
1849
|
+
};
|
1850
|
+
|
1687
1851
|
// src/runtimes/dangerous-in-browser/useDangerousInBrowserRuntime.ts
|
1688
1852
|
|
1689
1853
|
|
@@ -1788,7 +1952,7 @@ var ThreadProvider = ({
|
|
1788
1952
|
const thread = provider.thread;
|
1789
1953
|
const oldState = context.useThread.getState();
|
1790
1954
|
const state = getThreadStateFromRuntime(thread);
|
1791
|
-
if (oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning || // TODO ensure capabilities is memoized
|
1955
|
+
if (oldState.threadId !== state.threadId || oldState.isDisabled !== state.isDisabled || oldState.isRunning !== state.isRunning || // TODO ensure capabilities is memoized
|
1792
1956
|
oldState.capabilities !== state.capabilities) {
|
1793
1957
|
context.useThread.setState(
|
1794
1958
|
state,
|
@@ -1884,7 +2048,7 @@ var AssistantRuntimeProvider = _react.memo.call(void 0, AssistantRuntimeProvider
|
|
1884
2048
|
var MessageContext = _react.createContext.call(void 0, null);
|
1885
2049
|
function useMessageContext(options) {
|
1886
2050
|
const context = _react.useContext.call(void 0, MessageContext);
|
1887
|
-
if (!_optionalChain([options, 'optionalAccess',
|
2051
|
+
if (!_optionalChain([options, 'optionalAccess', _84 => _84.optional]) && !context)
|
1888
2052
|
throw new Error(
|
1889
2053
|
"This component can only be used inside a component passed to <ThreadPrimitive.Messages components={...} />."
|
1890
2054
|
);
|
@@ -1911,7 +2075,7 @@ var ContentPartContext = _react.createContext.call(void 0,
|
|
1911
2075
|
);
|
1912
2076
|
function useContentPartContext(options) {
|
1913
2077
|
const context = _react.useContext.call(void 0, ContentPartContext);
|
1914
|
-
if (!_optionalChain([options, 'optionalAccess',
|
2078
|
+
if (!_optionalChain([options, 'optionalAccess', _85 => _85.optional]) && !context)
|
1915
2079
|
throw new Error(
|
1916
2080
|
"This component can only be used inside a component passed to <MessagePrimitive.Content components={...} >."
|
1917
2081
|
);
|
@@ -1923,13 +2087,13 @@ function useContentPartContext(options) {
|
|
1923
2087
|
var toAppendMessage = (useThreadMessages, message) => {
|
1924
2088
|
if (typeof message === "string") {
|
1925
2089
|
return {
|
1926
|
-
parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access',
|
2090
|
+
parentId: _nullishCoalesce(_optionalChain([useThreadMessages, 'access', _86 => _86.getState, 'call', _87 => _87(), 'access', _88 => _88.at, 'call', _89 => _89(-1), 'optionalAccess', _90 => _90.id]), () => ( null)),
|
1927
2091
|
role: "user",
|
1928
2092
|
content: [{ type: "text", text: message }]
|
1929
2093
|
};
|
1930
2094
|
}
|
1931
2095
|
return {
|
1932
|
-
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access',
|
2096
|
+
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages, 'access', _91 => _91.getState, 'call', _92 => _92(), 'access', _93 => _93.at, 'call', _94 => _94(-1), 'optionalAccess', _95 => _95.id]))), () => ( null)),
|
1933
2097
|
role: _nullishCoalesce(message.role, () => ( "user")),
|
1934
2098
|
content: message.content
|
1935
2099
|
};
|
@@ -1981,7 +2145,7 @@ var useAssistantTool = (tool) => {
|
|
1981
2145
|
const unsub2 = render ? setToolUI(toolName, render) : void 0;
|
1982
2146
|
return () => {
|
1983
2147
|
unsub1();
|
1984
|
-
_optionalChain([unsub2, 'optionalCall',
|
2148
|
+
_optionalChain([unsub2, 'optionalCall', _96 => _96()]);
|
1985
2149
|
};
|
1986
2150
|
}, [registerModelConfigProvider, setToolUI, tool]);
|
1987
2151
|
};
|
@@ -1992,6 +2156,7 @@ var makeAssistantTool = (tool) => {
|
|
1992
2156
|
useAssistantTool(tool);
|
1993
2157
|
return null;
|
1994
2158
|
};
|
2159
|
+
Tool.unstable_tool = tool;
|
1995
2160
|
return Tool;
|
1996
2161
|
};
|
1997
2162
|
|
@@ -2013,6 +2178,7 @@ var makeAssistantToolUI = (tool) => {
|
|
2013
2178
|
useAssistantToolUI(tool);
|
2014
2179
|
return null;
|
2015
2180
|
};
|
2181
|
+
ToolUI.unstable_tool = tool;
|
2016
2182
|
return ToolUI;
|
2017
2183
|
};
|
2018
2184
|
|
@@ -2446,7 +2612,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2446
2612
|
...primitiveProps,
|
2447
2613
|
ref: forwardedRef,
|
2448
2614
|
onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
|
2449
|
-
_optionalChain([callback, 'optionalCall',
|
2615
|
+
_optionalChain([callback, 'optionalCall', _97 => _97()]);
|
2450
2616
|
})
|
2451
2617
|
}
|
2452
2618
|
);
|
@@ -2502,7 +2668,7 @@ var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref)
|
|
2502
2668
|
...props,
|
2503
2669
|
ref,
|
2504
2670
|
onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
|
2505
|
-
_optionalChain([callback, 'optionalCall',
|
2671
|
+
_optionalChain([callback, 'optionalCall', _98 => _98()]);
|
2506
2672
|
})
|
2507
2673
|
}
|
2508
2674
|
);
|
@@ -2788,7 +2954,7 @@ var getContentPartState = ({ message }, useContentPart, partIndex) => {
|
|
2788
2954
|
}
|
2789
2955
|
}
|
2790
2956
|
const status = toContentPartStatus(message, partIndex, part);
|
2791
|
-
const currentState = _optionalChain([useContentPart, 'optionalAccess',
|
2957
|
+
const currentState = _optionalChain([useContentPart, 'optionalAccess', _99 => _99.getState, 'call', _100 => _100()]);
|
2792
2958
|
if (currentState && currentState.part === part && currentState.status === status)
|
2793
2959
|
return null;
|
2794
2960
|
return Object.freeze({ part, status });
|
@@ -2869,21 +3035,22 @@ ContentPartPrimitiveInProgress.displayName = "ContentPartPrimitive.InProgress";
|
|
2869
3035
|
|
2870
3036
|
// src/primitives/message/MessageContent.tsx
|
2871
3037
|
|
3038
|
+
var ToolUIDisplay = ({
|
3039
|
+
UI,
|
3040
|
+
...props
|
3041
|
+
}) => {
|
3042
|
+
const { useToolUIs } = useAssistantContext();
|
3043
|
+
const Render = _nullishCoalesce(useToolUIs((s) => s.getToolUI(props.part.toolName)), () => ( UI));
|
3044
|
+
if (!Render) return null;
|
3045
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Render, { ...props });
|
3046
|
+
};
|
2872
3047
|
var defaultComponents = {
|
2873
3048
|
Text: () => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { whiteSpace: "pre-line" }, children: [
|
2874
3049
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveText, {}),
|
2875
3050
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveInProgress, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: { fontFamily: "revert" }, children: " \u25CF" }) })
|
2876
3051
|
] }),
|
2877
3052
|
Image: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveImage, {}),
|
2878
|
-
UI: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveDisplay, {})
|
2879
|
-
tools: {
|
2880
|
-
Fallback: (props) => {
|
2881
|
-
const { useToolUIs } = useAssistantContext();
|
2882
|
-
const Render = useToolUIs((s) => s.getToolUI(props.part.toolName));
|
2883
|
-
if (!Render) return null;
|
2884
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, Render, { ...props });
|
2885
|
-
}
|
2886
|
-
}
|
3053
|
+
UI: () => /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ContentPartPrimitiveDisplay, {})
|
2887
3054
|
};
|
2888
3055
|
var MessageContentPartComponent = ({
|
2889
3056
|
components: {
|
@@ -2891,7 +3058,7 @@ var MessageContentPartComponent = ({
|
|
2891
3058
|
Text: Text2 = defaultComponents.Text,
|
2892
3059
|
Image: Image2 = defaultComponents.Image,
|
2893
3060
|
UI = defaultComponents.UI,
|
2894
|
-
tools: { by_name = {}, Fallback: Fallback2 =
|
3061
|
+
tools: { by_name = {}, Fallback: Fallback2 = void 0 } = {}
|
2895
3062
|
} = {}
|
2896
3063
|
}) => {
|
2897
3064
|
const { useThreadActions } = useThreadContext();
|
@@ -2918,10 +3085,19 @@ var MessageContentPartComponent = ({
|
|
2918
3085
|
const Tool = by_name[part.toolName] || Fallback2;
|
2919
3086
|
const addResult = (result) => addToolResult({
|
2920
3087
|
messageId: useMessage.getState().message.id,
|
3088
|
+
toolName: part.toolName,
|
2921
3089
|
toolCallId: part.toolCallId,
|
2922
3090
|
result
|
2923
3091
|
});
|
2924
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
3092
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
3093
|
+
ToolUIDisplay,
|
3094
|
+
{
|
3095
|
+
UI: Tool,
|
3096
|
+
part,
|
3097
|
+
status,
|
3098
|
+
addResult
|
3099
|
+
}
|
3100
|
+
);
|
2925
3101
|
}
|
2926
3102
|
default:
|
2927
3103
|
const unhandledType = type;
|
@@ -2936,7 +3112,7 @@ var MessageContentPartImpl = ({
|
|
2936
3112
|
};
|
2937
3113
|
var MessageContentPart = _react.memo.call(void 0,
|
2938
3114
|
MessageContentPartImpl,
|
2939
|
-
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access',
|
3115
|
+
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _101 => _101.components, 'optionalAccess', _102 => _102.Text]) === _optionalChain([next, 'access', _103 => _103.components, 'optionalAccess', _104 => _104.Text]) && _optionalChain([prev, 'access', _105 => _105.components, 'optionalAccess', _106 => _106.Image]) === _optionalChain([next, 'access', _107 => _107.components, 'optionalAccess', _108 => _108.Image]) && _optionalChain([prev, 'access', _109 => _109.components, 'optionalAccess', _110 => _110.UI]) === _optionalChain([next, 'access', _111 => _111.components, 'optionalAccess', _112 => _112.UI]) && _optionalChain([prev, 'access', _113 => _113.components, 'optionalAccess', _114 => _114.tools]) === _optionalChain([next, 'access', _115 => _115.components, 'optionalAccess', _116 => _116.tools])
|
2940
3116
|
);
|
2941
3117
|
var MessagePrimitiveContent = ({
|
2942
3118
|
components
|
@@ -3051,7 +3227,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
|
3051
3227
|
const { isRunning } = useThread.getState();
|
3052
3228
|
if (!isRunning) {
|
3053
3229
|
e.preventDefault();
|
3054
|
-
_optionalChain([textareaRef, 'access',
|
3230
|
+
_optionalChain([textareaRef, 'access', _117 => _117.current, 'optionalAccess', _118 => _118.closest, 'call', _119 => _119("form"), 'optionalAccess', _120 => _120.requestSubmit, 'call', _121 => _121()]);
|
3055
3231
|
}
|
3056
3232
|
}
|
3057
3233
|
};
|
@@ -3353,7 +3529,7 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
3353
3529
|
},
|
3354
3530
|
isSpeaking: false,
|
3355
3531
|
stopSpeaking: () => {
|
3356
|
-
_optionalChain([utterance, 'optionalAccess',
|
3532
|
+
_optionalChain([utterance, 'optionalAccess', _122 => _122.cancel, 'call', _123 => _123()]);
|
3357
3533
|
},
|
3358
3534
|
addUtterance: (utt) => {
|
3359
3535
|
utterance = utt;
|
@@ -3368,15 +3544,15 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
3368
3544
|
// src/context/providers/MessageProvider.tsx
|
3369
3545
|
|
3370
3546
|
var getIsLast = (messages, message) => {
|
3371
|
-
return _optionalChain([messages, 'access',
|
3547
|
+
return _optionalChain([messages, 'access', _124 => _124[messages.length - 1], 'optionalAccess', _125 => _125.id]) === message.id;
|
3372
3548
|
};
|
3373
3549
|
var getMessageState = (messages, getBranches, useMessage, messageIndex) => {
|
3374
|
-
const parentId = _nullishCoalesce(_optionalChain([messages, 'access',
|
3550
|
+
const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _126 => _126[messageIndex - 1], 'optionalAccess', _127 => _127.id]), () => ( null));
|
3375
3551
|
const message = messages[messageIndex];
|
3376
3552
|
if (!message) return null;
|
3377
3553
|
const isLast = getIsLast(messages, message);
|
3378
3554
|
const branches = getBranches(message.id);
|
3379
|
-
const currentState = _optionalChain([useMessage, 'optionalAccess',
|
3555
|
+
const currentState = _optionalChain([useMessage, 'optionalAccess', _128 => _128.getState, 'call', _129 => _129()]);
|
3380
3556
|
if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
|
3381
3557
|
return null;
|
3382
3558
|
return Object.freeze({
|
@@ -3503,7 +3679,7 @@ var ThreadPrimitiveMessagesImpl = ({
|
|
3503
3679
|
ThreadPrimitiveMessagesImpl.displayName = "ThreadPrimitive.Messages";
|
3504
3680
|
var ThreadPrimitiveMessages = _react.memo.call(void 0,
|
3505
3681
|
ThreadPrimitiveMessagesImpl,
|
3506
|
-
(prev, next) => _optionalChain([prev, 'access',
|
3682
|
+
(prev, next) => _optionalChain([prev, 'access', _130 => _130.components, 'optionalAccess', _131 => _131.Message]) === _optionalChain([next, 'access', _132 => _132.components, 'optionalAccess', _133 => _133.Message]) && _optionalChain([prev, 'access', _134 => _134.components, 'optionalAccess', _135 => _135.UserMessage]) === _optionalChain([next, 'access', _136 => _136.components, 'optionalAccess', _137 => _137.UserMessage]) && _optionalChain([prev, 'access', _138 => _138.components, 'optionalAccess', _139 => _139.EditComposer]) === _optionalChain([next, 'access', _140 => _140.components, 'optionalAccess', _141 => _141.EditComposer]) && _optionalChain([prev, 'access', _142 => _142.components, 'optionalAccess', _143 => _143.AssistantMessage]) === _optionalChain([next, 'access', _144 => _144.components, 'optionalAccess', _145 => _145.AssistantMessage]) && _optionalChain([prev, 'access', _146 => _146.components, 'optionalAccess', _147 => _147.SystemMessage]) === _optionalChain([next, 'access', _148 => _148.components, 'optionalAccess', _149 => _149.SystemMessage])
|
3507
3683
|
);
|
3508
3684
|
|
3509
3685
|
// src/primitives/thread/ThreadScrollToBottom.tsx
|
@@ -3535,7 +3711,7 @@ var ThreadConfigProvider = ({
|
|
3535
3711
|
}) => {
|
3536
3712
|
const assistant = useAssistantContext({ optional: true });
|
3537
3713
|
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 });
|
3538
|
-
if (!_optionalChain([config, 'optionalAccess',
|
3714
|
+
if (!_optionalChain([config, 'optionalAccess', _150 => _150.runtime])) return configProvider;
|
3539
3715
|
if (assistant) {
|
3540
3716
|
throw new Error(
|
3541
3717
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
@@ -3790,13 +3966,22 @@ var AssistantMessageContentWrapper = withDefaults("div", {
|
|
3790
3966
|
className: "aui-assistant-message-content"
|
3791
3967
|
});
|
3792
3968
|
var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: componentsProp, ...rest }, ref) => {
|
3793
|
-
const { assistantMessage: { components = {} } = {} } = useThreadConfig();
|
3969
|
+
const { tools, assistantMessage: { components = {} } = {} } = useThreadConfig();
|
3794
3970
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantMessageContentWrapper, { ...rest, ref, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
3795
3971
|
message_exports.Content,
|
3796
3972
|
{
|
3797
3973
|
components: {
|
3798
3974
|
...componentsProp,
|
3799
|
-
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess',
|
3975
|
+
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _151 => _151.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
|
3976
|
+
tools: {
|
3977
|
+
by_name: !tools ? void 0 : Object.fromEntries(
|
3978
|
+
tools.map((t) => [
|
3979
|
+
t.unstable_tool.toolName,
|
3980
|
+
t.unstable_tool.render
|
3981
|
+
])
|
3982
|
+
),
|
3983
|
+
Fallback: components.ToolFallback
|
3984
|
+
}
|
3800
3985
|
}
|
3801
3986
|
}
|
3802
3987
|
) });
|
@@ -3973,7 +4158,7 @@ var ThreadWelcomeSuggestion = ({
|
|
3973
4158
|
};
|
3974
4159
|
var ThreadWelcomeSuggestions = () => {
|
3975
4160
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
3976
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess',
|
4161
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _152 => _152.map, 'call', _153 => _153((suggestion, idx) => {
|
3977
4162
|
const key = `${suggestion.prompt}-${idx}`;
|
3978
4163
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
|
3979
4164
|
})]) });
|
@@ -4051,7 +4236,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
|
|
4051
4236
|
{
|
4052
4237
|
components: {
|
4053
4238
|
...components,
|
4054
|
-
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4239
|
+
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _154 => _154.Text]), () => ( content_part_default.Text))
|
4055
4240
|
}
|
4056
4241
|
}
|
4057
4242
|
) });
|
@@ -4153,10 +4338,10 @@ var ThreadMessages = ({ components, ...rest }) => {
|
|
4153
4338
|
thread_exports.Messages,
|
4154
4339
|
{
|
4155
4340
|
components: {
|
4156
|
-
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4157
|
-
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4158
|
-
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4159
|
-
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4341
|
+
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _155 => _155.UserMessage]), () => ( user_message_default)),
|
4342
|
+
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _156 => _156.EditComposer]), () => ( edit_composer_default)),
|
4343
|
+
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _157 => _157.AssistantMessage]), () => ( assistant_message_default)),
|
4344
|
+
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _158 => _158.SystemMessage]), () => ( SystemMessage))
|
4160
4345
|
},
|
4161
4346
|
...rest
|
4162
4347
|
}
|
@@ -4338,5 +4523,6 @@ var assistant_modal_default = Object.assign(AssistantModal, exports11);
|
|
4338
4523
|
|
4339
4524
|
|
4340
4525
|
|
4341
|
-
|
4526
|
+
|
4527
|
+
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.useExternalMessageConverter = useExternalMessageConverter; 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;
|
4342
4528
|
//# sourceMappingURL=index.js.map
|