@assistant-ui/react 0.5.32 → 0.5.33

Sign up to get free protection for your applications and to get access to all the features.
package/dist/index.d.mts CHANGED
@@ -200,6 +200,9 @@ declare const streamUtils: {
200
200
 
201
201
  type EdgeChatAdapterOptions = {
202
202
  api: string;
203
+ credentials?: RequestCredentials;
204
+ headers?: Record<string, string> | Headers;
205
+ body?: object;
203
206
  };
204
207
  declare class EdgeChatAdapter implements ChatModelAdapter {
205
208
  private options;
package/dist/index.d.ts CHANGED
@@ -200,6 +200,9 @@ declare const streamUtils: {
200
200
 
201
201
  type EdgeChatAdapterOptions = {
202
202
  api: string;
203
+ credentials?: RequestCredentials;
204
+ headers?: Record<string, string> | Headers;
205
+ body?: object;
203
206
  };
204
207
  declare class EdgeChatAdapter implements ChatModelAdapter {
205
208
  private options;
package/dist/index.js CHANGED
@@ -1023,17 +1023,19 @@ var EdgeChatAdapter = class {
1023
1023
  this.options = options;
1024
1024
  }
1025
1025
  async *run({ messages, abortSignal, config }) {
1026
+ const headers = new Headers(this.options.headers);
1027
+ headers.set("Content-Type", "application/json");
1026
1028
  const result = await fetch(this.options.api, {
1027
1029
  method: "POST",
1028
- headers: {
1029
- "Content-Type": "application/json"
1030
- },
1030
+ headers,
1031
+ credentials: _nullishCoalesce(this.options.credentials, () => ( "same-origin")),
1031
1032
  body: JSON.stringify({
1032
1033
  system: config.system,
1033
1034
  messages: _chunkCTVBRM6Cjs.toCoreMessages.call(void 0, messages),
1034
1035
  tools: config.tools ? _chunkCTVBRM6Cjs.toLanguageModelTools.call(void 0, config.tools) : [],
1035
1036
  ...config.callSettings,
1036
- ...config.config
1037
+ ...config.config,
1038
+ ...this.options.body
1037
1039
  }),
1038
1040
  signal: abortSignal
1039
1041
  });