ai 4.0.20 → 4.0.21
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/CHANGELOG.md +7 -0
- package/dist/index.js +99 -87
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +99 -87
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/rsc/dist/rsc-server.mjs +7 -4
- package/rsc/dist/rsc-server.mjs.map +1 -1
package/package.json
CHANGED
package/rsc/dist/rsc-server.mjs
CHANGED
@@ -512,6 +512,7 @@ async function downloadAssets(messages, downloadImplementation, modelSupportsIma
|
|
512
512
|
);
|
513
513
|
}
|
514
514
|
function convertPartToLanguageModelPart(part, downloadedAssets) {
|
515
|
+
var _a9;
|
515
516
|
if (part.type === "text") {
|
516
517
|
return {
|
517
518
|
type: "text",
|
@@ -562,9 +563,9 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
562
563
|
normalizedData = convertDataContentToUint8Array(content);
|
563
564
|
}
|
564
565
|
switch (type) {
|
565
|
-
case "image":
|
566
|
-
if (
|
567
|
-
mimeType = detectImageMimeType(normalizedData);
|
566
|
+
case "image": {
|
567
|
+
if (normalizedData instanceof Uint8Array) {
|
568
|
+
mimeType = (_a9 = detectImageMimeType(normalizedData)) != null ? _a9 : mimeType;
|
568
569
|
}
|
569
570
|
return {
|
570
571
|
type: "image",
|
@@ -572,7 +573,8 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
572
573
|
mimeType,
|
573
574
|
providerMetadata: part.experimental_providerMetadata
|
574
575
|
};
|
575
|
-
|
576
|
+
}
|
577
|
+
case "file": {
|
576
578
|
if (mimeType == null) {
|
577
579
|
throw new Error(`Mime type is missing for file part`);
|
578
580
|
}
|
@@ -582,6 +584,7 @@ function convertPartToLanguageModelPart(part, downloadedAssets) {
|
|
582
584
|
mimeType,
|
583
585
|
providerMetadata: part.experimental_providerMetadata
|
584
586
|
};
|
587
|
+
}
|
585
588
|
}
|
586
589
|
}
|
587
590
|
|