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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai",
3
- "version": "4.0.20",
3
+ "version": "4.0.21",
4
4
  "description": "AI SDK by Vercel - The AI Toolkit for TypeScript and JavaScript",
5
5
  "license": "Apache-2.0",
6
6
  "sideEffects": false,
@@ -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 (mimeType == null && normalizedData instanceof Uint8Array) {
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
- case "file":
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