ai 6.0.221 → 6.0.222
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 +13 -0
- package/dist/index.d.mts +15 -2
- package/dist/index.d.ts +15 -2
- package/dist/index.js +46 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +46 -22
- package/dist/index.mjs.map +1 -1
- package/dist/internal/index.js +1 -1
- package/dist/internal/index.mjs +1 -1
- package/docs/02-foundations/02-providers-and-models.mdx +5 -0
- package/docs/03-ai-sdk-core/38-video-generation.mdx +35 -16
- package/docs/07-reference/01-ai-sdk-core/13-generate-video.mdx +3 -2
- package/package.json +4 -4
- package/src/generate-video/generate-video.ts +97 -25
package/dist/index.mjs
CHANGED
|
@@ -1171,7 +1171,7 @@ import {
|
|
|
1171
1171
|
} from "@ai-sdk/provider-utils";
|
|
1172
1172
|
|
|
1173
1173
|
// src/version.ts
|
|
1174
|
-
var VERSION = true ? "6.0.
|
|
1174
|
+
var VERSION = true ? "6.0.222" : "0.0.0-test";
|
|
1175
1175
|
|
|
1176
1176
|
// src/util/download/download.ts
|
|
1177
1177
|
var download = async ({
|
|
@@ -11893,13 +11893,14 @@ async function experimental_generateVideo({
|
|
|
11893
11893
|
abortSignal
|
|
11894
11894
|
});
|
|
11895
11895
|
const { prompt, image } = normalizePrompt2(promptArg);
|
|
11896
|
-
const normalizedFrameImages = frameImages == null ? void 0 : frameImages.
|
|
11897
|
-
|
|
11898
|
-
frameType: frame.frameType
|
|
11899
|
-
})
|
|
11900
|
-
const normalizedInputReferences = inputReferences == null ? void 0 : inputReferences.
|
|
11901
|
-
|
|
11902
|
-
|
|
11896
|
+
const normalizedFrameImages = frameImages == null ? void 0 : frameImages.flatMap((frame) => {
|
|
11897
|
+
const normalizedImage = normalizeImageData(frame.image);
|
|
11898
|
+
return normalizedImage != null ? [{ image: normalizedImage, frameType: frame.frameType }] : [];
|
|
11899
|
+
});
|
|
11900
|
+
const normalizedInputReferences = inputReferences == null ? void 0 : inputReferences.flatMap((reference) => {
|
|
11901
|
+
const normalized = normalizeReferenceData(reference);
|
|
11902
|
+
return normalized != null ? [normalized] : [];
|
|
11903
|
+
});
|
|
11903
11904
|
const effectiveInputReferences = normalizedFrameImages != null && normalizedFrameImages.length > 0 ? void 0 : normalizedInputReferences;
|
|
11904
11905
|
const warnings = [];
|
|
11905
11906
|
if (normalizedFrameImages != null && normalizedFrameImages.length > 0 && normalizedInputReferences != null && normalizedInputReferences.length > 0) {
|
|
@@ -12053,8 +12054,12 @@ function normalizePrompt2(promptArg) {
|
|
|
12053
12054
|
image: promptArg.image != null ? normalizeImageData(promptArg.image) : void 0
|
|
12054
12055
|
};
|
|
12055
12056
|
}
|
|
12056
|
-
function
|
|
12057
|
-
var _a22
|
|
12057
|
+
function detectFileMediaType(data, restrictToImages) {
|
|
12058
|
+
var _a22;
|
|
12059
|
+
const detected = restrictToImages ? detectMediaType({ data, signatures: imageMediaTypeSignatures }) : (_a22 = detectMediaType({ data, signatures: imageMediaTypeSignatures })) != null ? _a22 : detectMediaType({ data, signatures: videoMediaTypeSignatures });
|
|
12060
|
+
return detected != null ? detected : "image/png";
|
|
12061
|
+
}
|
|
12062
|
+
function normalizeImageData(dataContent, { restrictToImages = true } = {}) {
|
|
12058
12063
|
if (typeof dataContent === "string") {
|
|
12059
12064
|
if (dataContent.startsWith("http://") || dataContent.startsWith("https://")) {
|
|
12060
12065
|
return {
|
|
@@ -12064,27 +12069,46 @@ function normalizeImageData(dataContent) {
|
|
|
12064
12069
|
}
|
|
12065
12070
|
if (dataContent.startsWith("data:")) {
|
|
12066
12071
|
const { mediaType, base64Content } = splitDataUrl(dataContent);
|
|
12072
|
+
const data = convertBase64ToUint8Array6(base64Content != null ? base64Content : "");
|
|
12067
12073
|
return {
|
|
12068
12074
|
type: "file",
|
|
12069
|
-
mediaType: mediaType != null ? mediaType :
|
|
12070
|
-
data
|
|
12075
|
+
mediaType: mediaType != null ? mediaType : detectFileMediaType(data, restrictToImages),
|
|
12076
|
+
data
|
|
12071
12077
|
};
|
|
12072
12078
|
}
|
|
12073
|
-
const
|
|
12079
|
+
const bytes = convertBase64ToUint8Array6(dataContent);
|
|
12074
12080
|
return {
|
|
12075
12081
|
type: "file",
|
|
12076
|
-
mediaType: (
|
|
12077
|
-
|
|
12078
|
-
signatures: imageMediaTypeSignatures
|
|
12079
|
-
})) != null ? _a22 : "image/png",
|
|
12080
|
-
data: bytes2
|
|
12082
|
+
mediaType: detectFileMediaType(bytes, restrictToImages),
|
|
12083
|
+
data: bytes
|
|
12081
12084
|
};
|
|
12082
12085
|
}
|
|
12083
|
-
|
|
12086
|
+
if (dataContent instanceof Uint8Array || dataContent instanceof ArrayBuffer) {
|
|
12087
|
+
const bytes = dataContent instanceof Uint8Array ? dataContent : new Uint8Array(dataContent);
|
|
12088
|
+
return {
|
|
12089
|
+
type: "file",
|
|
12090
|
+
mediaType: detectFileMediaType(bytes, restrictToImages),
|
|
12091
|
+
data: bytes
|
|
12092
|
+
};
|
|
12093
|
+
}
|
|
12094
|
+
return void 0;
|
|
12095
|
+
}
|
|
12096
|
+
function normalizeReferenceData(reference) {
|
|
12097
|
+
const isObjectForm = typeof reference === "object" && reference != null && !(reference instanceof Uint8Array) && !(reference instanceof ArrayBuffer) && "data" in reference;
|
|
12098
|
+
if (!isObjectForm) {
|
|
12099
|
+
return normalizeImageData(reference, {
|
|
12100
|
+
restrictToImages: false
|
|
12101
|
+
});
|
|
12102
|
+
}
|
|
12103
|
+
const normalized = normalizeImageData(reference.data, {
|
|
12104
|
+
restrictToImages: false
|
|
12105
|
+
});
|
|
12106
|
+
if (normalized == null) {
|
|
12107
|
+
return normalized;
|
|
12108
|
+
}
|
|
12084
12109
|
return {
|
|
12085
|
-
|
|
12086
|
-
mediaType
|
|
12087
|
-
data: bytes
|
|
12110
|
+
...normalized,
|
|
12111
|
+
...reference.mediaType != null ? { mediaType: reference.mediaType } : {}
|
|
12088
12112
|
};
|
|
12089
12113
|
}
|
|
12090
12114
|
async function invokeModelMaxVideosPerCall(model) {
|