@assistant-ui/react 0.5.32 → 0.5.34

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
@@ -9,7 +9,7 @@ import {
9
9
  toLanguageModelMessages,
10
10
  toLanguageModelTools,
11
11
  toolResultStream
12
- } from "./chunk-DXLSOE2J.mjs";
12
+ } from "./chunk-QBSJKWMT.mjs";
13
13
  import {
14
14
  __export
15
15
  } from "./chunk-BJPOCE4O.mjs";
@@ -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: this.options.credentials ?? "same-origin",
1031
1032
  body: JSON.stringify({
1032
1033
  system: config.system,
1033
1034
  messages: toCoreMessages(messages),
1034
1035
  tools: config.tools ? toLanguageModelTools(config.tools) : [],
1035
1036
  ...config.callSettings,
1036
- ...config.config
1037
+ ...config.config,
1038
+ ...this.options.body
1037
1039
  }),
1038
1040
  signal: abortSignal
1039
1041
  });
@@ -1140,19 +1142,40 @@ var LocalThreadRuntime = class {
1140
1142
  this.abortController?.abort();
1141
1143
  this.abortController = new AbortController();
1142
1144
  const initialContent = message.content;
1143
- const initialRoundtrips = message.roundtrips;
1145
+ const initialRoundtrips = message.metadata?.roundtrips;
1146
+ const initalCustom = message.metadata?.custom;
1144
1147
  const updateMessage = (m) => {
1145
1148
  message = {
1146
1149
  ...message,
1147
1150
  ...m.content ? { content: [...initialContent, ...m.content ?? []] } : void 0,
1148
1151
  status: m.status ?? message.status,
1149
- ...m.roundtrips?.length ? { roundtrips: [...initialRoundtrips ?? [], ...m.roundtrips] } : void 0
1152
+ // TODO deprecated, remove in v0.6
1153
+ ...m.metadata?.roundtrips ? {
1154
+ roundtrips: [
1155
+ ...initialRoundtrips ?? [],
1156
+ ...m.metadata.roundtrips
1157
+ ]
1158
+ } : void 0,
1159
+ ...m.metadata ? {
1160
+ metadata: {
1161
+ ...message.metadata,
1162
+ ...m.metadata.roundtrips ? {
1163
+ roundtrips: [
1164
+ ...initialRoundtrips ?? [],
1165
+ ...m.metadata.roundtrips
1166
+ ]
1167
+ } : void 0,
1168
+ ...m.metadata?.custom ? {
1169
+ custom: { ...initalCustom ?? {}, ...m.metadata.custom }
1170
+ } : void 0
1171
+ }
1172
+ } : void 0
1150
1173
  };
1151
1174
  this.repository.addOrUpdateMessage(parentId, message);
1152
1175
  this.notifySubscribers();
1153
1176
  };
1154
1177
  const maxToolRoundtrips = this.options?.maxToolRoundtrips ?? 1;
1155
- const toolRoundtrips = message.roundtrips?.length ?? 0;
1178
+ const toolRoundtrips = message.metadata?.roundtrips?.length ?? 0;
1156
1179
  if (toolRoundtrips > maxToolRoundtrips) {
1157
1180
  updateMessage({
1158
1181
  status: {