@assistant-ui/react 0.0.25 → 0.0.26

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.mjs CHANGED
@@ -1787,15 +1787,17 @@ var LocalRuntime = class {
1787
1787
  this.abortController = new AbortController();
1788
1788
  this.notifySubscribers();
1789
1789
  try {
1790
- await this.adapter.run({
1790
+ const updateHandler = ({ content }) => {
1791
+ message.content = content;
1792
+ this.repository.addOrUpdateMessage(parentId, { ...message });
1793
+ this.notifySubscribers();
1794
+ };
1795
+ const result = await this.adapter.run({
1791
1796
  messages,
1792
1797
  abortSignal: this.abortController.signal,
1793
- onUpdate: ({ content }) => {
1794
- message.content = content;
1795
- this.repository.addOrUpdateMessage(parentId, { ...message });
1796
- this.notifySubscribers();
1797
- }
1798
+ onUpdate: updateHandler
1798
1799
  });
1800
+ updateHandler(result);
1799
1801
  message.status = "done";
1800
1802
  this.repository.addOrUpdateMessage(parentId, { ...message });
1801
1803
  } catch (e) {