ai 5.0.0-beta.4 → 5.0.0-beta.5

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.mjs CHANGED
@@ -766,14 +766,13 @@ async function convertFileListToFileUIParts(files) {
766
766
  import { parseJsonEventStream as parseJsonEventStream2 } from "@ai-sdk/provider-utils";
767
767
 
768
768
  // src/ui/http-chat-transport.ts
769
- var getOriginalFetch2 = () => fetch;
770
769
  var HttpChatTransport = class {
771
770
  constructor({
772
771
  api = "/api/chat",
773
772
  credentials,
774
773
  headers,
775
774
  body,
776
- fetch: fetch2 = getOriginalFetch2(),
775
+ fetch: fetch2,
777
776
  prepareSendMessagesRequest,
778
777
  prepareReconnectToStreamRequest
779
778
  }) {
@@ -789,7 +788,7 @@ var HttpChatTransport = class {
789
788
  abortSignal,
790
789
  ...options
791
790
  }) {
792
- var _a16, _b, _c, _d;
791
+ var _a16, _b, _c, _d, _e;
793
792
  const preparedRequest = await ((_a16 = this.prepareSendMessagesRequest) == null ? void 0 : _a16.call(this, {
794
793
  api: this.api,
795
794
  id: options.chatId,
@@ -812,7 +811,8 @@ var HttpChatTransport = class {
812
811
  messageId: options.messageId
813
812
  };
814
813
  const credentials = (_c = preparedRequest == null ? void 0 : preparedRequest.credentials) != null ? _c : this.credentials;
815
- const response = await this.fetch.call(void 0, api, {
814
+ const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
815
+ const response = await fetch2(api, {
816
816
  method: "POST",
817
817
  headers: {
818
818
  "Content-Type": "application/json",
@@ -824,7 +824,7 @@ var HttpChatTransport = class {
824
824
  });
825
825
  if (!response.ok) {
826
826
  throw new Error(
827
- (_d = await response.text()) != null ? _d : "Failed to fetch the chat response."
827
+ (_e = await response.text()) != null ? _e : "Failed to fetch the chat response."
828
828
  );
829
829
  }
830
830
  if (!response.body) {
@@ -833,7 +833,7 @@ var HttpChatTransport = class {
833
833
  return this.processResponseStream(response.body);
834
834
  }
835
835
  async reconnectToStream(options) {
836
- var _a16, _b, _c, _d;
836
+ var _a16, _b, _c, _d, _e;
837
837
  const preparedRequest = await ((_a16 = this.prepareReconnectToStreamRequest) == null ? void 0 : _a16.call(this, {
838
838
  api: this.api,
839
839
  id: options.chatId,
@@ -845,7 +845,8 @@ var HttpChatTransport = class {
845
845
  const api = (_b = preparedRequest == null ? void 0 : preparedRequest.api) != null ? _b : `${this.api}/${options.chatId}/stream`;
846
846
  const headers = (preparedRequest == null ? void 0 : preparedRequest.headers) !== void 0 ? preparedRequest.headers : { ...this.headers, ...options.headers };
847
847
  const credentials = (_c = preparedRequest == null ? void 0 : preparedRequest.credentials) != null ? _c : this.credentials;
848
- const response = await this.fetch.call(void 0, api, {
848
+ const fetch2 = (_d = this.fetch) != null ? _d : globalThis.fetch;
849
+ const response = await fetch2(api, {
849
850
  method: "GET",
850
851
  headers,
851
852
  credentials
@@ -855,7 +856,7 @@ var HttpChatTransport = class {
855
856
  }
856
857
  if (!response.ok) {
857
858
  throw new Error(
858
- (_d = await response.text()) != null ? _d : "Failed to fetch the chat response."
859
+ (_e = await response.text()) != null ? _e : "Failed to fetch the chat response."
859
860
  );
860
861
  }
861
862
  if (!response.body) {