@assistant-ui/react 0.5.32 → 0.5.34
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{EdgeRuntimeRequestOptions-BD0mpoF6.d.mts → EdgeRuntimeRequestOptions-BP7q0lyh.d.mts} +7 -0
- package/dist/{EdgeRuntimeRequestOptions-BD0mpoF6.d.ts → EdgeRuntimeRequestOptions-BP7q0lyh.d.ts} +7 -0
- package/dist/{chunk-CTVBRM6C.js → chunk-AAOYJ7TE.js} +12 -9
- package/dist/chunk-AAOYJ7TE.js.map +1 -0
- package/dist/{chunk-DXLSOE2J.mjs → chunk-QBSJKWMT.mjs} +11 -8
- package/dist/{chunk-DXLSOE2J.mjs.map → chunk-QBSJKWMT.mjs.map} +1 -1
- package/dist/edge.d.mts +3 -1
- package/dist/edge.d.ts +3 -1
- package/dist/edge.js +13 -8
- package/dist/edge.js.map +1 -1
- package/dist/edge.mjs +13 -8
- package/dist/edge.mjs.map +1 -1
- package/dist/index.d.mts +10 -3
- package/dist/index.d.ts +10 -3
- package/dist/index.js +67 -44
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-CTVBRM6C.js.map +0 -1
package/dist/index.mjs
CHANGED
@@ -9,7 +9,7 @@ import {
|
|
9
9
|
toLanguageModelMessages,
|
10
10
|
toLanguageModelTools,
|
11
11
|
toolResultStream
|
12
|
-
} from "./chunk-
|
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
|
-
|
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
|
-
|
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: {
|