ai 3.1.4 → 3.1.6
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.d.mts +23 -3
- package/dist/index.d.ts +23 -3
- package/dist/index.js +12 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/prompts/dist/index.d.mts +4 -0
- package/prompts/dist/index.d.ts +4 -0
- package/react/dist/index.d.mts +10 -1
- package/react/dist/index.d.ts +10 -1
- package/react/dist/index.js.map +1 -1
- package/react/dist/index.mjs.map +1 -1
- package/rsc/dist/index.d.ts +20 -9
- package/rsc/dist/rsc-server.d.mts +20 -9
- package/rsc/dist/rsc-server.mjs +27 -6
- package/rsc/dist/rsc-server.mjs.map +1 -1
- package/solid/dist/index.d.mts +4 -0
- package/solid/dist/index.d.ts +4 -0
- package/svelte/dist/index.d.mts +4 -0
- package/svelte/dist/index.d.ts +4 -0
- package/vue/dist/index.d.mts +4 -0
- package/vue/dist/index.d.ts +4 -0
package/rsc/dist/rsc-server.mjs
CHANGED
@@ -204,7 +204,15 @@ function convertDataContentToUint8Array(content) {
|
|
204
204
|
return content;
|
205
205
|
}
|
206
206
|
if (typeof content === "string") {
|
207
|
-
|
207
|
+
try {
|
208
|
+
return convertBase64ToUint8Array(content);
|
209
|
+
} catch (error) {
|
210
|
+
throw new InvalidDataContentError({
|
211
|
+
message: "Invalid data content. Content string is not a base64-encoded image.",
|
212
|
+
content,
|
213
|
+
cause: error
|
214
|
+
});
|
215
|
+
}
|
208
216
|
}
|
209
217
|
if (content instanceof ArrayBuffer) {
|
210
218
|
return new Uint8Array(content);
|
@@ -230,6 +238,9 @@ function convertToLanguageModelPrompt(prompt) {
|
|
230
238
|
languageModelMessages.push(
|
231
239
|
...prompt.messages.map((message) => {
|
232
240
|
switch (message.role) {
|
241
|
+
case "system": {
|
242
|
+
return { role: "system", content: message.content };
|
243
|
+
}
|
233
244
|
case "user": {
|
234
245
|
if (typeof message.content === "string") {
|
235
246
|
return {
|
@@ -1167,7 +1178,7 @@ function createStreamableUI(initialValue) {
|
|
1167
1178
|
}
|
1168
1179
|
}
|
1169
1180
|
warnUnclosedStream();
|
1170
|
-
|
1181
|
+
const streamable2 = {
|
1171
1182
|
/**
|
1172
1183
|
* The value of the streamable UI. This can be returned from a Server Action and received by the client.
|
1173
1184
|
*/
|
@@ -1179,7 +1190,7 @@ function createStreamableUI(initialValue) {
|
|
1179
1190
|
assertStream(".update()");
|
1180
1191
|
if (value === currentValue) {
|
1181
1192
|
warnUnclosedStream();
|
1182
|
-
return;
|
1193
|
+
return streamable2;
|
1183
1194
|
}
|
1184
1195
|
const resolvable = createResolvablePromise();
|
1185
1196
|
currentValue = value;
|
@@ -1187,6 +1198,7 @@ function createStreamableUI(initialValue) {
|
|
1187
1198
|
resolve = resolvable.resolve;
|
1188
1199
|
reject = resolvable.reject;
|
1189
1200
|
warnUnclosedStream();
|
1201
|
+
return streamable2;
|
1190
1202
|
},
|
1191
1203
|
/**
|
1192
1204
|
* This method is used to append a new UI node to the end of the old one.
|
@@ -1212,6 +1224,7 @@ function createStreamableUI(initialValue) {
|
|
1212
1224
|
resolve = resolvable.resolve;
|
1213
1225
|
reject = resolvable.reject;
|
1214
1226
|
warnUnclosedStream();
|
1227
|
+
return streamable2;
|
1215
1228
|
},
|
1216
1229
|
/**
|
1217
1230
|
* This method is used to signal that there is an error in the UI stream.
|
@@ -1224,6 +1237,7 @@ function createStreamableUI(initialValue) {
|
|
1224
1237
|
}
|
1225
1238
|
closed = true;
|
1226
1239
|
reject(error);
|
1240
|
+
return streamable2;
|
1227
1241
|
},
|
1228
1242
|
/**
|
1229
1243
|
* This method marks the UI node as finalized. You can either call it without any parameters or with a new UI node as the final state.
|
@@ -1239,11 +1253,13 @@ function createStreamableUI(initialValue) {
|
|
1239
1253
|
closed = true;
|
1240
1254
|
if (args.length) {
|
1241
1255
|
resolve({ value: args[0], done: true });
|
1242
|
-
return;
|
1256
|
+
return streamable2;
|
1243
1257
|
}
|
1244
1258
|
resolve({ value: currentValue, done: true });
|
1259
|
+
return streamable2;
|
1245
1260
|
}
|
1246
1261
|
};
|
1262
|
+
return streamable2;
|
1247
1263
|
}
|
1248
1264
|
var STREAMABLE_VALUE_INTERNAL_LOCK = Symbol("streamable.value.lock");
|
1249
1265
|
function createStreamableValue(initialValue) {
|
@@ -1340,7 +1356,7 @@ function createStreamableValueImpl(initialValue) {
|
|
1340
1356
|
}
|
1341
1357
|
currentValue = value;
|
1342
1358
|
}
|
1343
|
-
|
1359
|
+
const streamable2 = {
|
1344
1360
|
/**
|
1345
1361
|
* @internal This is an internal lock to prevent the value from being
|
1346
1362
|
* updated by the user.
|
@@ -1367,6 +1383,7 @@ function createStreamableValueImpl(initialValue) {
|
|
1367
1383
|
currentPromise = resolvable.promise;
|
1368
1384
|
resolvePrevious(createWrapped());
|
1369
1385
|
warnUnclosedStream();
|
1386
|
+
return streamable2;
|
1370
1387
|
},
|
1371
1388
|
/**
|
1372
1389
|
* This method is used to append a delta string to the current value. It
|
@@ -1404,6 +1421,7 @@ function createStreamableValueImpl(initialValue) {
|
|
1404
1421
|
currentPromise = resolvable.promise;
|
1405
1422
|
resolvePrevious(createWrapped());
|
1406
1423
|
warnUnclosedStream();
|
1424
|
+
return streamable2;
|
1407
1425
|
},
|
1408
1426
|
/**
|
1409
1427
|
* This method is used to signal that there is an error in the value stream.
|
@@ -1419,6 +1437,7 @@ function createStreamableValueImpl(initialValue) {
|
|
1419
1437
|
currentError = error;
|
1420
1438
|
currentPromise = void 0;
|
1421
1439
|
resolvable.resolve({ error });
|
1440
|
+
return streamable2;
|
1422
1441
|
},
|
1423
1442
|
/**
|
1424
1443
|
* This method marks the value as finalized. You can either call it without
|
@@ -1438,11 +1457,13 @@ function createStreamableValueImpl(initialValue) {
|
|
1438
1457
|
if (args.length) {
|
1439
1458
|
updateValueStates(args[0]);
|
1440
1459
|
resolvable.resolve(createWrapped());
|
1441
|
-
return;
|
1460
|
+
return streamable2;
|
1442
1461
|
}
|
1443
1462
|
resolvable.resolve({});
|
1463
|
+
return streamable2;
|
1444
1464
|
}
|
1445
1465
|
};
|
1466
|
+
return streamable2;
|
1446
1467
|
}
|
1447
1468
|
function render(options) {
|
1448
1469
|
const ui = createStreamableUI(options.initial);
|