@assistant-ui/react 0.5.58 → 0.5.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{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 +303 -99
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +498 -294
- 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);
|
@@ -774,7 +776,10 @@ var useSmooth = (state, smooth = false) => {
|
|
774
776
|
const {
|
775
777
|
part: { text }
|
776
778
|
} = state;
|
777
|
-
const id = useMessage(
|
779
|
+
const id = useMessage({
|
780
|
+
optional: true,
|
781
|
+
selector: (m) => m.message.id
|
782
|
+
});
|
778
783
|
const idRef = _react.useRef.call(void 0, id);
|
779
784
|
const [displayedText, setDisplayedText] = _react.useState.call(void 0, text);
|
780
785
|
const smoothStatusStore = useSmoothStatusStore({ optional: true });
|
@@ -1074,14 +1079,14 @@ function streamPartDecoderStream() {
|
|
1074
1079
|
controller.enqueue(decodeStreamPart(chunk));
|
1075
1080
|
}
|
1076
1081
|
});
|
1077
|
-
return new (0,
|
1082
|
+
return new (0, _chunkJ2V7Y7JXjs.PipeableTransformStream)((readable) => {
|
1078
1083
|
return readable.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(decodeStream);
|
1079
1084
|
});
|
1080
1085
|
}
|
1081
1086
|
|
1082
1087
|
// src/runtimes/edge/streams/utils/index.ts
|
1083
1088
|
var streamUtils = {
|
1084
|
-
streamPartEncoderStream:
|
1089
|
+
streamPartEncoderStream: _chunkJ2V7Y7JXjs.streamPartEncoderStream,
|
1085
1090
|
streamPartDecoderStream
|
1086
1091
|
};
|
1087
1092
|
|
@@ -1190,8 +1195,8 @@ var EdgeChatAdapter = class {
|
|
1190
1195
|
credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
|
1191
1196
|
body: JSON.stringify({
|
1192
1197
|
system: config.system,
|
1193
|
-
messages:
|
1194
|
-
tools: config.tools ?
|
1198
|
+
messages: _chunkJ2V7Y7JXjs.toCoreMessages.call(void 0, messages),
|
1199
|
+
tools: config.tools ? _chunkJ2V7Y7JXjs.toLanguageModelTools.call(void 0, config.tools) : [],
|
1195
1200
|
...config.callSettings,
|
1196
1201
|
...config.config,
|
1197
1202
|
...this.options.body
|
@@ -1201,7 +1206,7 @@ var EdgeChatAdapter = class {
|
|
1201
1206
|
if (result.status !== 200) {
|
1202
1207
|
throw new Error(`Status ${result.status}: ${await result.text()}`);
|
1203
1208
|
}
|
1204
|
-
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, ));
|
1205
1210
|
let update;
|
1206
1211
|
for await (update of asAsyncIterable(stream)) {
|
1207
1212
|
yield update;
|
@@ -1255,7 +1260,8 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1255
1260
|
cancel: true,
|
1256
1261
|
unstable_copy: true,
|
1257
1262
|
speak: false,
|
1258
|
-
attachments: false
|
1263
|
+
attachments: false,
|
1264
|
+
feedback: false
|
1259
1265
|
}}
|
1260
1266
|
|
1261
1267
|
__init18() {this.isDisabled = false}
|
@@ -1266,6 +1272,9 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1266
1272
|
this,
|
1267
1273
|
this.notifySubscribers.bind(this)
|
1268
1274
|
)}
|
1275
|
+
getModelConfig() {
|
1276
|
+
return this.configProvider.getModelConfig();
|
1277
|
+
}
|
1269
1278
|
|
1270
1279
|
get options() {
|
1271
1280
|
return this._options;
|
@@ -1284,6 +1293,11 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1284
1293
|
this.capabilities.attachments = canAttach;
|
1285
1294
|
hasUpdates = true;
|
1286
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
|
+
}
|
1287
1301
|
if (hasUpdates) this.notifySubscribers();
|
1288
1302
|
}
|
1289
1303
|
getBranches(messageId) {
|
@@ -1321,18 +1335,18 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1321
1335
|
}
|
1322
1336
|
async performRoundtrip(parentId, message) {
|
1323
1337
|
const messages = this.repository.getMessages();
|
1324
|
-
_optionalChain([this, 'access',
|
1338
|
+
_optionalChain([this, 'access', _43 => _43.abortController, 'optionalAccess', _44 => _44.abort, 'call', _45 => _45()]);
|
1325
1339
|
this.abortController = new AbortController();
|
1326
1340
|
const initialContent = message.content;
|
1327
|
-
const initialRoundtrips = _optionalChain([message, 'access',
|
1328
|
-
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]);
|
1329
1343
|
const updateMessage = (m) => {
|
1330
1344
|
message = {
|
1331
1345
|
...message,
|
1332
1346
|
...m.content ? { content: [...initialContent, ..._nullishCoalesce(m.content, () => ( []))] } : void 0,
|
1333
1347
|
status: _nullishCoalesce(m.status, () => ( message.status)),
|
1334
1348
|
// TODO deprecated, remove in v0.6
|
1335
|
-
..._optionalChain([m, 'access',
|
1349
|
+
..._optionalChain([m, 'access', _50 => _50.metadata, 'optionalAccess', _51 => _51.roundtrips]) ? {
|
1336
1350
|
roundtrips: [
|
1337
1351
|
..._nullishCoalesce(initialRoundtrips, () => ( [])),
|
1338
1352
|
...m.metadata.roundtrips
|
@@ -1347,7 +1361,7 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1347
1361
|
...m.metadata.roundtrips
|
1348
1362
|
]
|
1349
1363
|
} : void 0,
|
1350
|
-
..._optionalChain([m, 'access',
|
1364
|
+
..._optionalChain([m, 'access', _52 => _52.metadata, 'optionalAccess', _53 => _53.custom]) ? {
|
1351
1365
|
custom: { ..._nullishCoalesce(initalCustom, () => ( {})), ...m.metadata.custom }
|
1352
1366
|
} : void 0
|
1353
1367
|
}
|
@@ -1357,7 +1371,7 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1357
1371
|
this.notifySubscribers();
|
1358
1372
|
};
|
1359
1373
|
const maxToolRoundtrips = _nullishCoalesce(this.options.maxToolRoundtrips, () => ( 1));
|
1360
|
-
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));
|
1361
1375
|
if (toolRoundtrips > maxToolRoundtrips) {
|
1362
1376
|
updateMessage({
|
1363
1377
|
status: {
|
@@ -1456,7 +1470,7 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1456
1470
|
// TODO lift utterance state to thread runtime
|
1457
1471
|
|
1458
1472
|
speak(messageId) {
|
1459
|
-
const adapter = _optionalChain([this, 'access',
|
1473
|
+
const adapter = _optionalChain([this, 'access', _57 => _57.options, 'access', _58 => _58.adapters, 'optionalAccess', _59 => _59.speech]);
|
1460
1474
|
if (!adapter) throw new Error("Speech adapter not configured");
|
1461
1475
|
const { message } = this.repository.getMessage(messageId);
|
1462
1476
|
if (this._utterance) {
|
@@ -1472,6 +1486,12 @@ var LocalThreadRuntime = (_class6 = class {
|
|
1472
1486
|
this._utterance = utterance;
|
1473
1487
|
return this._utterance;
|
1474
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
|
+
}
|
1475
1495
|
export() {
|
1476
1496
|
return this.repository.export();
|
1477
1497
|
}
|
@@ -1520,7 +1540,7 @@ var LocalRuntime = class extends BaseAssistantRuntime {
|
|
1520
1540
|
const messages = fromCoreMessages(initialMessages);
|
1521
1541
|
this.thread.import({
|
1522
1542
|
messages: messages.map((m, idx) => ({
|
1523
|
-
parentId: _nullishCoalesce(_optionalChain([messages, 'access',
|
1543
|
+
parentId: _nullishCoalesce(_optionalChain([messages, 'access', _63 => _63[idx - 1], 'optionalAccess', _64 => _64.id]), () => ( null)),
|
1524
1544
|
message: m
|
1525
1545
|
}))
|
1526
1546
|
});
|
@@ -1649,9 +1669,13 @@ var getThreadMessageText = (message) => {
|
|
1649
1669
|
|
1650
1670
|
// src/runtimes/external-store/ExternalStoreThreadRuntime.tsx
|
1651
1671
|
var hasUpcomingMessage = (isRunning, messages) => {
|
1652
|
-
return isRunning && _optionalChain([messages, 'access',
|
1672
|
+
return isRunning && _optionalChain([messages, 'access', _65 => _65[messages.length - 1], 'optionalAccess', _66 => _66.role]) !== "assistant";
|
1653
1673
|
};
|
1654
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
|
+
}
|
1655
1679
|
__init21() {this._subscriptions = /* @__PURE__ */ new Set()}
|
1656
1680
|
__init22() {this.repository = new MessageRepository()}
|
1657
1681
|
__init23() {this.assistantOptimisticId = null}
|
@@ -1662,7 +1686,8 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1662
1686
|
cancel: false,
|
1663
1687
|
unstable_copy: false,
|
1664
1688
|
speak: false,
|
1665
|
-
attachments: false
|
1689
|
+
attachments: false,
|
1690
|
+
feedback: false
|
1666
1691
|
}}
|
1667
1692
|
get capabilities() {
|
1668
1693
|
return this._capabilities;
|
@@ -1676,9 +1701,6 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1676
1701
|
this,
|
1677
1702
|
this.notifySubscribers.bind(this)
|
1678
1703
|
)}
|
1679
|
-
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);
|
1680
|
-
this.store = store;
|
1681
|
-
}
|
1682
1704
|
get store() {
|
1683
1705
|
return this._store;
|
1684
1706
|
}
|
@@ -1695,11 +1717,12 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1695
1717
|
reload: this._store.onReload !== void 0,
|
1696
1718
|
cancel: this._store.onCancel !== void 0,
|
1697
1719
|
speak: this._store.onSpeak !== void 0,
|
1698
|
-
unstable_copy: _optionalChain([this, 'access',
|
1720
|
+
unstable_copy: _optionalChain([this, 'access', _70 => _70._store, 'access', _71 => _71.unstable_capabilities, 'optionalAccess', _72 => _72.copy]) !== false,
|
1699
1721
|
// default true
|
1700
|
-
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])
|
1701
1724
|
};
|
1702
|
-
this.composer.setAttachmentAdapter(_optionalChain([this, 'access',
|
1725
|
+
this.composer.setAttachmentAdapter(_optionalChain([this, 'access', _79 => _79._store, 'access', _80 => _80.adapters, 'optionalAccess', _81 => _81.attachments]));
|
1703
1726
|
if (oldStore) {
|
1704
1727
|
if (oldStore.convertMessage !== store.convertMessage) {
|
1705
1728
|
this.converter = new ThreadMessageConverter();
|
@@ -1725,7 +1748,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1725
1748
|
for (let i = 0; i < messages.length; i++) {
|
1726
1749
|
const message = messages[i];
|
1727
1750
|
const parent = messages[i - 1];
|
1728
|
-
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess',
|
1751
|
+
this.repository.addOrUpdateMessage(_nullishCoalesce(_optionalChain([parent, 'optionalAccess', _82 => _82.id]), () => ( null)), message);
|
1729
1752
|
}
|
1730
1753
|
if (this.assistantOptimisticId) {
|
1731
1754
|
this.repository.deleteMessage(this.assistantOptimisticId);
|
@@ -1733,7 +1756,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1733
1756
|
}
|
1734
1757
|
if (hasUpcomingMessage(isRunning, messages)) {
|
1735
1758
|
this.assistantOptimisticId = this.repository.appendOptimisticMessage(
|
1736
|
-
_nullishCoalesce(_optionalChain([messages, 'access',
|
1759
|
+
_nullishCoalesce(_optionalChain([messages, 'access', _83 => _83.at, 'call', _84 => _84(-1), 'optionalAccess', _85 => _85.id]), () => ( null)),
|
1737
1760
|
{
|
1738
1761
|
role: "assistant",
|
1739
1762
|
content: []
|
@@ -1741,11 +1764,14 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1741
1764
|
);
|
1742
1765
|
}
|
1743
1766
|
this.repository.resetHead(
|
1744
|
-
_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))
|
1745
1768
|
);
|
1746
1769
|
this.messages = this.repository.getMessages();
|
1747
1770
|
this.notifySubscribers();
|
1748
1771
|
}
|
1772
|
+
getModelConfig() {
|
1773
|
+
return this.configProvider.getModelConfig();
|
1774
|
+
}
|
1749
1775
|
notifySubscribers() {
|
1750
1776
|
for (const callback of this._subscriptions) callback();
|
1751
1777
|
}
|
@@ -1759,7 +1785,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1759
1785
|
this.updateMessages(this.repository.getMessages());
|
1760
1786
|
}
|
1761
1787
|
async append(message) {
|
1762
|
-
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)))) {
|
1763
1789
|
if (!this._store.onEdit)
|
1764
1790
|
throw new Error("Runtime does not support editing messages.");
|
1765
1791
|
await this._store.onEdit(message);
|
@@ -1782,7 +1808,7 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1782
1808
|
}
|
1783
1809
|
let messages = this.repository.getMessages();
|
1784
1810
|
const previousMessage = messages[messages.length - 1];
|
1785
|
-
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])) {
|
1786
1812
|
this.repository.deleteMessage(previousMessage.id);
|
1787
1813
|
if (!this.composer.text.trim()) {
|
1788
1814
|
this.composer.setText(getThreadMessageText(previousMessage));
|
@@ -1806,22 +1832,30 @@ var ExternalStoreThreadRuntime = (_class8 = class {
|
|
1806
1832
|
const { message } = this.repository.getMessage(messageId);
|
1807
1833
|
return this._store.onSpeak(message);
|
1808
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
|
+
}
|
1809
1841
|
subscribe(callback) {
|
1810
1842
|
this._subscriptions.add(callback);
|
1811
1843
|
return () => this._subscriptions.delete(callback);
|
1812
1844
|
}
|
1813
1845
|
__init27() {this.updateMessages = (messages) => {
|
1814
|
-
_optionalChain([this, 'access',
|
1846
|
+
_optionalChain([this, 'access', _100 => _100._store, 'access', _101 => _101.setMessages, 'optionalCall', _102 => _102(
|
1815
1847
|
messages.flatMap(getExternalStoreMessage).filter((m) => m != null)
|
1816
1848
|
)]);
|
1817
1849
|
}}
|
1818
1850
|
}, _class8);
|
1819
1851
|
|
1820
1852
|
// src/runtimes/external-store/ExternalStoreRuntime.tsx
|
1821
|
-
var ExternalStoreRuntime =
|
1822
|
-
|
1853
|
+
var ExternalStoreRuntime = class extends BaseAssistantRuntime {
|
1854
|
+
|
1823
1855
|
constructor(store) {
|
1824
|
-
|
1856
|
+
const provider = new ProxyConfigProvider();
|
1857
|
+
super(new ExternalStoreThreadRuntime(provider, store));
|
1858
|
+
this._proxyConfigProvider = provider;
|
1825
1859
|
}
|
1826
1860
|
get store() {
|
1827
1861
|
return this.thread.store;
|
@@ -1838,7 +1872,7 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1838
1872
|
async switchToNewThread() {
|
1839
1873
|
if (!this.store.onSwitchToNewThread)
|
1840
1874
|
throw new Error("Runtime does not support switching to new threads.");
|
1841
|
-
this.thread = new ExternalStoreThreadRuntime({
|
1875
|
+
this.thread = new ExternalStoreThreadRuntime(this._proxyConfigProvider, {
|
1842
1876
|
...this.store,
|
1843
1877
|
messages: []
|
1844
1878
|
});
|
@@ -1848,7 +1882,7 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1848
1882
|
if (threadId !== null) {
|
1849
1883
|
if (!this.store.onSwitchToThread)
|
1850
1884
|
throw new Error("Runtime does not support switching threads.");
|
1851
|
-
this.thread = new ExternalStoreThreadRuntime({
|
1885
|
+
this.thread = new ExternalStoreThreadRuntime(this._proxyConfigProvider, {
|
1852
1886
|
...this.store,
|
1853
1887
|
messages: []
|
1854
1888
|
// ignore messages until rerender
|
@@ -1858,7 +1892,7 @@ var ExternalStoreRuntime = (_class9 = class extends BaseAssistantRuntime {
|
|
1858
1892
|
this.switchToNewThread();
|
1859
1893
|
}
|
1860
1894
|
}
|
1861
|
-
}
|
1895
|
+
};
|
1862
1896
|
|
1863
1897
|
// src/runtimes/external-store/useExternalStoreRuntime.tsx
|
1864
1898
|
|
@@ -2026,18 +2060,18 @@ var DangerousInBrowserAdapter = class {
|
|
2026
2060
|
this.options = options;
|
2027
2061
|
}
|
2028
2062
|
async *run({ messages, abortSignal, config }) {
|
2029
|
-
const res = await
|
2063
|
+
const res = await _chunkJ2V7Y7JXjs.getEdgeRuntimeStream.call(void 0, {
|
2030
2064
|
options: this.options,
|
2031
2065
|
abortSignal,
|
2032
2066
|
requestData: {
|
2033
2067
|
system: config.system,
|
2034
|
-
messages:
|
2035
|
-
tools: config.tools ?
|
2068
|
+
messages: _chunkJ2V7Y7JXjs.toCoreMessages.call(void 0, messages),
|
2069
|
+
tools: config.tools ? _chunkJ2V7Y7JXjs.toLanguageModelTools.call(void 0, config.tools) : [],
|
2036
2070
|
...config.callSettings,
|
2037
2071
|
...config.config
|
2038
2072
|
}
|
2039
2073
|
});
|
2040
|
-
const stream = res.pipeThrough(
|
2074
|
+
const stream = res.pipeThrough(_chunkJ2V7Y7JXjs.toolResultStream.call(void 0, config.tools, abortSignal)).pipeThrough(_chunkJ2V7Y7JXjs.runResultStream.call(void 0, ));
|
2041
2075
|
for await (const update of asAsyncIterable(stream)) {
|
2042
2076
|
yield update;
|
2043
2077
|
}
|
@@ -2095,8 +2129,8 @@ var WebSpeechSynthesisAdapter = class {
|
|
2095
2129
|
};
|
2096
2130
|
|
2097
2131
|
// src/runtimes/attachment/SimpleImageAttachmentAdapter.ts
|
2098
|
-
var SimpleImageAttachmentAdapter = (
|
2099
|
-
|
2132
|
+
var SimpleImageAttachmentAdapter = (_class9 = class {constructor() { _class9.prototype.__init28.call(this); }
|
2133
|
+
__init28() {this.accept = "image/*"}
|
2100
2134
|
async add(state) {
|
2101
2135
|
return {
|
2102
2136
|
id: state.file.name,
|
@@ -2118,7 +2152,7 @@ var SimpleImageAttachmentAdapter = (_class10 = class {constructor() { _class10.p
|
|
2118
2152
|
}
|
2119
2153
|
async remove() {
|
2120
2154
|
}
|
2121
|
-
},
|
2155
|
+
}, _class9);
|
2122
2156
|
var getFileDataURL = (file) => new Promise((resolve, reject) => {
|
2123
2157
|
const reader = new FileReader();
|
2124
2158
|
reader.onload = () => resolve(reader.result);
|
@@ -2127,8 +2161,8 @@ var getFileDataURL = (file) => new Promise((resolve, reject) => {
|
|
2127
2161
|
});
|
2128
2162
|
|
2129
2163
|
// src/runtimes/attachment/SimpleTextAttachmentAdapter.ts
|
2130
|
-
var SimpleTextAttachmentAdapter = (
|
2131
|
-
|
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"}
|
2132
2166
|
async add(state) {
|
2133
2167
|
return {
|
2134
2168
|
id: state.file.name,
|
@@ -2152,7 +2186,7 @@ ${await getFileText(attachment.file)}
|
|
2152
2186
|
}
|
2153
2187
|
async remove() {
|
2154
2188
|
}
|
2155
|
-
},
|
2189
|
+
}, _class10);
|
2156
2190
|
var getFileText = (file) => new Promise((resolve, reject) => {
|
2157
2191
|
const reader = new FileReader();
|
2158
2192
|
reader.onload = () => resolve(reader.result);
|
@@ -2425,14 +2459,14 @@ var { useComposer, useComposerStore } = createContextStoreHook(
|
|
2425
2459
|
var toAppendMessage = (useThreadMessages2, message) => {
|
2426
2460
|
if (typeof message === "string") {
|
2427
2461
|
return {
|
2428
|
-
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)),
|
2429
2463
|
role: "user",
|
2430
2464
|
content: [{ type: "text", text: message }],
|
2431
2465
|
attachments: []
|
2432
2466
|
};
|
2433
2467
|
}
|
2434
2468
|
return {
|
2435
|
-
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)),
|
2436
2470
|
role: _nullishCoalesce(message.role, () => ( "user")),
|
2437
2471
|
content: message.content,
|
2438
2472
|
attachments: _nullishCoalesce(message.attachments, () => ( []))
|
@@ -2490,7 +2524,7 @@ var useAssistantTool = (tool) => {
|
|
2490
2524
|
const unsub2 = render ? toolUIsStore.getState().setToolUI(toolName, render) : void 0;
|
2491
2525
|
return () => {
|
2492
2526
|
unsub1();
|
2493
|
-
_optionalChain([unsub2, 'optionalCall',
|
2527
|
+
_optionalChain([unsub2, 'optionalCall', _113 => _113()]);
|
2494
2528
|
};
|
2495
2529
|
}, [assistantActionsStore, toolUIsStore, tool]);
|
2496
2530
|
};
|
@@ -2668,6 +2702,38 @@ var useActionBarStopSpeaking = () => {
|
|
2668
2702
|
return callback;
|
2669
2703
|
};
|
2670
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
|
+
|
2671
2737
|
// src/primitive-hooks/branchPicker/useBranchPickerCount.tsx
|
2672
2738
|
var useBranchPickerCount = () => {
|
2673
2739
|
const branchCount = useMessage((s) => s.branches.length);
|
@@ -2775,7 +2841,7 @@ var useComposerAddAttachment = () => {
|
|
2775
2841
|
input.accept = attachmentAccept;
|
2776
2842
|
}
|
2777
2843
|
input.onchange = (e) => {
|
2778
|
-
const file = _optionalChain([e, 'access',
|
2844
|
+
const file = _optionalChain([e, 'access', _114 => _114.target, 'access', _115 => _115.files, 'optionalAccess', _116 => _116[0]]);
|
2779
2845
|
if (!file) return;
|
2780
2846
|
addAttachment(file);
|
2781
2847
|
};
|
@@ -2827,7 +2893,7 @@ var useMessageIf = (props) => {
|
|
2827
2893
|
const messageUtilsStore = useMessageUtilsStore();
|
2828
2894
|
return useCombinedStore(
|
2829
2895
|
[messageStore, messageUtilsStore],
|
2830
|
-
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking }) => {
|
2896
|
+
({ message, branches, isLast }, { isCopied, isHovering, isSpeaking, submittedFeedback }) => {
|
2831
2897
|
if (props.hasBranches === true && branches.length < 2) return false;
|
2832
2898
|
if (props.user && message.role !== "user") return false;
|
2833
2899
|
if (props.assistant && message.role !== "assistant") return false;
|
@@ -2841,6 +2907,8 @@ var useMessageIf = (props) => {
|
|
2841
2907
|
return false;
|
2842
2908
|
if (props.hasAttachments === false && message.role === "user" && !!message.attachments.length)
|
2843
2909
|
return false;
|
2910
|
+
if (props.submittedFeedback !== void 0 && submittedFeedback !== props.submittedFeedback)
|
2911
|
+
return false;
|
2844
2912
|
return true;
|
2845
2913
|
}
|
2846
2914
|
);
|
@@ -2912,6 +2980,8 @@ var actionBar_exports = {};
|
|
2912
2980
|
_chunkDCHYNTHIjs.__export.call(void 0, actionBar_exports, {
|
2913
2981
|
Copy: () => ActionBarPrimitiveCopy,
|
2914
2982
|
Edit: () => ActionBarPrimitiveEdit,
|
2983
|
+
FeedbackNegative: () => ActionBarPrimitiveFeedbackNegative,
|
2984
|
+
FeedbackPositive: () => ActionBarPrimitiveFeedbackPositive,
|
2915
2985
|
Reload: () => ActionBarPrimitiveReload,
|
2916
2986
|
Root: () => ActionBarPrimitiveRoot,
|
2917
2987
|
Speak: () => ActionBarPrimitiveSpeak,
|
@@ -2965,10 +3035,34 @@ var ActionBarPrimitiveRoot = _react.forwardRef.call(void 0, ({ hideWhenRunning,
|
|
2965
3035
|
});
|
2966
3036
|
ActionBarPrimitiveRoot.displayName = "ActionBarPrimitive.Root";
|
2967
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
|
+
|
2968
3062
|
// src/utils/createActionButton.tsx
|
2969
3063
|
|
2970
3064
|
|
2971
|
-
|
3065
|
+
|
2972
3066
|
|
2973
3067
|
var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
2974
3068
|
const ActionButton = _react.forwardRef.call(void 0, (props, forwardedRef) => {
|
@@ -2990,7 +3084,7 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2990
3084
|
ref: forwardedRef,
|
2991
3085
|
disabled: primitiveProps.disabled || !callback,
|
2992
3086
|
onClick: _primitive.composeEventHandlers.call(void 0, primitiveProps.onClick, () => {
|
2993
|
-
_optionalChain([callback, 'optionalCall',
|
3087
|
+
_optionalChain([callback, 'optionalCall', _118 => _118()]);
|
2994
3088
|
})
|
2995
3089
|
}
|
2996
3090
|
);
|
@@ -2999,13 +3093,6 @@ var createActionButton = (displayName, useActionButton, forwardProps = []) => {
|
|
2999
3093
|
return ActionButton;
|
3000
3094
|
};
|
3001
3095
|
|
3002
|
-
// src/primitives/actionBar/ActionBarCopy.tsx
|
3003
|
-
var ActionBarPrimitiveCopy = createActionButton(
|
3004
|
-
"ActionBarPrimitive.Copy",
|
3005
|
-
useActionBarCopy,
|
3006
|
-
["copiedDuration"]
|
3007
|
-
);
|
3008
|
-
|
3009
3096
|
// src/primitives/actionBar/ActionBarReload.tsx
|
3010
3097
|
var ActionBarPrimitiveReload = createActionButton(
|
3011
3098
|
"ActionBarPrimitive.Reload",
|
@@ -3046,13 +3133,65 @@ var ActionBarPrimitiveStopSpeaking = _react.forwardRef.call(void 0, (props, ref)
|
|
3046
3133
|
...props,
|
3047
3134
|
ref,
|
3048
3135
|
onClick: _primitive.composeEventHandlers.call(void 0, props.onClick, () => {
|
3049
|
-
_optionalChain([callback, 'optionalCall',
|
3136
|
+
_optionalChain([callback, 'optionalCall', _119 => _119()]);
|
3050
3137
|
})
|
3051
3138
|
}
|
3052
3139
|
);
|
3053
3140
|
});
|
3054
3141
|
ActionBarPrimitiveStopSpeaking.displayName = "ActionBarPrimitive.StopSpeaking";
|
3055
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
|
+
|
3056
3195
|
// src/primitives/assistantModal/index.ts
|
3057
3196
|
var assistantModal_exports = {};
|
3058
3197
|
_chunkDCHYNTHIjs.__export.call(void 0, assistantModal_exports, {
|
@@ -3281,9 +3420,9 @@ var useIsHoveringRef = () => {
|
|
3281
3420
|
);
|
3282
3421
|
return useManagedRef(callbackRef);
|
3283
3422
|
};
|
3284
|
-
var MessagePrimitiveRoot = _react.forwardRef.call(void 0, (props,
|
3423
|
+
var MessagePrimitiveRoot = _react.forwardRef.call(void 0, (props, forwardRef33) => {
|
3285
3424
|
const isHoveringRef = useIsHoveringRef();
|
3286
|
-
const ref = _reactcomposerefs.useComposedRefs.call(void 0,
|
3425
|
+
const ref = _reactcomposerefs.useComposedRefs.call(void 0, forwardRef33, isHoveringRef);
|
3287
3426
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _reactprimitive.Primitive.div, { ...props, ref });
|
3288
3427
|
});
|
3289
3428
|
MessagePrimitiveRoot.displayName = "MessagePrimitive.Root";
|
@@ -3336,7 +3475,7 @@ var getContentPartState = ({ message }, useContentPart2, partIndex) => {
|
|
3336
3475
|
part = EMPTY_CONTENT;
|
3337
3476
|
}
|
3338
3477
|
const status = toContentPartStatus(message, partIndex, part);
|
3339
|
-
const currentState = _optionalChain([useContentPart2, 'optionalAccess',
|
3478
|
+
const currentState = _optionalChain([useContentPart2, 'optionalAccess', _122 => _122.getState, 'call', _123 => _123()]);
|
3340
3479
|
if (currentState && currentState.part === part && currentState.status === status)
|
3341
3480
|
return null;
|
3342
3481
|
return Object.freeze({ part, status });
|
@@ -3492,7 +3631,7 @@ var MessageContentPartImpl = ({
|
|
3492
3631
|
};
|
3493
3632
|
var MessageContentPart = _react.memo.call(void 0,
|
3494
3633
|
MessageContentPartImpl,
|
3495
|
-
(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])
|
3496
3635
|
);
|
3497
3636
|
var MessagePrimitiveContent = ({
|
3498
3637
|
components
|
@@ -3518,7 +3657,7 @@ var AttachmentContext = _react.createContext.call(void 0,
|
|
3518
3657
|
);
|
3519
3658
|
function useAttachmentContext(options) {
|
3520
3659
|
const context = _react.useContext.call(void 0, AttachmentContext);
|
3521
|
-
if (!_optionalChain([options, 'optionalAccess',
|
3660
|
+
if (!_optionalChain([options, 'optionalAccess', _140 => _140.optional]) && !context)
|
3522
3661
|
throw new Error(
|
3523
3662
|
"This component must be used within a ComposerPrimitive.Attachments or MessagePrimitive.Attachments component."
|
3524
3663
|
);
|
@@ -3564,7 +3703,7 @@ var getAttachment = ({ message }, useAttachment2, partIndex) => {
|
|
3564
3703
|
const attachments = message.attachments;
|
3565
3704
|
const attachment = attachments[partIndex];
|
3566
3705
|
if (!attachment) return null;
|
3567
|
-
const currentState = _optionalChain([useAttachment2, 'optionalAccess',
|
3706
|
+
const currentState = _optionalChain([useAttachment2, 'optionalAccess', _141 => _141.getState, 'call', _142 => _142()]);
|
3568
3707
|
if (currentState && currentState.attachment === attachment) return null;
|
3569
3708
|
return Object.freeze({ attachment });
|
3570
3709
|
};
|
@@ -3607,11 +3746,11 @@ var getComponent = (components, attachment) => {
|
|
3607
3746
|
const type = attachment.type;
|
3608
3747
|
switch (type) {
|
3609
3748
|
case "image":
|
3610
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3749
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _143 => _143.Image]), () => ( _optionalChain([components, 'optionalAccess', _144 => _144.Attachment])));
|
3611
3750
|
case "document":
|
3612
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3751
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _145 => _145.Document]), () => ( _optionalChain([components, 'optionalAccess', _146 => _146.Attachment])));
|
3613
3752
|
case "file":
|
3614
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3753
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _147 => _147.File]), () => ( _optionalChain([components, 'optionalAccess', _148 => _148.Attachment])));
|
3615
3754
|
default:
|
3616
3755
|
const _exhaustiveCheck = type;
|
3617
3756
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
@@ -3629,7 +3768,7 @@ var MessageAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
3629
3768
|
};
|
3630
3769
|
var MessageAttachment = _react.memo.call(void 0,
|
3631
3770
|
MessageAttachmentImpl,
|
3632
|
-
(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])
|
3633
3772
|
);
|
3634
3773
|
var MessagePrimitiveAttachments = ({ components }) => {
|
3635
3774
|
const attachmentsCount = useMessage(({ message }) => {
|
@@ -3737,7 +3876,7 @@ var ComposerPrimitiveInput = _react.forwardRef.call(void 0,
|
|
3737
3876
|
const { isRunning } = threadStore.getState();
|
3738
3877
|
if (!isRunning) {
|
3739
3878
|
e.preventDefault();
|
3740
|
-
_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()]);
|
3741
3880
|
}
|
3742
3881
|
}
|
3743
3882
|
};
|
@@ -3805,7 +3944,7 @@ var ComposerPrimitiveAddAttachment = createActionButton(
|
|
3805
3944
|
var getAttachment2 = ({ attachments }, useAttachment2, partIndex) => {
|
3806
3945
|
const attachment = attachments[partIndex];
|
3807
3946
|
if (!attachment) return null;
|
3808
|
-
const currentState = _optionalChain([useAttachment2, 'optionalAccess',
|
3947
|
+
const currentState = _optionalChain([useAttachment2, 'optionalAccess', _170 => _170.getState, 'call', _171 => _171()]);
|
3809
3948
|
if (currentState && currentState.attachment === attachment) return null;
|
3810
3949
|
return Object.freeze({ attachment });
|
3811
3950
|
};
|
@@ -3845,11 +3984,11 @@ var getComponent2 = (components, attachment) => {
|
|
3845
3984
|
const type = attachment.type;
|
3846
3985
|
switch (type) {
|
3847
3986
|
case "image":
|
3848
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3987
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _172 => _172.Image]), () => ( _optionalChain([components, 'optionalAccess', _173 => _173.Attachment])));
|
3849
3988
|
case "document":
|
3850
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3989
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _174 => _174.Document]), () => ( _optionalChain([components, 'optionalAccess', _175 => _175.Attachment])));
|
3851
3990
|
case "file":
|
3852
|
-
return _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
3991
|
+
return _nullishCoalesce(_optionalChain([components, 'optionalAccess', _176 => _176.File]), () => ( _optionalChain([components, 'optionalAccess', _177 => _177.Attachment])));
|
3853
3992
|
default:
|
3854
3993
|
const _exhaustiveCheck = type;
|
3855
3994
|
throw new Error(`Unknown attachment type: ${_exhaustiveCheck}`);
|
@@ -3867,7 +4006,7 @@ var ComposerAttachmentImpl = ({ components, attachmentIndex }) => {
|
|
3867
4006
|
};
|
3868
4007
|
var ComposerAttachment = _react.memo.call(void 0,
|
3869
4008
|
ComposerAttachmentImpl,
|
3870
|
-
(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])
|
3871
4010
|
);
|
3872
4011
|
var ComposerPrimitiveAttachments = ({ components }) => {
|
3873
4012
|
const attachmentsCount = useThreadComposer((s) => s.attachments.length);
|
@@ -4126,7 +4265,7 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
4126
4265
|
},
|
4127
4266
|
isSpeaking: false,
|
4128
4267
|
stopSpeaking: () => {
|
4129
|
-
_optionalChain([utterance, 'optionalAccess',
|
4268
|
+
_optionalChain([utterance, 'optionalAccess', _194 => _194.cancel, 'call', _195 => _195()]);
|
4130
4269
|
},
|
4131
4270
|
addUtterance: (utt) => {
|
4132
4271
|
utterance = utt;
|
@@ -4134,6 +4273,10 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
4134
4273
|
utt.onEnd(() => {
|
4135
4274
|
set({ isSpeaking: false });
|
4136
4275
|
});
|
4276
|
+
},
|
4277
|
+
submittedFeedback: null,
|
4278
|
+
setSubmittedFeedback: (feedback) => {
|
4279
|
+
set({ submittedFeedback: feedback });
|
4137
4280
|
}
|
4138
4281
|
};
|
4139
4282
|
});
|
@@ -4141,15 +4284,15 @@ var makeMessageUtilsStore = () => _zustand.create.call(void 0, (set) => {
|
|
4141
4284
|
// src/context/providers/MessageProvider.tsx
|
4142
4285
|
|
4143
4286
|
var getIsLast = (messages, message) => {
|
4144
|
-
return _optionalChain([messages, 'access',
|
4287
|
+
return _optionalChain([messages, 'access', _196 => _196[messages.length - 1], 'optionalAccess', _197 => _197.id]) === message.id;
|
4145
4288
|
};
|
4146
4289
|
var getMessageState = (messages, getBranches, useMessage2, messageIndex) => {
|
4147
|
-
const parentId = _nullishCoalesce(_optionalChain([messages, 'access',
|
4290
|
+
const parentId = _nullishCoalesce(_optionalChain([messages, 'access', _198 => _198[messageIndex - 1], 'optionalAccess', _199 => _199.id]), () => ( null));
|
4148
4291
|
const message = messages[messageIndex];
|
4149
4292
|
if (!message) return null;
|
4150
4293
|
const isLast = getIsLast(messages, message);
|
4151
4294
|
const branches = getBranches(message.id);
|
4152
|
-
const currentState = _optionalChain([useMessage2, 'optionalAccess',
|
4295
|
+
const currentState = _optionalChain([useMessage2, 'optionalAccess', _200 => _200.getState, 'call', _201 => _201()]);
|
4153
4296
|
if (currentState && currentState.message === message && currentState.parentId === parentId && currentState.branches === branches && currentState.isLast === isLast)
|
4154
4297
|
return null;
|
4155
4298
|
return Object.freeze({
|
@@ -4310,7 +4453,7 @@ var ThreadConfigProvider = ({
|
|
4310
4453
|
}) => {
|
4311
4454
|
const hasAssistant = !!useAssistantRuntimeStore({ optional: true });
|
4312
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 });
|
4313
|
-
if (!_optionalChain([config, 'optionalAccess',
|
4456
|
+
if (!_optionalChain([config, 'optionalAccess', _202 => _202.runtime])) return configProvider;
|
4314
4457
|
if (hasAssistant) {
|
4315
4458
|
throw new Error(
|
4316
4459
|
"You provided a runtime to <Thread> while simulataneously using <AssistantRuntimeProvider>. This is not allowed."
|
@@ -4328,6 +4471,8 @@ ThreadConfigProvider.displayName = "ThreadConfigProvider";
|
|
4328
4471
|
|
4329
4472
|
|
4330
4473
|
|
4474
|
+
|
4475
|
+
|
4331
4476
|
var _lucidereact = require('lucide-react');
|
4332
4477
|
|
4333
4478
|
var useAllowCopy = (ensureCapability = false) => {
|
@@ -4345,11 +4490,24 @@ var useAllowReload = (ensureCapability = false) => {
|
|
4345
4490
|
const reloadSupported = useThread((t) => t.capabilities.reload);
|
4346
4491
|
return allowReload && (!ensureCapability || reloadSupported);
|
4347
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
|
+
};
|
4348
4503
|
var AssistantActionBar = () => {
|
4349
4504
|
const allowCopy = useAllowCopy(true);
|
4350
4505
|
const allowReload = useAllowReload(true);
|
4351
4506
|
const allowSpeak = useAllowSpeak(true);
|
4352
|
-
|
4507
|
+
const allowFeedbackPositive = useAllowFeedbackPositive(true);
|
4508
|
+
const allowFeedbackNegative = useAllowFeedbackNegative(true);
|
4509
|
+
if (!allowCopy && !allowReload && !allowSpeak && !allowFeedbackPositive && !allowFeedbackNegative)
|
4510
|
+
return null;
|
4353
4511
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
4354
4512
|
AssistantActionBarRoot,
|
4355
4513
|
{
|
@@ -4359,7 +4517,9 @@ var AssistantActionBar = () => {
|
|
4359
4517
|
children: [
|
4360
4518
|
allowSpeak && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarSpeechControl, {}),
|
4361
4519
|
allowCopy && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, AssistantActionBarCopy, {}),
|
4362
|
-
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, {})
|
4363
4523
|
]
|
4364
4524
|
}
|
4365
4525
|
);
|
@@ -4416,16 +4576,58 @@ var AssistantActionBarReload = _react.forwardRef.call(void 0, (props, ref) => {
|
|
4416
4576
|
} = {}
|
4417
4577
|
} = useThreadConfig();
|
4418
4578
|
const allowReload = useAllowReload();
|
4419
|
-
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, {}))) }) });
|
4420
4580
|
});
|
4421
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";
|
4422
4622
|
var exports = {
|
4423
4623
|
Root: AssistantActionBarRoot,
|
4424
4624
|
Reload: AssistantActionBarReload,
|
4425
4625
|
Copy: AssistantActionBarCopy,
|
4426
4626
|
Speak: AssistantActionBarSpeak,
|
4427
4627
|
StopSpeaking: AssistantActionBarStopSpeaking,
|
4428
|
-
SpeechControl: AssistantActionBarSpeechControl
|
4628
|
+
SpeechControl: AssistantActionBarSpeechControl,
|
4629
|
+
FeedbackPositive: AssistantActionBarFeedbackPositive,
|
4630
|
+
FeedbackNegative: AssistantActionBarFeedbackNegative
|
4429
4631
|
};
|
4430
4632
|
var assistant_action_bar_default = Object.assign(
|
4431
4633
|
AssistantActionBar,
|
@@ -4579,7 +4781,7 @@ var AssistantMessageContent = _react.forwardRef.call(void 0, ({ components: comp
|
|
4579
4781
|
{
|
4580
4782
|
components: {
|
4581
4783
|
...componentsProp,
|
4582
|
-
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess',
|
4784
|
+
Text: _nullishCoalesce(_nullishCoalesce(_optionalChain([componentsProp, 'optionalAccess', _203 => _203.Text]), () => ( components.Text)), () => ( content_part_default.Text)),
|
4583
4785
|
tools: toolsComponents
|
4584
4786
|
}
|
4585
4787
|
}
|
@@ -4722,7 +4924,7 @@ var ComposerAttachments = ({ components }) => {
|
|
4722
4924
|
{
|
4723
4925
|
components: {
|
4724
4926
|
...components,
|
4725
|
-
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
4927
|
+
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _204 => _204.Attachment]), () => ( composer_attachment_default))
|
4726
4928
|
}
|
4727
4929
|
}
|
4728
4930
|
) });
|
@@ -4854,7 +5056,7 @@ var ThreadWelcomeSuggestion = ({
|
|
4854
5056
|
};
|
4855
5057
|
var ThreadWelcomeSuggestions = () => {
|
4856
5058
|
const { welcome: { suggestions } = {} } = useThreadConfig();
|
4857
|
-
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) => {
|
4858
5060
|
const key = `${suggestion.prompt}-${idx}`;
|
4859
5061
|
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ThreadWelcomeSuggestion, { suggestion }, key);
|
4860
5062
|
})]) });
|
@@ -4953,7 +5155,7 @@ var UserMessageContent = _react.forwardRef.call(void 0,
|
|
4953
5155
|
{
|
4954
5156
|
components: {
|
4955
5157
|
...components,
|
4956
|
-
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5158
|
+
Text: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _207 => _207.Text]), () => ( content_part_default.Text))
|
4957
5159
|
}
|
4958
5160
|
}
|
4959
5161
|
) });
|
@@ -4971,7 +5173,7 @@ var UserMessageAttachments = ({
|
|
4971
5173
|
{
|
4972
5174
|
components: {
|
4973
5175
|
...components,
|
4974
|
-
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5176
|
+
Attachment: _nullishCoalesce(_optionalChain([components, 'optionalAccess', _208 => _208.Attachment]), () => ( user_message_attachment_default))
|
4975
5177
|
}
|
4976
5178
|
}
|
4977
5179
|
) }) });
|
@@ -5072,10 +5274,10 @@ var ThreadMessages = ({ components, ...rest }) => {
|
|
5072
5274
|
thread_exports.Messages,
|
5073
5275
|
{
|
5074
5276
|
components: {
|
5075
|
-
UserMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5076
|
-
EditComposer: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5077
|
-
AssistantMessage: _nullishCoalesce(_optionalChain([components, 'optionalAccess',
|
5078
|
-
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))
|
5079
5281
|
},
|
5080
5282
|
...rest
|
5081
5283
|
}
|
@@ -5293,5 +5495,7 @@ var assistant_modal_default = Object.assign(AssistantModal, exports13);
|
|
5293
5495
|
|
5294
5496
|
|
5295
5497
|
|
5296
|
-
|
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;
|
5297
5501
|
//# sourceMappingURL=index.js.map
|