@assistant-ui/react 0.5.16 → 0.5.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +6 -3
- package/dist/index.d.ts +6 -3
- package/dist/index.js +25 -18
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -18
- package/dist/index.mjs.map +1 -1
- package/dist/styles/index.css.map +1 -1
- package/dist/styles/modal.css.map +1 -1
- package/package.json +6 -6
package/dist/index.mjs
CHANGED
@@ -3345,7 +3345,7 @@ var EdgeChatAdapter = class {
|
|
3345
3345
|
constructor(options) {
|
3346
3346
|
this.options = options;
|
3347
3347
|
}
|
3348
|
-
async run({ messages, abortSignal, config
|
3348
|
+
async *run({ messages, abortSignal, config }) {
|
3349
3349
|
const result = await fetch(this.options.api, {
|
3350
3350
|
method: "POST",
|
3351
3351
|
headers: {
|
@@ -3366,11 +3366,10 @@ var EdgeChatAdapter = class {
|
|
3366
3366
|
const stream = result.body.pipeThrough(new TextDecoderStream()).pipeThrough(chunkByLineStream()).pipeThrough(assistantDecoderStream()).pipeThrough(toolResultStream(config.tools)).pipeThrough(runResultStream());
|
3367
3367
|
let update;
|
3368
3368
|
for await (update of asAsyncIterable(stream)) {
|
3369
|
-
|
3369
|
+
yield update;
|
3370
3370
|
}
|
3371
3371
|
if (update === void 0)
|
3372
3372
|
throw new Error("No data received from Edge Runtime");
|
3373
|
-
return update;
|
3374
3373
|
}
|
3375
3374
|
};
|
3376
3375
|
|
@@ -3489,21 +3488,27 @@ var LocalThreadRuntime = class {
|
|
3489
3488
|
});
|
3490
3489
|
}
|
3491
3490
|
try {
|
3492
|
-
const
|
3491
|
+
const promiseOrGenerator = this.adapter.run({
|
3493
3492
|
messages,
|
3494
3493
|
abortSignal: this.abortController.signal,
|
3495
3494
|
config: this.configProvider.getModelConfig(),
|
3496
3495
|
onUpdate: updateMessage
|
3497
3496
|
});
|
3498
|
-
if (
|
3499
|
-
|
3500
|
-
|
3501
|
-
|
3497
|
+
if (Symbol.asyncIterator in promiseOrGenerator) {
|
3498
|
+
for await (const r of promiseOrGenerator) {
|
3499
|
+
updateMessage(r);
|
3500
|
+
}
|
3501
|
+
} else {
|
3502
|
+
updateMessage(await promiseOrGenerator);
|
3503
|
+
}
|
3502
3504
|
this.abortController = null;
|
3503
|
-
|
3504
|
-
|
3505
|
-
|
3506
|
-
|
3505
|
+
if (message.status.type === "running") {
|
3506
|
+
updateMessage({
|
3507
|
+
status: { type: "complete", reason: "unknown" }
|
3508
|
+
});
|
3509
|
+
} else {
|
3510
|
+
this.notifySubscribers();
|
3511
|
+
}
|
3507
3512
|
} catch (e) {
|
3508
3513
|
this.abortController = null;
|
3509
3514
|
if (e instanceof Error && e.name === "AbortError") {
|
@@ -3744,9 +3749,11 @@ var hasUpcomingMessage = (isRunning, messages) => {
|
|
3744
3749
|
var ExternalStoreThreadRuntime = class {
|
3745
3750
|
constructor(store) {
|
3746
3751
|
this.store = store;
|
3747
|
-
this.
|
3748
|
-
|
3749
|
-
|
3752
|
+
this.updateData(
|
3753
|
+
store.isDisabled ?? false,
|
3754
|
+
store.isRunning ?? false,
|
3755
|
+
store.messages
|
3756
|
+
);
|
3750
3757
|
this.useStore = create14(() => ({
|
3751
3758
|
store
|
3752
3759
|
}));
|
@@ -3764,9 +3771,9 @@ var ExternalStoreThreadRuntime = class {
|
|
3764
3771
|
copy: this.store.onCopy !== null
|
3765
3772
|
};
|
3766
3773
|
}
|
3767
|
-
messages;
|
3768
|
-
isDisabled;
|
3769
|
-
isRunning;
|
3774
|
+
messages = [];
|
3775
|
+
isDisabled = false;
|
3776
|
+
isRunning = false;
|
3770
3777
|
getBranches(messageId) {
|
3771
3778
|
return this.repository.getBranches(messageId);
|
3772
3779
|
}
|