@assistant-ui/react 0.5.59 → 0.5.60
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-33TPUWEZ.mjs → chunk-DC342I2Q.mjs} +16 -16
- package/dist/{chunk-33TPUWEZ.mjs.map → chunk-DC342I2Q.mjs.map} +1 -1
- package/dist/{chunk-CWAZOKEW.js → chunk-J2V7Y7JX.js} +14 -14
- package/dist/{chunk-CWAZOKEW.js.map → chunk-J2V7Y7JX.js.map} +1 -1
- package/dist/{edge-BJordJU0.d.mts → edge-eV0d_Sqj.d.mts} +101 -101
- package/dist/{edge-BJordJU0.d.ts → edge-eV0d_Sqj.d.ts} +101 -101
- package/dist/index.d.mts +129 -49
- package/dist/index.d.ts +129 -49
- package/dist/index.js +299 -98
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +494 -293
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css +118 -92
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/tailwindcss/thread.css +9 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10;
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } var _class; var _class2; var _class3; var _class4; var _class5; var _class6; var _class7; var _class8; var _class9; var _class10;"use client";
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
-
var
|
13
|
+
var _chunkJ2V7Y7JXjs = require('./chunk-J2V7Y7JX.js');
|
14
14
|
|
15
15
|
|
16
16
|
var _chunkDCHYNTHIjs = require('./chunk-DCHYNTHI.js');
|
@@ -244,7 +244,9 @@ var makeThreadActionStore = (runtimeStore) => {
|
|
244
244
|
append: (message) => runtimeStore.getState().append(message),
|
245
245
|
cancelRun: () => runtimeStore.getState().cancelRun(),
|
246
246
|
addToolResult: (options) => runtimeStore.getState().addToolResult(options),
|
247
|
-
speak: (messageId) => runtimeStore.getState().speak(messageId)
|
247
|
+
speak: (messageId) => runtimeStore.getState().speak(messageId),
|
248
|
+
submitFeedback: ({ messageId, type }) => runtimeStore.getState().submitFeedback({ messageId, type }),
|
249
|
+
getModelConfig: () => runtimeStore.getState().getModelConfig()
|
248
250
|
})
|
249
251
|
);
|
250
252
|
};
|
@@ -395,7 +397,7 @@ var ThreadRuntimeComposer = (_class2 = class {
|
|
395
397
|
var ProxyConfigProvider = (_class3 = class {constructor() { _class3.prototype.__init6.call(this); }
|
396
398
|
__init6() {this._providers = /* @__PURE__ */ new Set()}
|
397
399
|
getModelConfig() {
|
398
|
-
return
|
400
|
+
return _chunkJ2V7Y7JXjs.mergeModelConfigs.call(void 0, this._providers);
|
399
401
|
}
|
400
402
|
registerModelConfigProvider(provider) {
|
401
403
|
this._providers.add(provider);
|
@@ -1077,14 +1079,14 @@ function streamPartDecoderStream() {
|
|
1077
1079
|
controller.enqueue(decodeStreamPart(chunk));
|
1078
1080
|
}
|
1079
1081
|
});
|
1080
|
-
return new (0,
|
1082
|
+
return new (0, _chunkJ2V7Y7JXjs.PipeableTransformStream)((readable) => {
|
1081
1083
|
return readable.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(decodeStream);
|
1082
1084
|
});
|
1083
1085
|
}
|
1084
1086
|
|
1085
1087
|
// src/runtimes/edge/streams/utils/index.ts
|
1086
1088
|
var streamUtils = {
|
1087
|
-
streamPartEncoderStream:
|
1089
|
+
streamPartEncoderStream: _chunkJ2V7Y7JXjs.streamPartEncoderStream,
|
1088
1090
|
streamPartDecoderStream
|
1089
1091
|
};
|
1090
1092
|
|
@@ -1193,8 +1195,8 @@ var EdgeChatAdapter = class {
|
|
1193
1195
|
credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
|
1194
1196
|
body: JSON.stringify({
|
1195
1197
|
system: config.system,
|
1196
|
-
messages:
|
1197
|
-
tools: config.tools ?
|
1198
|
+
messages: _chunkJ2V7Y7JXjs.toCoreMessages.call(void 0, messages),
|
1199
|
+
tools: config.tools ? _chunkJ2V7Y7JXjs.toLanguageModelTools.call(void 0, config.tools) : [],
|
1198
1200
|
...config.callSettings,
|
1199
1201
|
...config.config,
|
1200
1202
|
...this.options.body
|
@@ -1204,7 +1206,7 @@ var EdgeChatAdapter = class {
|
|
1204
1206
|
if (result.status !== 200) {
|
1205
1207
|
throw new Error(`Status ${result.status}: ${await result.text()}`);
|
1206
1208
|
}
|
1207
|
-
const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(
|
1209
|
+
const stream = result.body.pipeThrough(streamPartDecoderStream()).pipeThrough(assistantDecoderStream()).pipeThrough(_chunkJ2V7Y7JXjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkJ2V7Y7JXjs.runResultStream.call(void 0, ));
|
1208
1210
|
let update;
|
1209
1211
|
for await (update of asAsyncIterable(stream)) {
|
1210
1212
|
yield update;
|
@@ -1258,7 +1260,8 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1258
1260
|
cancel: true,
|
1259
1261
|
unstable_copy: true,
|
1260
1262
|
speak: false,
|
1261
|
-
attachments: false
|
1263
|
+
attachments: false,
|
1264
|
+
feedback: false
|
1262
1265
|
}}
|
1263
1266
|
|
1264
1267
|
__init18() {this.isDisabled = false}
|
@@ -1269,6 +1272,9 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1269
1272
|
this,
|
1270
1273
|
this.notifySubscribers.bind(this)
|
1271
1274
|
)}
|
1275
|
+
getModelConfig() {
|
1276
|
+
return this.configProvider.getModelConfig();
|
1277
|
+
}
|
1272
1278
|
|
1273
1279
|
get options() {
|
1274
1280
|
return this._options;
|
@@ -1287,6 +1293,11 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1287
1293
|
this.capabilities.attachments = canAttach;
|
1288
1294
|
hasUpdates = true;
|
1289
1295
|
}
|
1296
|
+
const canFeedback = _optionalChain([options, 'access', _41 => _41.adapters, 'optionalAccess', _42 => _42.feedback]) !== void 0;
|
1297
|
+
if (this.capabilities.feedback !== canFeedback) {
|
1298
|
+
this.capabilities.feedback = canFeedback;
|
1299
|
+
hasUpdates = true;
|
1300
|
+
}
|
1290
1301
|
if (hasUpdates) this.notifySubscribers();
|
1291
1302
|
}
|
1292
1303
|
getBranches(messageId) {
|
@@ -1324,18 +1335,18 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1324
1335
|
}
|
1325
1336
|
async performRoundtrip(parentId, message) {
|
1326
1337
|
const messages = this.repository.getMessages();
|
1327
|
-
_optionalChain([this, 'access',
|
1338
|
+
_optionalChain([this, 'access', _43 => _43.abortController, 'optionalAccess', _44 => _44.abort, 'call', _45 => _45()]);
|
1328
1339
|
this.abortController = new AbortController();
|
1329
1340
|
const initialContent = message.content;
|
1330
|
-
const initialRoundtrips = _optionalChain([message, 'access',
|
1331
|
-
const initalCustom = _optionalChain([message, 'access',
|
1341
|
+
const initialRoundtrips = _optionalChain([message, 'access', _46 => _46.metadata, 'optionalAccess', _47 => _47.roundtrips]);
|
1342
|
+
const initalCustom = _optionalChain([message, 'access', _48 => _48.metadata, 'optionalAccess', _49 => _49.custom]);
|
1332
1343
|
const updateMessage = (m) => {
|
1333
1344
|
message = {
|
1334
1345
|
...message,
|
1335
1346
|
...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
|
1336
1347
|
status: _nullishCoalesce(m.status, () => ( message.status)),
|
1337
1348
|
// TODO deprecated, remove in v0.6
|
1338
|
-
..._optionalChain([m, 'access',
|
1349
|
+
..._optionalChain([m, 'access', _50 => _50.metadata, 'optionalAccess', _51 => _51.roundtrips]) ? {
|
1339
1350
|
roundtrips: [
|
1340
1351
|
..._nullishCoalesce(initialRoundtrips, () => ( [])),
|
1341
1352
|
...m.metadata.roundtrips
|
@@ -1350,7 +1361,7 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1350
1361
|
...m.metadata.roundtrips
|
1351
1362
|
]
|
1352
1363
|
} : void 0,
|
1353
|
-
..._optionalChain([m, 'access',
|
1364
|
+
..._optionalChain([m, 'access', _52 => _52.metadata, 'optionalAccess', _53 => _53.custom]) ? {
|
1354
1365
|
custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
|
1355
1366
|
} : void 0
|
1356
1367
|
}
|
@@ -1360,7 +1371,7 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1360
1371
|
this.notifySubscribers();
|
1361
1372
|
};
|
1362
1373
|
const maxToolRoundtrips = _nullishCoalesce(this.options.maxToolRoundtrips, () => ( 1));
|
1363
|
-
const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access',
|
1374
|
+
const toolRoundtrips = _nullishCoalesce(_optionalChain([message, 'access', _54 => _54.metadata, 'optionalAccess', _55 => _55.roundtrips, 'optionalAccess', _56 => _56.length]), () => ( 0));
|
1364
1375
|
if (toolRoundtrips > maxToolRoundtrips) {
|
1365
1376
|
updateMessage({
|
1366
1377
|
status: {
|
@@ -1459,7 +1470,7 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1459
1470
|
// TODO lift utterance state to thread runtime
|
1460
1471
|
|
1461
1472
|
speak(messageId) {
|
1462
|
-
const adapter = _optionalChain([this, 'access',
|
1473
|
+
const adapter = _optionalChain([this, 'access', _57 => _57.options, 'access', _58 => _58.adapters, 'optionalAccess', _59 => _59.speech]);
|
1463
1474
|
if (!adapter) throw new Error("Speech adapter not configured");
|
1464
1475
|
const { message } = this.repository.getMessage(messageId);
|
1465
1476
|
if (this._utterance) {
|
@@ -1475,6 +1486,12 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1475
1486
|
this._utterance = utterance;
|
1476
1487
|
return this._utterance;
|
1477
1488
|
}
|
1489
|
+
submitFeedback({ messageId, type }) {
|
1490
|
+
const adapter = _optionalChain([this, 'access', _60 => _60.options, 'access', _61 => _61.adapters, 'optionalAccess', _62 => _62.feedback]);
|
1491
|
+
if (!adapter) throw new Error("Feedback adapter not configured");
|
1492
|
+
const { message } = this.repository.getMessage(messageId);
|
1493
|
+
adapter.submit({ message, type });
|
1494
|
+
}
|
1478
1495
|
export() {
|
1479
1496
|
return this.repository.export();
|
1480
1497
|
}
|
@@ -1523,7 +1540,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
|
|
1523
1540
|
const messages = fromCoreMessages(initialMessages);
|
1524
1541
|
this.thread.import({
|
1525
1542
|
messages: messages.map((m, idx) => ({
|
1526
|
-
parentId: _nullishCoalesce(_optionalChain([messages, 'access',
|
1543
|
+
parentId: _nullishCoalesce(_optionalChain([messages, 'access', _63 => _63[idx - 1], 'optionalAccess', _64 => _64.id]), () => ( null)),
|
1527
1544
|
message: m
|
1528
1545
|
}))
|
1529
1546
|
});
|
@@ -1652,9 +1669,13 @@ var getThreadMessageText = (message) => {
|
|
1652
1669
|
|
1653
1670
|
// src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
|
1654
1671
|
var hasUpcomingMessage = (isRunning, messages) => {
|
1655
|
-
return isRunning && _optionalChain([messages, 'access',
|
1672
|
+
return isRunning && _optionalChain([messages, 'access', _65 => _65[messages.length - 1], 'optionalAccess', _66 => _66.role]) !== "assistant";
|
1656
1673
|
};
|
1657
1674
|
var ExternalStoreThreadRuntime = (_class8 = class {
|
1675
|
+
constructor(configProvider, store) {;_class8.prototype.__init21.call(this);_class8.prototype.__init22.call(this);_class8.prototype.__init23.call(this);_class8.prototype.__init24.call(this);_class8.prototype.__init25.call(this);_class8.prototype.__init26.call(this);_class8.prototype.__init27.call(this);
|
1676
|
+
this.configProvider = configProvider;
|
1677
|
+
this.store = store;
|
1678
|
+
}
|
1658
1679
|
__init21() {this._subscriptions = /* @__PURE__ */ new Set()}
|
1659
1680
|
__init22() {this.repository = new MessageRepository()}
|
1660
1681
|
__init23() {this.assistantOptimisticId = null}
|
@@ -1665,7 +1686,8 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1665
1686
|
cancel: false,
|
1666
1687
|
unstable_copy: false,
|
1667
1688
|
speak: false,
|
1668
|
-
attachments: false
|
1689
|
+
attachments: false,
|
1690
|
+
feedback: false
|
1669
1691
|
}}
|
1670
1692
|
get capabilities() {
|
1671
1693
|
return this._capabilities;
|
@@ -1679,9 +1701,6 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1679
1701
|
this,
|
1680
1702
|
this.notifySubscribers.bind(this)
|
1681
1703
|
)}
|
1682
|
-
constructor(store) {;_class8.prototype.__init21.call(this);_class8.prototype.__init22.call(this);_class8.prototype.__init23.call(this);_class8.prototype.__init24.call(this);_class8.prototype.__init25.call(this);_class8.prototype.__init26.call(this);_class8.prototype.__init27.call(this);
|
1683
|
-
this.store = store;
|
1684
|
-
}
|
1685
1704
|
get store() {
|
1686
1705
|
return this._store;
|
1687
1706
|
}
|
@@ -1698,11 +1717,12 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1698
1717
|
reload: this._store.onReload !== void 0,
|
1699
1718
|
cancel: this._store.onCancel !== void 0,
|
1700
1719
|
speak: this._store.onSpeak !== void 0,
|
1701
|
-
unstable_copy: _optionalChain([this, 'access',
|
1720
|
+
unstable_copy: _optionalChain([this, 'access', _70 => _70._store, 'access', _71 => _71.unstable_capabilities, 'optionalAccess', _72 => _72.copy]) !== false,
|
1702
1721
|
// default true
|
1703
|
-
attachments: !!_optionalChain([this, 'access',
|
1722
|
+
attachments: !!_optionalChain([this, 'access', _73 => _73.store, 'access', _74 => _74.adapters, 'optionalAccess', _75 => _75.attachments]),
|
1723
|
+
feedback: !!_optionalChain([this, 'access', _76 => _76.store, 'access', _77 => _77.adapters, 'optionalAccess', _78 => _78.feedback])
|
1704
1724
|
};
|
1705
|
-
this.composer.setAttachmentAdapter(_optionalChain([this, 'access',
|
1725
|
+
this.composer.setAttachmentAdapter(_optionalChain([this, 'access', _79 => _79._store, 'access', _80 => _80.adapters, 'optionalAccess', _81 => _81.attachments]));
|
1706
1726
|
if (oldStore) {
|
1707
1727
|
if (oldStore.convertMessage !== store.convertMessage) {
|
1708
1728
|
this.converter = new ThreadMessageConverter();
|
@@ -1728,7 +1748,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1728
1748
|
for (let i = 0; i < messages.length; i++) {
|
1729
1749
|
const message = messages[i];
|
1730
1750
|
const parent = messages[i - 1];
|
1731
|
-
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
1751
|
+
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _82 => _82.id]), () => ( null)), message);
|
1732
1752
|
}
|
1733
1753
|
if (this.assistantOptimisticId) {
|
1734
1754
|
this.repository.deleteMessage(this.assistantOptimisticId);
|
@@ -1736,7 +1756,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1736
1756
|
}
|
1737
1757
|
if (hasUpcomingMessage(isRunning, messages)) {
|
1738
1758
|
this.assistantOptimisticId = this.repository.appendOptimisticMessage(
|
1739
|
-
_nullishCoalesce(_optionalChain([messages, 'access',
|
1759
|
+
_nullishCoalesce(_optionalChain([messages, 'access', _83 => _83.at, 'call', _84 => _84(-1), 'optionalAccess', _85 => _85.id]), () => ( null)),
|
1740
1760
|
{
|
1741
1761
|
role: "assistant",
|
1742
1762
|
content: []
|
@@ -1744,11 +1764,14 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1744
1764
|
);
|
1745
1765
|
}
|
1746
1766
|
this.repository.resetHead(
|
1747
|
-
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access',
|
1767
|
+
_nullishCoalesce(_nullishCoalesce(this.assistantOptimisticId, () => ( _optionalChain([messages, 'access', _86 => _86.at, 'call', _87 => _87(-1), 'optionalAccess', _88 => _88.id]))), () => ( null))
|
1748
1768
|
);
|
1749
1769
|
this.messages = this.repository.getMessages();
|
1750
1770
|
this.notifySubscribers();
|
1751
1771
|
}
|
1772
|
+
getModelConfig() {
|
1773
|
+
return this.configProvider.getModelConfig();
|
1774
|
+
}
|
1752
1775
|
notifySubscribers() {
|
1753
1776
|
for (const callback of this._subscriptions) callback();
|
1754
1777
|
}
|
@@ -1762,7 +1785,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1762
1785
|
this.updateMessages(this.repository.getMessages());
|
1763
1786
|
}
|
1764
1787
|
async append(message) {
|
1765
|
-
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access',
|
1788
|
+
if (message.parentId !== (_nullishCoalesce(_optionalChain([this, 'access', _89 => _89.messages, 'access', _90 => _90.at, 'call', _91 => _91(-1), 'optionalAccess', _92 => _92.id]), () => ( null)))) {
|
1766
1789
|
if (!this._store.onEdit)
|
1767
1790
|
throw new Error("Runtime does not support editing messages.");
|
1768
1791
|
await this._store.onEdit(message);
|
@@ -1785,7 +1808,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1785
1808
|
}
|
1786
1809
|
let messages = this.repository.getMessages();
|
1787
1810
|
const previousMessage = messages[messages.length - 1];
|
1788
|
-
if (_optionalChain([previousMessage, 'optionalAccess',
|
1811
|
+
if (_optionalChain([previousMessage, 'optionalAccess', _93 => _93.role]) === "user" && previousMessage.id === _optionalChain([messages, 'access', _94 => _94.at, 'call', _95 => _95(-1), 'optionalAccess', _96 => _96.id])) {
|
1789
1812
|
this.repository.deleteMessage(previousMessage.id);
|
1790
1813
|
if (!this.composer.text.trim()) {
|
1791
1814
|
this.composer.setText(getThreadMessageText(previousMessage));
|
@@ -1809,22 +1832,30 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1809
1832
|
const { message } = this.repository.getMessage(messageId);
|
1810
1833
|
return this._store.onSpeak(message);
|
1811
1834
|
}
|
1835
|
+
submitFeedback({ messageId, type }) {
|
1836
|
+
const adapter = _optionalChain([this, 'access', _97 => _97._store, 'access', _98 => _98.adapters, 'optionalAccess', _99 => _99.feedback]);
|
1837
|
+
if (!adapter) throw new Error("Feedback adapter not configured");
|
1838
|
+
const { message } = this.repository.getMessage(messageId);
|
1839
|
+
adapter.submit({ message, type });
|
1840
|
+
}
|
1812
1841
|
subscribe(callback) {
|
1813
1842
|
this._subscriptions.add(callback);
|
1814
1843
|
return () => this._subscriptions.delete(callback);
|
1815
1844
|
}
|
1816
1845
|
__init27() {this.updateMessages = (messages) => {
|
1817
|
-
_optionalChain([this, 'access',
|
1846
|
+
_optionalChain([this, 'access', _100 => _100._store, 'access', _101 => _101.setMessages, 'optionalCall', _102 => _102(
|
1818
1847
|
messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
|
1819
1848
|
)]);
|
1820
1849
|
}}
|
1821
1850
|
}, _class8);
|
1822
1851
|
|
1823
1852
|
// src/runtimes/external-store/ExternalStoreRuntime.tsx
|
1824
|
-
var ExternalStoreRuntime =
|
1825
|
-
|
1853
|
+
var ExternalStoreRuntime = class extends BaseAssistantRuntime {
|
1854
|
+
|
1826
1855
|
constructor(store) {
|
1827
|
-
|
1856
|
+
const provider = new ProxyConfigProvider();
|
1857
|
+
super(new ExternalStoreThreadRuntime(provider, store));
|
1858
|
+
this._proxyConfigProvider = provider;
|
1828
1859
|
}
|
1829
1860
|
get store() {
|
1830
1861
|
return this.thread.store;
|
@@ -1841,7 +1872,7 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1841
1872
|
async switchToNewThread() {
|
1842
1873
|
if (!this.store.onSwitchToNewThread)
|
1843
1874
|
throw new Error("Runtime does not support switching to new threads.");
|
1844
|
-
this.thread = new ExternalStoreThreadRuntime({
|
1875
|
+
this.thread = new ExternalStoreThreadRuntime(this._proxyConfigProvider, {
|
1845
1876
|
...this.store,
|
1846
1877
|
messages: []
|
1847
1878
|
});
|
@@ -1851,7 +1882,7 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1851
1882
|
if (threadId !== null) {
|
1852
1883
|
if (!this.store.onSwitchToThread)
|
1853
1884
|
throw new Error("Runtime does not support switching threads.");
|
1854
|
-
this.thread = new ExternalStoreThreadRuntime({
|
1885
|
+
this.thread = new ExternalStoreThreadRuntime(this._proxyConfigProvider, {
|
1855
1886
|
...this.store,
|
1856
1887
|
messages: []
|
1857
1888
|
// ignore messages until rerender
|
@@ -1861,7 +1892,7 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1861
1892
|
this.switchToNewThread();
|
1862
1893
|
}
|
1863
1894
|
}
|
1864
|
-
}
|
1895
|
+
};
|
1865
1896
|
|
1866
1897
|
// src/runtimes/external-store/useExternalStoreRuntime.tsx
|
1867
1898
|
|
@@ -2029,18 +2060,18 @@ var DangerousInBrowserAdapter = class {
|
|
2029
2060
|
this.options = options;
|
2030
2061
|
}
|
2031
2062
|
async *run({ messages, abortSignal, config }) {
|
2032
|
-
const res = await
|
2063
|
+
const res = await _chunkJ2V7Y7JXjs.getEdgeRuntimeStream.call(void 0, {
|
2033
2064
|
options: this.options,
|
2034
2065
|
abortSignal,
|
2035
2066
|
requestData: {
|
2036
2067
|
system: config.system,
|
2037
|
-
messages:
|
2038
|
-
tools: config.tools ?
|
2068
|
+
messages: _chunkJ2V7Y7JXjs.toCoreMessages.call(void 0, messages),
|
2069
|
+
tools: config.tools ? _chunkJ2V7Y7JXjs.toLanguageModelTools.call(void 0, config.tools) : [],
|
2039
2070
|
...config.callSettings,
|
2040
2071
|
...config.config
|
2041
2072
|
}
|
2042
2073
|
});
|
2043
|
-
const stream = res.pipeThrough(
|
2074
|
+
const stream = res.pipeThrough(_chunkJ2V7Y7JXjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkJ2V7Y7JXjs.runResultStream.call(void 0, ));
|
2044
2075
|
for await (const update of asAsyncIterable(stream)) {
|
2045
2076
|
yield update;
|
2046
2077
|
}
|
@@ -2098,8 +2129,8 @@ var WebSpeechSynthesisAdapter = class {
|
|
2098
2129
|
};
|
2099
2130
|
|
2100
2131
|
// src/runtimes/attachment/SimpleImageAttachmentAdapter.ts
|
2101
|
-
var SimpleImageAttachmentAdapter = (
|
2102
|
-
|
2132
|
+
var SimpleImageAttachmentAdapter = (_class9 = class {constructor() { _class9.prototype.__init28.call(this); }
|
2133
|
+
__init28() {this.accept = "image/*"}
|
2103
2134
|
async add(state) {
|
2104
2135
|
return {
|
2105
2136
|
id: state.file.name,
|
@@ -2121,7 +2152,7 @@ var SimpleImageAttachmentAdapter = (_class10 = class {constructor() { _class10.p
|
|
2121
2152
|
}
|
2122
2153
|
async remove() {
|
2123
2154
|
}
|
2124
|
-
},
|
2155
|
+
}, _class9);
|
2125
2156
|
var getFileDataURL = (file) => new Promise((resolve, reject) => {
|
2126
2157
|
const reader = new FileReader();
|
2127
2158
|
reader.onload = () => resolve(reader.result);
|
@@ -2130,8 +2161,8 @@ var getFileDataURL = (file) => new Promise((resolve, reject) => {
|
|
2130
2161
|
});
|
2131
2162
|
|
2132
2163
|
// src/runtimes/attachment/SimpleTextAttachmentAdapter.ts
|
2133
|
-
var SimpleTextAttachmentAdapter = (
|
2134
|
-
|
2164
|
+
var SimpleTextAttachmentAdapter = (_class10 = class {constructor() { _class10.prototype.__init29.call(this); }
|
2165
|
+
__init29() {this.accept = "text/plain,text/html,text/markdown,text/csv,text/xml,text/json,text/css"}
|
2135
2166
|
async add(state) {
|
2136
2167
|
return {
|
2137
2168
|
id: state.file.name,
|
@@ -2155,7 +2186,7 @@ ${await getFileText(attachment.file)}
|
|
2155
2186
|
}
|
2156
2187
|
async remove() {
|
2157
2188
|
}
|
2158
|
-
},
|
2189
|
+
}, _class10);
|
2159
2190
|
var getFileText = (file) => new Promise((resolve, reject) => {
|
2160
2191
|
const reader = new FileReader();
|
2161
2192
|
reader.onload = () => resolve(reader.result);
|
@@ -2428,14 +2459,14 @@ var { useComposer, useComposerStore } = createContextStoreHook(
|
|
2428
2459
|
var toAppendMessage = (useThreadMessages2, message) => {
|
2429
2460
|
if (typeof message === "string") {
|
2430
2461
|
return {
|
2431
|
-
parentId: _nullishCoalesce(_optionalChain([useThreadMessages2, 'access',
|
2462
|
+
parentId: _nullishCoalesce(_optionalChain([useThreadMessages2, 'access', _103 => _103.getState, 'call', _104 => _104(), 'access', _105 => _105.at, 'call', _106 => _106(-1), 'optionalAccess', _107 => _107.id]), () => ( null)),
|
2432
2463
|
role: "user",
|
2433
2464
|
content: [{ type: "text", text: message }],
|
2434
2465
|
attachments: []
|
2435
2466
|
};
|
2436
2467
|
}
|
2437
2468
|
return {
|
2438
|
-
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages2, 'access',
|
2469
|
+
parentId: _nullishCoalesce(_nullishCoalesce(message.parentId, () => ( _optionalChain([useThreadMessages2, 'access', _108 => _108.getState, 'call', _109 => _109(), 'access', _110 => _110.at, 'call', _111 => _111(-1), 'optionalAccess', _112 => _112.id]))), () => ( null)),
|
2439
2470
|
role: _nullishCoalesce(message.role, () => ( "user")),
|
2440
2471
|
content: message.content,
|
2441
2472
|
attachments: _nullishCoalesce(message.attachments, () => ( []))
|
@@ -2493,7 +2524,7 @@ var useAssistantTool = (tool) => {
|
|
2493
2524
|
const unsub2 = render ? toolUIsStore.getState().setToolUI(toolName, render) : void 0;
|
2494
2525
|
return () => {
|
2495
2526
|
unsub1();
|
2496
|
-
_optionalChain([unsub2, 'optionalCall',
|
2527
|
+
_optionalChain([unsub2, 'optionalCall', _113 => _113()]);
|
2497
2528
|
};
|
2498
2529
|
}, [assistantActionsStore, toolUIsStore, tool]);
|
2499
2530
|
};
|
@@ -2671,6 +2702,38 @@ var useActionBarStopSpeaking = () => {
|
|
2671
2702
|
return callback;
|
2672
2703
|
};
|
2673
2704
|
|
2705
|
+
// src/primitive-hooks/actionBar/useActionBarFeedbackPositive.tsx
|
2706
|
+
|
2707
|
+
var useActionBarFeedbackPositive = () => {
|
2708
|
+
const threadActions = useThreadActions();
|
2709
|
+
const messageStore = useMessageStore();
|
2710
|
+
const messageUtilsStore = useMessageUtilsStore();
|
2711
|
+
const callback = _react.useCallback.call(void 0, () => {
|
2712
|
+
threadActions.submitFeedback({
|
2713
|
+
messageId: messageStore.getState().message.id,
|
2714
|
+
type: "positive"
|
2715
|
+
});
|
2716
|
+
messageUtilsStore.getState().setSubmittedFeedback("positive");
|
2717
|
+
}, [messageStore, messageUtilsStore, threadActions]);
|
2718
|
+
return callback;
|
2719
|
+
};
|
2720
|
+
|
2721
|
+
// src/primitive-hooks/actionBar/useActionBarFeedbackNegative.tsx
|
2722
|
+
|
2723
|
+
var useActionBarFeedbackNegative = () => {
|
2724
|
+
const threadActions = useThreadActions();
|
2725
|
+
const messageStore = useMessageStore();
|
2726
|
+
const messageUtilsStore = useMessageUtilsStore();
|
2727
|
+
const callback = _react.useCallback.call(void 0, () => {
|
2728
|
+
threadActions.submitFeedback({
|
2729
|
+
messageId: messageStore.getState().message.id,
|
2730
|
+
type: "negative"
|
2731
|
+
});
|
2732
|
+
messageUtilsStore.getState().setSubmittedFeedback("negative");
|
2733
|
+
}, [messageStore, messageUtilsStore, threadActions]);
|
2734
|
+
return callback;
|
2735
|
+
};
|
2736
|
+
|
2674
2737
|
// src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
|
2675
2738
|
var useBranchPickerCount = () => {
|
2676
2739
|
const branchCount = useMessage((s) => s.branches.length);
|
@@ -2778,7 +2841,7 @@ var useComposerAddAttachment = () => {
|
|
2778
2841
|
input.accept = attachmentAccept;
|
2779
2842
|
}
|
2780
2843
|
input.onchange = (e) => {
|
2781
|
-
const file = _optionalChain([e, 'access',
|
2844
|
+
const file = _optionalChain([e, 'access', _114 => _114.target, 'access', _115 => _115.files, 'optionalAccess', _116 => _116[0]]);
|
2782
2845
|
if (!file) return;
|
2783
2846
|
addAttachment(file);
|
2784
2847
|
};
|
@@ -2830,7 +2893,7 @@ var useMessageIf = (props) => {
|
|
2830
2893
|
const messageUtilsStore = useMessageUtilsStore();
|
2831
2894
|
return useCombinedStore(
|
2832
2895
|
[messageStore, messageUtilsStore],
|
2833
|
-
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
|
2896
|
+
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking, submittedFeedback }) => {
|
2834
2897
|
if (props.hasBranches === true && branches.length < 2) return false;
|
2835
2898
|
if (props.user && message.role !== "user") return false;
|
2836
2899
|
if (props.assistant && message.role !== "assistant") return false;
|
@@ -2844,6 +2907,8 @@ var useMessageIf = (props) => {
|
|
2844
2907
|
return false;
|
2845
2908
|
if (props.hasAttachments === false && message.role === "user" && !!message.attachments.length)
|
2846
2909
|
return false;
|
2910
|
+
if (props.submittedFeedback !== void 0 && submittedFeedback !== props.submittedFeedback)
|
2911
|
+
return false;
|
2847
2912
|
return true;
|
2848
2913
|
}
|
2849
2914
|
);
|
@@ -2915,6 +2980,8 @@ var actionBar_exports = {};
|
|
2915
2980
|
_chunkDCHYNTHIjs.__export.call(void 0, actionBar_exports, {
|
2916
2981
|
Copy: () => ActionBarPrimitiveCopy,
|
2917
2982
|
Edit: () => ActionBarPrimitiveEdit,
|
2983
|
+
FeedbackNegative: () => ActionBarPrimitiveFeedbackNegative,
|
2984
|
+
FeedbackPositive: () => ActionBarPrimitiveFeedbackPositive,
|
2918
2985
|
Reload: () => ActionBarPrimitiveReload,
|
2919
2986
|
Root: () => ActionBarPrimitiveRoot,
|
2920
2987
|
Speak: () => ActionBarPrimitiveSpeak,
|
@@ -2968,10 +3035,34 @@ var ActionBarPrimitiveRoot = _react.forwardRef.call(void 0, ({ hideWhenRunning,
|
|
2968
3035
|
});
|
2969
3036
|
ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
|
2970
3037
|
|
3038
|
+
// src/primitives/actionBar/ActionBarCopy.tsx
|
3039
|
+
|
3040
|
+
var _primitive = require('@radix-ui/primitive');
|
3041
|
+
|
3042
|
+
|
3043
|
+
var ActionBarPrimitiveCopy = _react.forwardRef.call(void 0, ({ copiedDuration, onClick, disabled, ...props }, forwardedRef) => {
|
3044
|
+
const isCopied = useMessageUtils((u) => u.isCopied);
|
3045
|
+
const callback = useActionBarCopy({ copiedDuration });
|
3046
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
3047
|
+
_reactprimitive.Primitive.button,
|
3048
|
+
{
|
3049
|
+
type: "button",
|
3050
|
+
...isCopied ? { "data-copied": "true" } : {},
|
3051
|
+
...props,
|
3052
|
+
ref: forwardedRef,
|
3053
|
+
disabled: disabled || !callback,
|
3054
|
+
onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
|
3055
|
+
_optionalChain([callback, 'optionalCall', _117 => _117()]);
|
3056
|
+
})
|
3057
|
+
}
|
3058
|
+
);
|
3059
|
+
});
|
3060
|
+
ActionBarPrimitiveCopy.displayName = "ActionBarPrimitive.Copy";
|
3061
|
+
|
2971
3062
|
// src/utils/createActionButton.tsx
|
2972
3063
|
|
2973
3064
|
|
2974
|
-
|
3065
|
+
|
2975
3066
|
|
2976
3067
|
var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
2977
3068
|
const ActionButton = _react.forwardRef.call(void 0, (props, forwardedRef) => {
|
@@ -2993,7 +3084,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2993
3084
|
ref: forwardedRef,
|
2994
3085
|
disabled: primitiveProps.disabled || !callback,
|
2995
3086
|
onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
|
2996
|
-
_optionalChain([callback, 'optionalCall',
|
3087
|
+
_optionalChain([callback, 'optionalCall', _118 => _118()]);
|
2997
3088
|
})
|
2998
3089
|
}
|
2999
3090
|
);
|
@@ -3002,13 +3093,6 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
3002
3093
|
return ActionButton;
|
3003
3094
|
};
|
3004
3095
|
|
3005
|
-
// src/primitives/actionBar/ActionBarCopy.tsx
|
3006
|
-
var ActionBarPrimitiveCopy = createActionButton(
|
3007
|
-
"ActionBarPrimitive.Copy",
|
3008
|
-
useActionBarCopy,
|
3009
|
-
["copiedDuration"]
|
3010
|
-
);
|
3011
|
-
|
3012
3096
|
// src/primitives/actionBar/ActionBarReload.tsx
|
3013
3097
|
var ActionBarPrimitiveReload = createActionButton(
|
3014
3098
|
"ActionBarPrimitive.Reload",
|
@@ -3049,13 +3133,65 @@ var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref)
|
|
3049
3133
|
...props,
|
3050
3134
|
ref,
|
3051
3135
|
onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
|
3052
|
-
_optionalChain([callback, 'optionalCall',
|
3136
|
+
_optionalChain([callback, 'optionalCall', _119 => _119()]);
|
3053
3137
|
})
|
3054
3138
|
}
|
3055
3139
|
);
|
3056
3140
|
});
|
3057
3141
|
ActionBarPrimitiveStopSpeaking.displayName = "ActionBarPrimitive.StopSpeaking";
|
3058
3142
|
|
3143
|
+
// src/primitives/actionBar/ActionBarFeedbackPositive.tsx
|
3144
|
+
|
3145
|
+
|
3146
|
+
|
3147
|
+
|
3148
|
+
var ActionBarPrimitiveFeedbackPositive = _react.forwardRef.call(void 0, ({ onClick, disabled, ...props }, forwardedRef) => {
|
3149
|
+
const isSubmitted = useMessageUtils(
|
3150
|
+
(u) => u.submittedFeedback === "positive"
|
3151
|
+
);
|
3152
|
+
const callback = useActionBarFeedbackPositive();
|
3153
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
3154
|
+
_reactprimitive.Primitive.button,
|
3155
|
+
{
|
3156
|
+
type: "button",
|
3157
|
+
...isSubmitted ? { "data-submitted": "true" } : {},
|
3158
|
+
...props,
|
3159
|
+
ref: forwardedRef,
|
3160
|
+
disabled: disabled || !callback,
|
3161
|
+
onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
|
3162
|
+
_optionalChain([callback, 'optionalCall', _120 => _120()]);
|
3163
|
+
})
|
3164
|
+
}
|
3165
|
+
);
|
3166
|
+
});
|
3167
|
+
ActionBarPrimitiveFeedbackPositive.displayName = "ActionBarPrimitive.FeedbackPositive";
|
3168
|
+
|
3169
|
+
// src/primitives/actionBar/ActionBarFeedbackNegative.tsx
|
3170
|
+
|
3171
|
+
|
3172
|
+
|
3173
|
+
|
3174
|
+
var ActionBarPrimitiveFeedbackNegative = _react.forwardRef.call(void 0, ({ onClick, disabled, ...props }, forwardedRef) => {
|
3175
|
+
const isSubmitted = useMessageUtils(
|
3176
|
+
(u) => u.submittedFeedback === "negative"
|
3177
|
+
);
|
3178
|
+
const callback = useActionBarFeedbackNegative();
|
3179
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
3180
|
+
_reactprimitive.Primitive.button,
|
3181
|
+
{
|
3182
|
+
type: "button",
|
3183
|
+
...isSubmitted ? { "data-submitted": "true" } : {},
|
3184
|
+
...props,
|
3185
|
+
ref: forwardedRef,
|
3186
|
+
disabled: disabled || !callback,
|
3187
|
+
onClick: _primitive.composeEventHandlers.call(void 0, onClick, () => {
|
3188
|
+
_optionalChain([callback, 'optionalCall', _121 => _121()]);
|
3189
|
+
})
|
3190
|
+
}
|
3191
|
+
);
|
3192
|
+
});
|
3193
|
+
ActionBarPrimitiveFeedbackNegative.displayName = "ActionBarPrimitive.FeedbackNegative";
|
3194
|
+
|
3059
3195
|
// src/primitives/assistantModal/index.ts
|
3060
3196
|
var assistantModal_exports = {};
|
3061
3197
|
_chunkDCHYNTHIjs.__export.call(void 0, assistantModal_exports, {
|
@@ -3284,9 +3420,9 @@ var useIsHoveringRef = () => {
|
|
3284
3420
|
);
|
3285
3421
|
return useManagedRef(callbackRef);
|
3286
3422
|
};
|
3287
|
-
var MessagePrimitiveRoot = _react.forwardRef.call(void 0, (props,
|
3423
|
+
var MessagePrimitiveRoot = _react.forwardRef.call(void 0, (props, forwardRef33) => {
|
3288
3424
|
const isHoveringRef = useIsHoveringRef();
|
3289
|
-
const ref = _reactcomposerefs.useComposedRefs.call(void 0,
|
3425
|
+
const ref = _reactcomposerefs.useComposedRefs.call(void 0, forwardRef33, isHoveringRef);
|
3290
3426
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactprimitive.Primitive.div, { ...props, ref });
|
3291
3427
|
});
|
3292
3428
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
@@ -3339,7 +3475,7 @@ var getContentPartState = ({ message }, useContentPart2, partIndex) => {
|
|
3339
3475
|
part = EMPTY_CONTENT;
|
3340
3476
|
}
|
3341
3477
|
const status = toContentPartStatus(message, partIndex, part);
|
3342
|
-
const currentState = _optionalChain([useContentPart2, 'optionalAccess',
|
3478
|
+
const currentState = _optionalChain([useContentPart2, 'optionalAccess', _122 => _122.getState, 'call', _123 => _123()]);
|
3343
3479
|
if (currentState && currentState.part === part && currentState.status === status)
|
3344
3480
|
return null;
|
3345
3481
|
return Object.freeze({ part, status });
|
@@ -3495,7 +3631,7 @@ var MessageContentPartImpl = ({
|
|
3495
3631
|
};
|
3496
3632
|
var MessageContentPart = _react.memo.call(void 0,
|
3497
3633
|
MessageContentPartImpl,
|
3498
|
-
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access',
|
3634
|
+
(prev, next) => prev.partIndex === next.partIndex && _optionalChain([prev, 'access', _124 => _124.components, 'optionalAccess', _125 => _125.Text]) === _optionalChain([next, 'access', _126 => _126.components, 'optionalAccess', _127 => _127.Text]) && _optionalChain([prev, 'access', _128 => _128.components, 'optionalAccess', _129 => _129.Image]) === _optionalChain([next, 'access', _130 => _130.components, 'optionalAccess', _131 => _131.Image]) && _optionalChain([prev, 'access', _132 => _132.components, 'optionalAccess', _133 => _133.UI]) === _optionalChain([next, 'access', _134 => _134.components, 'optionalAccess', _135 => _135.UI]) && _optionalChain([prev, 'access', _136 => _136.components, 'optionalAccess', _137 => _137.tools]) === _optionalChain([next, 'access', _138 => _138.components, 'optionalAccess', _139 => _139.tools])
|
3499
3635
|
);
|
3500
3636
|
var MessagePrimitiveContent = ({
|
3501
3637
|
components
|
@@ -3521,7 +3657,7 @@ var AttachmentContext = _react.createContext.call(void 0,
|
|
3521
3657
|
);
|
3522
3658
|
function useAttachmentContext(options) {
|
3523
3659
|
const context = _react.useContext.call(void 0, AttachmentContext);
|
3524
|
-
if (!_optionalChain([options, 'optionalAccess',
|
3660
|
+
if (!_optionalChain([options, 'optionalAccess', _140 => _140.optional]) && !context)
|
3525
3661
|
throw new Error(
|
3526
3662
|
"This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
|
3527
3663
|
);
|
@@ -3567,7 +3703,7 @@ var getAttachment = ({ message }, useAttachment2, partIndex) => {
|
|
3567
3703
|
const attachments = message.attachments;
|
3568
3704
|
const attachment = attachments[partIndex];
|
3569
3705
|
if (!attachment) return null;
|
3570
|
-
const currentState = _optionalChain([useAttachment2, 'optionalAccess',
|
3706
|
+
const currentState = _optionalChain([useAttachment2, 'optionalAccess', _141 => _141.getState, 'call', _142 => _142()]);
|
3571
3707
|
if (currentState && currentState.attachment === attachment) return null;
|
3572
3708
|
return Object.freeze({ attachment });
|
3573
3709
|
};
|
@@ -3610,11 +3746,11 @@ var getComponent = (components, attachment) => {
|
|
3610
3746
|
const type = attachment.type;
|
3611
3747
|
switch (type) {
|
3612
3748
|
case "image":
|
3613
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3749
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _143 => _143.Image]), () => ( _optionalChain([components, 'optionalAccess', _144 => _144.Attachment])));
|
3614
3750
|
case "document":
|
3615
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3751
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _145 => _145.Document]), () => ( _optionalChain([components, 'optionalAccess', _146 => _146.Attachment])));
|
3616
3752
|
case "file":
|
3617
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3753
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _147 => _147.File]), () => ( _optionalChain([components, 'optionalAccess', _148 => _148.Attachment])));
|
3618
3754
|
default:
|
3619
3755
|
const _exhaustiveCheck = type;
|
3620
3756
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
@@ -3632,7 +3768,7 @@ var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
3632
3768
|
};
|
3633
3769
|
var MessageAttachment = _react.memo.call(void 0,
|
3634
3770
|
MessageAttachmentImpl,
|
3635
|
-
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access',
|
3771
|
+
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _149 => _149.components, 'optionalAccess', _150 => _150.Image]) === _optionalChain([next, 'access', _151 => _151.components, 'optionalAccess', _152 => _152.Image]) && _optionalChain([prev, 'access', _153 => _153.components, 'optionalAccess', _154 => _154.Document]) === _optionalChain([next, 'access', _155 => _155.components, 'optionalAccess', _156 => _156.Document]) && _optionalChain([prev, 'access', _157 => _157.components, 'optionalAccess', _158 => _158.File]) === _optionalChain([next, 'access', _159 => _159.components, 'optionalAccess', _160 => _160.File]) && _optionalChain([prev, 'access', _161 => _161.components, 'optionalAccess', _162 => _162.Attachment]) === _optionalChain([next, 'access', _163 => _163.components, 'optionalAccess', _164 => _164.Attachment])
|
3636
3772
|
);
|
3637
3773
|
var MessagePrimitiveAttachments = ({ components }) => {
|
3638
3774
|
const attachmentsCount = useMessage(({ message }) => {
|
@@ -3740,7 +3876,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
|
3740
3876
|
const { isRunning } = threadStore.getState();
|
3741
3877
|
if (!isRunning) {
|
3742
3878
|
e.preventDefault();
|
3743
|
-
_optionalChain([textareaRef, 'access',
|
3879
|
+
_optionalChain([textareaRef, 'access', _165 => _165.current, 'optionalAccess', _166 => _166.closest, 'call', _167 => _167("form"), 'optionalAccess', _168 => _168.requestSubmit, 'call', _169 => _169()]);
|
3744
3880
|
}
|
3745
3881
|
}
|
3746
3882
|
};
|
@@ -3808,7 +3944,7 @@ var ComposerPrimitiveAddAttachment = createActionButton(
|
|
3808
3944
|
var getAttachment2 = ({ attachments }, useAttachment2, partIndex) => {
|
3809
3945
|
const attachment = attachments[partIndex];
|
3810
3946
|
if (!attachment) return null;
|
3811
|
-
const currentState = _optionalChain([useAttachment2, 'optionalAccess',
|
3947
|
+
const currentState = _optionalChain([useAttachment2, 'optionalAccess', _170 => _170.getState, 'call', _171 => _171()]);
|
3812
3948
|
if (currentState && currentState.attachment === attachment) return null;
|
3813
3949
|
return Object.freeze({ attachment });
|
3814
3950
|
};
|
@@ -3848,11 +3984,11 @@ var getComponent2 = (components, attachment) => {
|
|
3848
3984
|
const type = attachment.type;
|
3849
3985
|
switch (type) {
|
3850
3986
|
case "image":
|
3851
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3987
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _172 => _172.Image]), () => ( _optionalChain([components, 'optionalAccess', _173 => _173.Attachment])));
|
3852
3988
|
case "document":
|
3853
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3989
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _174 => _174.Document]), () => ( _optionalChain([components, 'optionalAccess', _175 => _175.Attachment])));
|
3854
3990
|
case "file":
|
3855
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3991
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _176 => _176.File]), () => ( _optionalChain([components, 'optionalAccess', _177 => _177.Attachment])));
|
3856
3992
|
default:
|
3857
3993
|
const _exhaustiveCheck = type;
|
3858
3994
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
@@ -3870,7 +4006,7 @@ var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
3870
4006
|
};
|
3871
4007
|
var ComposerAttachment = _react.memo.call(void 0,
|
3872
4008
|
ComposerAttachmentImpl,
|
3873
|
-
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access',
|
4009
|
+
(prev, next) => prev.attachmentIndex === next.attachmentIndex && _optionalChain([prev, 'access', _178 => _178.components, 'optionalAccess', _179 => _179.Image]) === _optionalChain([next, 'access', _180 => _180.components, 'optionalAccess', _181 => _181.Image]) && _optionalChain([prev, 'access', _182 => _182.components, 'optionalAccess', _183 => _183.Document]) === _optionalChain([next, 'access', _184 => _184.components, 'optionalAccess', _185 => _185.Document]) && _optionalChain([prev, 'access', _186 => _186.components, 'optionalAccess', _187 => _187.File]) === _optionalChain([next, 'access', _188 => _188.components, 'optionalAccess', _189 => _189.File]) && _optionalChain([prev, 'access', _190 => _190.components, 'optionalAccess', _191 => _191.Attachment]) === _optionalChain([next, 'access', _192 => _192.components, 'optionalAccess', _193 => _193.Attachment])
|
3874
4010
|
);
|
3875
4011
|
var ComposerPrimitiveAttachments = ({ components }) => {
|
3876
4012
|
const attachmentsCount = useThreadComposer((s) => s.attachments.length);
|
@@ -4129,7 +4265,7 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
4129
4265
|
},
|
4130
4266
|
isSpeaking: false,
|
4131
4267
|
stopSpeaking: () => {
|
4132
|
-
_optionalChain([utterance, 'optionalAccess',
|
4268
|
+
_optionalChain([utterance, 'optionalAccess', _194 => _194.cancel, 'call', _195 => _195()]);
|
4133
4269
|
},
|
4134
4270
|
addUtterance: (utt) => {
|
4135
4271
|
utterance = utt;
|
@@ -4137,6 +4273,10 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
4137
4273
|
utt.onEnd(() => {
|
4138
4274
|
set({ isSpeaking: false });
|
4139
4275
|
});
|
4276
|
+
},
|
4277
|
+
submittedFeedback: null,
|
4278
|
+
setSubmittedFeedback: (feedback) => {
|
4279
|
+
set({ submittedFeedback: feedback });
|
4140
4280
|
}
|
4141
4281
|
};
|
4142
4282
|
});
|
@@ -4144,15 +4284,15 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
4144
4284
|
// src/context/providers/MessageProvider.tsx
|
4145
4285
|
|
4146
4286
|
var getIsLast = (messages, message) => {
|
4147
|
-
return _optionalChain([messages, 'access',
|
4287
|
+
return _optionalChain([messages, 'access', _196 => _196[messages.length - 1], 'optionalAccess', _197 => _197.id]) === message.id;
|
4148
4288
|
};
|
4149
4289
|
var getMessageState = (messages, getBranches, useMessage2, messageIndex) => {
|
4150
|
-
const parentId = _nullishCoalesce(_optionalChain([messages, 'access',
|
4290
|
+
const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _198 => _198[messageIndex - 1], 'optionalAccess', _199 => _199.id]), () => ( null));
|
4151
4291
|
const message = messages[messageIndex];
|
4152
4292
|
if (!message) return null;
|
4153
4293
|
const isLast = getIsLast(messages, message);
|
4154
4294
|
const branches = getBranches(message.id);
|
4155
|
-
const currentState = _optionalChain([useMessage2, 'optionalAccess',
|
4295
|
+
const currentState = _optionalChain([useMessage2, 'optionalAccess', _200 => _200.getState, 'call', _201 => _201()]);
|
4156
4296
|
if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
|
4157
4297
|
return null;
|
4158
4298
|
return Object.freeze({
|
@@ -4313,7 +4453,7 @@ var ThreadConfigProvider = ({
|
|
4313
4453
|
}) => {
|
4314
4454
|
const hasAssistant = !!useAssistantRuntimeStore({ optional: true });
|
4315
4455
|
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 });
|
4316
|
-
if (!_optionalChain([config, 'optionalAccess',
|
4456
|
+
if (!_optionalChain([config, 'optionalAccess', _202 => _202.runtime])) return configProvider;
|
4317
4457
|
if (hasAssistant) {
|
4318
4458
|
throw new Error(
|
4319
4459
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
@@ -4331,6 +4471,8 @@ ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
|
4331
4471
|
|
4332
4472
|
|
4333
4473
|
|
4474
|
+
|
4475
|
+
|
4334
4476
|
var _lucidereact = require('lucide-react');
|
4335
4477
|
|
4336
4478
|
var useAllowCopy = (ensureCapability = false) => {
|
@@ -4348,11 +4490,24 @@ var useAllowReload = (ensureCapability = false) => {
|
|
4348
4490
|
const reloadSupported = useThread((t) => t.capabilities.reload);
|
4349
4491
|
return allowReload && (!ensureCapability || reloadSupported);
|
4350
4492
|
};
|
4493
|
+
var useAllowFeedbackPositive = (ensureCapability = false) => {
|
4494
|
+
const { assistantMessage: { allowFeedbackPositive = true } = {} } = useThreadConfig();
|
4495
|
+
const feedbackSupported = useThread((t) => t.capabilities.feedback);
|
4496
|
+
return allowFeedbackPositive && (!ensureCapability || feedbackSupported);
|
4497
|
+
};
|
4498
|
+
var useAllowFeedbackNegative = (ensureCapability = false) => {
|
4499
|
+
const { assistantMessage: { allowFeedbackNegative = true } = {} } = useThreadConfig();
|
4500
|
+
const feedbackSupported = useThread((t) => t.capabilities.feedback);
|
4501
|
+
return allowFeedbackNegative && (!ensureCapability || feedbackSupported);
|
4502
|
+
};
|
4351
4503
|
var AssistantActionBar = () => {
|
4352
4504
|
const allowCopy = useAllowCopy(true);
|
4353
4505
|
const allowReload = useAllowReload(true);
|
4354
4506
|
const allowSpeak = useAllowSpeak(true);
|
4355
|
-
|
4507
|
+
const allowFeedbackPositive = useAllowFeedbackPositive(true);
|
4508
|
+
const allowFeedbackNegative = useAllowFeedbackNegative(true);
|
4509
|
+
if (!allowCopy && !allowReload && !allowSpeak && !allowFeedbackPositive && !allowFeedbackNegative)
|
4510
|
+
return null;
|
4356
4511
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
4357
4512
|
AssistantActionBarRoot,
|
4358
4513
|
{
|
@@ -4362,7 +4517,9 @@ var AssistantActionBar = () => {
|
|
4362
4517
|
children: [
|
4363
4518
|
allowSpeak && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarSpeechControl, {}),
|
4364
4519
|
allowCopy && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarCopy, {}),
|
4365
|
-
allowReload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarReload, {})
|
4520
|
+
allowReload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarReload, {}),
|
4521
|
+
allowFeedbackPositive && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarFeedbackPositive, {}),
|
4522
|
+
allowFeedbackNegative && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarFeedbackNegative, {})
|
4366
4523
|
]
|
4367
4524
|
}
|
4368
4525
|
);
|
@@ -4419,16 +4576,58 @@ var AssistantActionBarReload = _react.forwardRef.call(void 0, (props, ref) => {
|
|
4419
4576
|
} = {}
|
4420
4577
|
} = useThreadConfig();
|
4421
4578
|
const allowReload = useAllowReload();
|
4422
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipIconButton, { tooltip, ...props, ref, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCwIcon, {}) }) });
|
4579
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, actionBar_exports.Reload, { disabled: !allowReload, asChild: true, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipIconButton, { tooltip, ...props, ref, children: _nullishCoalesce(props.children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.RefreshCwIcon, {}))) }) });
|
4423
4580
|
});
|
4424
4581
|
AssistantActionBarReload.displayName = "AssistantActionBarReload";
|
4582
|
+
var AssistantActionBarFeedbackPositive = _react.forwardRef.call(void 0, (props, ref) => {
|
4583
|
+
const {
|
4584
|
+
strings: {
|
4585
|
+
assistantMessage: {
|
4586
|
+
feedback: { positive: { tooltip = "Good response" } = {} } = {}
|
4587
|
+
} = {}
|
4588
|
+
} = {}
|
4589
|
+
} = useThreadConfig();
|
4590
|
+
const allowFeedbackPositive = useAllowFeedbackPositive();
|
4591
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
4592
|
+
actionBar_exports.FeedbackPositive,
|
4593
|
+
{
|
4594
|
+
disabled: !allowFeedbackPositive,
|
4595
|
+
className: "aui-assistant-action-bar-feedback-positive",
|
4596
|
+
asChild: true,
|
4597
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipIconButton, { tooltip, ...props, ref, children: _nullishCoalesce(props.children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ThumbsUpIcon, {}))) })
|
4598
|
+
}
|
4599
|
+
);
|
4600
|
+
});
|
4601
|
+
AssistantActionBarFeedbackPositive.displayName = "AssistantActionBarFeedbackPositive";
|
4602
|
+
var AssistantActionBarFeedbackNegative = _react.forwardRef.call(void 0, (props, ref) => {
|
4603
|
+
const {
|
4604
|
+
strings: {
|
4605
|
+
assistantMessage: {
|
4606
|
+
feedback: { negative: { tooltip = "Bad response" } = {} } = {}
|
4607
|
+
} = {}
|
4608
|
+
} = {}
|
4609
|
+
} = useThreadConfig();
|
4610
|
+
const allowFeedbackNegative = useAllowFeedbackNegative();
|
4611
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
4612
|
+
actionBar_exports.FeedbackNegative,
|
4613
|
+
{
|
4614
|
+
disabled: !allowFeedbackNegative,
|
4615
|
+
className: "aui-assistant-action-bar-feedback-negative",
|
4616
|
+
asChild: true,
|
4617
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, TooltipIconButton, { tooltip, ...props, ref, children: _nullishCoalesce(props.children, () => ( /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _lucidereact.ThumbsDownIcon, {}))) })
|
4618
|
+
}
|
4619
|
+
);
|
4620
|
+
});
|
4621
|
+
AssistantActionBarFeedbackNegative.displayName = "AssistantActionBarFeedbackNegative";
|
4425
4622
|
var exports = {
|
4426
4623
|
Root: AssistantActionBarRoot,
|
4427
4624
|
Reload: AssistantActionBarReload,
|
4428
4625
|
Copy: AssistantActionBarCopy,
|
4429
4626
|
Speak: AssistantActionBarSpeak,
|
4430
4627
|
StopSpeaking: AssistantActionBarStopSpeaking,
|
4431
|
-
SpeechControl: AssistantActionBarSpeechControl
|
4628
|
+
SpeechControl: AssistantActionBarSpeechControl,
|
4629
|
+
FeedbackPositive: AssistantActionBarFeedbackPositive,
|
4630
|
+
FeedbackNegative: AssistantActionBarFeedbackNegative
|
4432
4631
|
};
|
4433
4632
|
var assistant_action_bar_default = Object.assign(
|
4434
4633
|
AssistantActionBar,
|
@@ -4582,7 +4781,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
|
|
4582
4781
|
{
|
4583
4782
|
components: {
|
4584
4783
|
...componentsProp,
|
4585
|
-
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess',
|
4784
|
+
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _203 => _203.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
|
4586
4785
|
tools: toolsComponents
|
4587
4786
|
}
|
4588
4787
|
}
|
@@ -4725,7 +4924,7 @@ var ComposerAttachments = ({ components }) => {
|
|
4725
4924
|
{
|
4726
4925
|
components: {
|
4727
4926
|
...components,
|
4728
|
-
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4927
|
+
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _204 => _204.Attachment]), () => ( composer_attachment_default))
|
4729
4928
|
}
|
4730
4929
|
}
|
4731
4930
|
) });
|
@@ -4857,7 +5056,7 @@ var ThreadWelcomeSuggestion = ({
|
|
4857
5056
|
};
|
4858
5057
|
var ThreadWelcomeSuggestions = () => {
|
4859
5058
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
4860
|
-
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess',
|
5059
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestionContainer, { children: _optionalChain([suggestions, 'optionalAccess', _205 => _205.map, 'call', _206 => _206((suggestion, idx) => {
|
4861
5060
|
const key = `${suggestion.prompt}-${idx}`;
|
4862
5061
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
|
4863
5062
|
})]) });
|
@@ -4956,7 +5155,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
|
|
4956
5155
|
{
|
4957
5156
|
components: {
|
4958
5157
|
...components,
|
4959
|
-
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5158
|
+
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _207 => _207.Text]), () => ( content_part_default.Text))
|
4960
5159
|
}
|
4961
5160
|
}
|
4962
5161
|
) });
|
@@ -4974,7 +5173,7 @@ var UserMessageAttachments = ({
|
|
4974
5173
|
{
|
4975
5174
|
components: {
|
4976
5175
|
...components,
|
4977
|
-
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5176
|
+
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _208 => _208.Attachment]), () => ( user_message_attachment_default))
|
4978
5177
|
}
|
4979
5178
|
}
|
4980
5179
|
) }) });
|
@@ -5075,10 +5274,10 @@ var ThreadMessages = ({ components, ...rest }) => {
|
|
5075
5274
|
thread_exports.Messages,
|
5076
5275
|
{
|
5077
5276
|
components: {
|
5078
|
-
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5079
|
-
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5080
|
-
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5081
|
-
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5277
|
+
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _209 => _209.UserMessage]), () => ( user_message_default)),
|
5278
|
+
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _210 => _210.EditComposer]), () => ( edit_composer_default)),
|
5279
|
+
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _211 => _211.AssistantMessage]), () => ( assistant_message_default)),
|
5280
|
+
SystemMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _212 => _212.SystemMessage]), () => ( SystemMessage))
|
5082
5281
|
},
|
5083
5282
|
...rest
|
5084
5283
|
}
|
@@ -5296,5 +5495,7 @@ var assistant_modal_default = Object.assign(AssistantModal, exports13);
|
|
5296
5495
|
|
5297
5496
|
|
5298
5497
|
|
5299
|
-
|
5498
|
+
|
5499
|
+
|
5500
|
+
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.ComposerAttachment = composer_attachment_default; exports.ComposerPrimitive = composer_exports; exports.CompositeAttachmentAdapter = CompositeAttachmentAdapter; 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.SimpleImageAttachmentAdapter = SimpleImageAttachmentAdapter; exports.SimpleTextAttachmentAdapter = SimpleTextAttachmentAdapter; exports.TextContentPartProvider = TextContentPartProvider; 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.UserMessageAttachment = user_message_attachment_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 = _chunkJ2V7Y7JXjs.toCoreMessage; exports.toCoreMessages = _chunkJ2V7Y7JXjs.toCoreMessages; exports.toLanguageModelMessages = _chunkJ2V7Y7JXjs.toLanguageModelMessages; exports.toLanguageModelTools = _chunkJ2V7Y7JXjs.toLanguageModelTools; exports.useActionBarCopy = useActionBarCopy; exports.useActionBarEdit = useActionBarEdit; exports.useActionBarFeedbackNegative = useActionBarFeedbackNegative; exports.useActionBarFeedbackPositive = useActionBarFeedbackPositive; exports.useActionBarReload = useActionBarReload; exports.useActionBarSpeak = useActionBarSpeak; exports.useActionBarStopSpeaking = useActionBarStopSpeaking; exports.useAppendMessage = useAppendMessage; exports.useAssistantActions = useAssistantActions; exports.useAssistantActionsStore = useAssistantActionsStore; exports.useAssistantContext = useAssistantContext; exports.useAssistantInstructions = useAssistantInstructions; exports.useAssistantRuntime = useAssistantRuntime; exports.useAssistantRuntimeStore = useAssistantRuntimeStore; exports.useAssistantTool = useAssistantTool; exports.useAssistantToolUI = useAssistantToolUI; exports.useBranchPickerCount = useBranchPickerCount; exports.useBranchPickerNext = useBranchPickerNext; exports.useBranchPickerNumber = useBranchPickerNumber; exports.useBranchPickerPrevious = useBranchPickerPrevious; exports.useComposer = useComposer; exports.useComposerAddAttachment = useComposerAddAttachment; exports.useComposerCancel = useComposerCancel; exports.useComposerContext = useComposerContext; exports.useComposerIf = useComposerIf; exports.useComposerSend = useComposerSend; exports.useComposerStore = useComposerStore; exports.useContentPart = useContentPart; exports.useContentPartContext = useContentPartContext; exports.useContentPartDisplay = useContentPartDisplay; exports.useContentPartImage = useContentPartImage; exports.useContentPartStore = useContentPartStore; exports.useContentPartText = useContentPartText; exports.useDangerousInBrowserRuntime = useDangerousInBrowserRuntime; exports.useEdgeRuntime = useEdgeRuntime; exports.useEditComposer = useEditComposer; exports.useEditComposerStore = useEditComposerStore; exports.useExternalMessageConverter = useExternalMessageConverter; exports.useExternalStoreRuntime = useExternalStoreRuntime; exports.useLocalRuntime = useLocalRuntime; exports.useMessage = useMessage; exports.useMessageContext = useMessageContext; exports.useMessageIf = useMessageIf; exports.useMessageStore = useMessageStore; exports.useMessageUtils = useMessageUtils; exports.useMessageUtilsStore = useMessageUtilsStore; exports.useSwitchToNewThread = useSwitchToNewThread; exports.useThread = useThread; exports.useThreadActions = useThreadActions; exports.useThreadActionsStore = useThreadActionsStore; exports.useThreadComposer = useThreadComposer; exports.useThreadComposerStore = useThreadComposerStore; exports.useThreadConfig = useThreadConfig; exports.useThreadContext = useThreadContext; exports.useThreadEmpty = useThreadEmpty; exports.useThreadIf = useThreadIf; exports.useThreadMessages = useThreadMessages; exports.useThreadMessagesStore = useThreadMessagesStore; exports.useThreadRuntime = useThreadRuntime; exports.useThreadRuntimeStore = useThreadRuntimeStore; exports.useThreadScrollToBottom = useThreadScrollToBottom; exports.useThreadStore = useThreadStore; exports.useThreadSuggestion = useThreadSuggestion; exports.useThreadViewport = useThreadViewport; exports.useThreadViewportStore = useThreadViewportStore; exports.useToolUIs = useToolUIs; exports.useToolUIsStore = useToolUIsStore;
|
5300
5501
|
//# sourceMappingURL=index.js.map
|