@assistant-ui/react 0.5.16 → 0.5.17
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/index.d.mts +5 -2
- package/dist/index.d.ts +5 -2
- package/dist/index.js +17 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +17 -12
- 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") {
|