@ai-sdk/alibaba 1.0.49 → 1.0.50
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 +10 -0
- package/dist/index.d.mts +16 -8
- package/dist/index.d.ts +16 -8
- package/dist/index.js +74 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +74 -36
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- package/src/alibaba-video-model.ts +130 -39
- package/src/alibaba-video-settings.ts +2 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @ai-sdk/alibaba
|
|
2
2
|
|
|
3
|
+
## 1.0.50
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8346001: feat(provider/alibaba): support wan3 all-in-one video generation
|
|
8
|
+
- 313a441: Prevent negative text output token counts when providers report reasoning tokens. Perplexity reasoning tokens are now treated as separate from completion tokens.
|
|
9
|
+
- Updated dependencies [5642849]
|
|
10
|
+
- @ai-sdk/provider-utils@4.0.48
|
|
11
|
+
- @ai-sdk/openai-compatible@2.0.72
|
|
12
|
+
|
|
3
13
|
## 1.0.49
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -29,7 +29,7 @@ declare const alibabaEmbeddingModelOptions: z.ZodObject<{
|
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
type AlibabaEmbeddingModelOptions = z.infer<typeof alibabaEmbeddingModelOptions>;
|
|
31
31
|
|
|
32
|
-
type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.7-t2v' | 'wan2.7-t2v-2026-06-12' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | 'wan2.7-r2v' | 'wan2.7-r2v-2026-06-12' | (string & {});
|
|
32
|
+
type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.7-t2v' | 'wan2.7-t2v-2026-06-12' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | 'wan2.7-r2v' | 'wan2.7-r2v-2026-06-12' | 'wan3.0-video' | (string & {});
|
|
33
33
|
|
|
34
34
|
interface AlibabaProvider extends ProviderV3 {
|
|
35
35
|
(modelId: AlibabaChatModelId): LanguageModelV3;
|
|
@@ -127,7 +127,10 @@ type AlibabaVideoModelOptions = {
|
|
|
127
127
|
shotType?: 'single' | 'multi' | null;
|
|
128
128
|
/** Whether to add watermark to generated video. Defaults to false. */
|
|
129
129
|
watermark?: boolean | null;
|
|
130
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Enable audio generation (I2V/R2V and wan3 models;
|
|
132
|
+
* wan2.7 models always generate audio). Defaults to true on wan3.
|
|
133
|
+
*/
|
|
131
134
|
audio?: boolean | null;
|
|
132
135
|
/**
|
|
133
136
|
* Reference URLs for reference-to-video mode.
|
|
@@ -136,22 +139,27 @@ type AlibabaVideoModelOptions = {
|
|
|
136
139
|
*/
|
|
137
140
|
referenceUrls?: string[] | null;
|
|
138
141
|
/**
|
|
139
|
-
* Explicit media array
|
|
140
|
-
*
|
|
142
|
+
* Explicit media array (wan2.7 and wan3 models). Overrides the automatic
|
|
143
|
+
* mapping from `inputReferences` and `frameImages`.
|
|
141
144
|
* Use `Image 1`, `Video 1`, etc. in prompts to reference media items
|
|
142
|
-
* (images and
|
|
145
|
+
* (images, videos, and audio are counted separately, in array order).
|
|
146
|
+
*
|
|
147
|
+
* `reference_audio`, `file`, and `link` are wan3-only and have no top-level
|
|
148
|
+
* call option, so they can only be passed here. wan3 also rejects mixing
|
|
149
|
+
* `reference_*`/`file`/`link` with `first_frame`/`last_frame`.
|
|
143
150
|
*/
|
|
144
151
|
media?: Array<{
|
|
145
|
-
type: 'reference_image' | 'reference_video' | 'first_frame';
|
|
152
|
+
type: 'reference_image' | 'reference_video' | 'reference_audio' | 'first_frame' | 'last_frame' | 'file' | 'link';
|
|
146
153
|
/** Public URL, or a `data:{mime};base64,{data}` URI for images. */
|
|
147
154
|
url: string;
|
|
148
155
|
/** URL to an audio file used as voice reference for this media item. */
|
|
149
156
|
referenceVoice?: string | null;
|
|
150
157
|
}> | null;
|
|
151
158
|
/**
|
|
152
|
-
* Aspect ratio (wan2.7 text-to-video and reference-to-video models
|
|
159
|
+
* Aspect ratio (wan2.7 text-to-video and reference-to-video models, and
|
|
160
|
+
* every wan3 generation). `adaptive` is wan3-only, and is its default.
|
|
153
161
|
*/
|
|
154
|
-
ratio?: '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
|
|
162
|
+
ratio?: 'adaptive' | '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
|
|
155
163
|
/** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
|
|
156
164
|
pollIntervalMs?: number | null;
|
|
157
165
|
/** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
|
package/dist/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare const alibabaEmbeddingModelOptions: z.ZodObject<{
|
|
|
29
29
|
}, z.core.$strip>;
|
|
30
30
|
type AlibabaEmbeddingModelOptions = z.infer<typeof alibabaEmbeddingModelOptions>;
|
|
31
31
|
|
|
32
|
-
type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.7-t2v' | 'wan2.7-t2v-2026-06-12' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | 'wan2.7-r2v' | 'wan2.7-r2v-2026-06-12' | (string & {});
|
|
32
|
+
type AlibabaVideoModelId = 'wan2.6-t2v' | 'wan2.5-t2v-preview' | 'wan2.7-t2v' | 'wan2.7-t2v-2026-06-12' | 'wan2.6-i2v' | 'wan2.6-i2v-flash' | 'wan2.6-r2v' | 'wan2.6-r2v-flash' | 'wan2.7-r2v' | 'wan2.7-r2v-2026-06-12' | 'wan3.0-video' | (string & {});
|
|
33
33
|
|
|
34
34
|
interface AlibabaProvider extends ProviderV3 {
|
|
35
35
|
(modelId: AlibabaChatModelId): LanguageModelV3;
|
|
@@ -127,7 +127,10 @@ type AlibabaVideoModelOptions = {
|
|
|
127
127
|
shotType?: 'single' | 'multi' | null;
|
|
128
128
|
/** Whether to add watermark to generated video. Defaults to false. */
|
|
129
129
|
watermark?: boolean | null;
|
|
130
|
-
/**
|
|
130
|
+
/**
|
|
131
|
+
* Enable audio generation (I2V/R2V and wan3 models;
|
|
132
|
+
* wan2.7 models always generate audio). Defaults to true on wan3.
|
|
133
|
+
*/
|
|
131
134
|
audio?: boolean | null;
|
|
132
135
|
/**
|
|
133
136
|
* Reference URLs for reference-to-video mode.
|
|
@@ -136,22 +139,27 @@ type AlibabaVideoModelOptions = {
|
|
|
136
139
|
*/
|
|
137
140
|
referenceUrls?: string[] | null;
|
|
138
141
|
/**
|
|
139
|
-
* Explicit media array
|
|
140
|
-
*
|
|
142
|
+
* Explicit media array (wan2.7 and wan3 models). Overrides the automatic
|
|
143
|
+
* mapping from `inputReferences` and `frameImages`.
|
|
141
144
|
* Use `Image 1`, `Video 1`, etc. in prompts to reference media items
|
|
142
|
-
* (images and
|
|
145
|
+
* (images, videos, and audio are counted separately, in array order).
|
|
146
|
+
*
|
|
147
|
+
* `reference_audio`, `file`, and `link` are wan3-only and have no top-level
|
|
148
|
+
* call option, so they can only be passed here. wan3 also rejects mixing
|
|
149
|
+
* `reference_*`/`file`/`link` with `first_frame`/`last_frame`.
|
|
143
150
|
*/
|
|
144
151
|
media?: Array<{
|
|
145
|
-
type: 'reference_image' | 'reference_video' | 'first_frame';
|
|
152
|
+
type: 'reference_image' | 'reference_video' | 'reference_audio' | 'first_frame' | 'last_frame' | 'file' | 'link';
|
|
146
153
|
/** Public URL, or a `data:{mime};base64,{data}` URI for images. */
|
|
147
154
|
url: string;
|
|
148
155
|
/** URL to an audio file used as voice reference for this media item. */
|
|
149
156
|
referenceVoice?: string | null;
|
|
150
157
|
}> | null;
|
|
151
158
|
/**
|
|
152
|
-
* Aspect ratio (wan2.7 text-to-video and reference-to-video models
|
|
159
|
+
* Aspect ratio (wan2.7 text-to-video and reference-to-video models, and
|
|
160
|
+
* every wan3 generation). `adaptive` is wan3-only, and is its default.
|
|
153
161
|
*/
|
|
154
|
-
ratio?: '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
|
|
162
|
+
ratio?: 'adaptive' | '16:9' | '9:16' | '1:1' | '4:3' | '3:4' | null;
|
|
155
163
|
/** Polling interval in milliseconds. Defaults to 5000 (5 seconds). */
|
|
156
164
|
pollIntervalMs?: number | null;
|
|
157
165
|
/** Maximum wait time in milliseconds for video generation. Defaults to 600000 (10 minutes). */
|
package/dist/index.js
CHANGED
|
@@ -854,13 +854,17 @@ var alibabaVideoModelOptionsSchema = (0, import_provider_utils5.lazySchema)(
|
|
|
854
854
|
type: import_v46.z.enum([
|
|
855
855
|
"reference_image",
|
|
856
856
|
"reference_video",
|
|
857
|
-
"
|
|
857
|
+
"reference_audio",
|
|
858
|
+
"first_frame",
|
|
859
|
+
"last_frame",
|
|
860
|
+
"file",
|
|
861
|
+
"link"
|
|
858
862
|
]),
|
|
859
863
|
url: import_v46.z.string(),
|
|
860
864
|
referenceVoice: import_v46.z.string().nullish()
|
|
861
865
|
})
|
|
862
866
|
).nullish(),
|
|
863
|
-
ratio: import_v46.z.enum(["16:9", "9:16", "1:1", "4:3", "3:4"]).nullish(),
|
|
867
|
+
ratio: import_v46.z.enum(["adaptive", "16:9", "9:16", "1:1", "4:3", "3:4"]).nullish(),
|
|
864
868
|
pollIntervalMs: import_v46.z.number().positive().nullish(),
|
|
865
869
|
pollTimeoutMs: import_v46.z.number().positive().nullish()
|
|
866
870
|
}).passthrough()
|
|
@@ -898,8 +902,12 @@ var alibabaVideoTaskStatusSchema = import_v46.z.object({
|
|
|
898
902
|
usage: import_v46.z.object({
|
|
899
903
|
duration: import_v46.z.number().nullish(),
|
|
900
904
|
output_video_duration: import_v46.z.number().nullish(),
|
|
905
|
+
// wan3 splits the total: input video counts toward its 30s ceiling.
|
|
906
|
+
input_video_duration: import_v46.z.number().nullish(),
|
|
907
|
+
fps: import_v46.z.number().nullish(),
|
|
901
908
|
SR: import_v46.z.number().nullish(),
|
|
902
|
-
size: import_v46.z.string().nullish()
|
|
909
|
+
size: import_v46.z.string().nullish(),
|
|
910
|
+
ratio: import_v46.z.string().nullish()
|
|
903
911
|
}).nullish(),
|
|
904
912
|
request_id: import_v46.z.string().nullish()
|
|
905
913
|
});
|
|
@@ -908,8 +916,10 @@ function detectMode(modelId) {
|
|
|
908
916
|
if (modelId.includes("-r2v")) return "r2v";
|
|
909
917
|
return "t2v";
|
|
910
918
|
}
|
|
911
|
-
function
|
|
912
|
-
|
|
919
|
+
function detectProtocol(modelId) {
|
|
920
|
+
if (modelId.startsWith("wan3")) return "wan3";
|
|
921
|
+
if (modelId.startsWith("wan2.7")) return "wan27";
|
|
922
|
+
return "legacy";
|
|
913
923
|
}
|
|
914
924
|
var resolutionTierMap = {
|
|
915
925
|
"1280x720": "720P",
|
|
@@ -950,6 +960,10 @@ function getFirstFrameImage(options) {
|
|
|
950
960
|
var _a, _b;
|
|
951
961
|
return (_b = (_a = options.frameImages) == null ? void 0 : _a.find((frame) => frame.frameType === "first_frame")) == null ? void 0 : _b.image;
|
|
952
962
|
}
|
|
963
|
+
function getLastFrameImage(options) {
|
|
964
|
+
var _a, _b;
|
|
965
|
+
return (_b = (_a = options.frameImages) == null ? void 0 : _a.find((frame) => frame.frameType === "last_frame")) == null ? void 0 : _b.image;
|
|
966
|
+
}
|
|
953
967
|
function resolveStartImage(options) {
|
|
954
968
|
var _a;
|
|
955
969
|
return (_a = getFirstFrameImage(options)) != null ? _a : options.image;
|
|
@@ -957,7 +971,7 @@ function resolveStartImage(options) {
|
|
|
957
971
|
function isVideoUrl(url) {
|
|
958
972
|
return /\.(mp4|mov)([?#]|$)/i.test(url);
|
|
959
973
|
}
|
|
960
|
-
function resolveMedia(options, alibabaOptions, warnings) {
|
|
974
|
+
function resolveMedia(options, alibabaOptions, warnings, frames) {
|
|
961
975
|
var _a;
|
|
962
976
|
if ((alibabaOptions == null ? void 0 : alibabaOptions.media) != null && alibabaOptions.media.length > 0) {
|
|
963
977
|
return alibabaOptions.media.map((item) => ({
|
|
@@ -986,11 +1000,16 @@ function resolveMedia(options, alibabaOptions, warnings) {
|
|
|
986
1000
|
});
|
|
987
1001
|
}
|
|
988
1002
|
}
|
|
989
|
-
|
|
990
|
-
if (firstFrame != null) {
|
|
1003
|
+
if (frames.first != null) {
|
|
991
1004
|
media.push({
|
|
992
1005
|
type: "first_frame",
|
|
993
|
-
url: (0, import_provider_utils5.convertImageModelFileToDataUri)(
|
|
1006
|
+
url: (0, import_provider_utils5.convertImageModelFileToDataUri)(frames.first)
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
if (frames.last != null) {
|
|
1010
|
+
media.push({
|
|
1011
|
+
type: "last_frame",
|
|
1012
|
+
url: (0, import_provider_utils5.convertImageModelFileToDataUri)(frames.last)
|
|
994
1013
|
});
|
|
995
1014
|
}
|
|
996
1015
|
return media.length > 0 ? media : void 0;
|
|
@@ -1028,7 +1047,7 @@ var AlibabaVideoModel = class {
|
|
|
1028
1047
|
return this.config.provider;
|
|
1029
1048
|
}
|
|
1030
1049
|
async doGenerate(options) {
|
|
1031
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n
|
|
1050
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n;
|
|
1032
1051
|
const currentDate = (_c = (_b = (_a = this.config._internal) == null ? void 0 : _a.currentDate) == null ? void 0 : _b.call(_a)) != null ? _c : /* @__PURE__ */ new Date();
|
|
1033
1052
|
const warnings = [];
|
|
1034
1053
|
const mode = detectMode(this.modelId);
|
|
@@ -1048,14 +1067,27 @@ var AlibabaVideoModel = class {
|
|
|
1048
1067
|
input.audio_url = alibabaOptions.audioUrl;
|
|
1049
1068
|
}
|
|
1050
1069
|
const startImage = resolveStartImage(options);
|
|
1051
|
-
const
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1070
|
+
const protocol = detectProtocol(this.modelId);
|
|
1071
|
+
const wan27 = protocol === "wan27";
|
|
1072
|
+
const wan3 = protocol === "wan3";
|
|
1073
|
+
const tieredProtocol = wan27 || wan3;
|
|
1074
|
+
const supportsRatio = wan3 || wan27 && mode !== "i2v";
|
|
1075
|
+
if (!wan3 && mode === "i2v" && startImage != null) {
|
|
1054
1076
|
input.img_url = fileToImageString(startImage);
|
|
1055
1077
|
}
|
|
1056
|
-
if (
|
|
1078
|
+
if (wan3) {
|
|
1079
|
+
const media = resolveMedia(options, alibabaOptions, warnings, {
|
|
1080
|
+
first: startImage,
|
|
1081
|
+
last: getLastFrameImage(options)
|
|
1082
|
+
});
|
|
1083
|
+
if (media != null) {
|
|
1084
|
+
input.media = media;
|
|
1085
|
+
}
|
|
1086
|
+
} else if (mode === "r2v") {
|
|
1057
1087
|
if (wan27) {
|
|
1058
|
-
const media = resolveMedia(options, alibabaOptions, warnings
|
|
1088
|
+
const media = resolveMedia(options, alibabaOptions, warnings, {
|
|
1089
|
+
first: getFirstFrameImage(options)
|
|
1090
|
+
});
|
|
1059
1091
|
if (media != null) {
|
|
1060
1092
|
input.media = media;
|
|
1061
1093
|
}
|
|
@@ -1070,17 +1102,15 @@ var AlibabaVideoModel = class {
|
|
|
1070
1102
|
}
|
|
1071
1103
|
}
|
|
1072
1104
|
}
|
|
1073
|
-
const lastFrame = (
|
|
1074
|
-
|
|
1075
|
-
)) == null ? void 0 : _e.image;
|
|
1076
|
-
if (lastFrame != null) {
|
|
1105
|
+
const lastFrame = getLastFrameImage(options);
|
|
1106
|
+
if (lastFrame != null && !wan3) {
|
|
1077
1107
|
warnings.push({
|
|
1078
1108
|
type: "unsupported",
|
|
1079
1109
|
feature: "frameImages",
|
|
1080
1110
|
details: "This model does not support last_frame. The last frame image was ignored."
|
|
1081
1111
|
});
|
|
1082
1112
|
}
|
|
1083
|
-
if (options.inputReferences != null && options.inputReferences.length > 0 && mode !== "r2v") {
|
|
1113
|
+
if (options.inputReferences != null && options.inputReferences.length > 0 && mode !== "r2v" && !wan3) {
|
|
1084
1114
|
warnings.push({
|
|
1085
1115
|
type: "unsupported",
|
|
1086
1116
|
feature: "inputReferences",
|
|
@@ -1095,13 +1125,14 @@ var AlibabaVideoModel = class {
|
|
|
1095
1125
|
parameters.seed = options.seed;
|
|
1096
1126
|
}
|
|
1097
1127
|
if (options.resolution != null) {
|
|
1098
|
-
if (mode === "i2v" ||
|
|
1128
|
+
if (mode === "i2v" || tieredProtocol) {
|
|
1099
1129
|
const resolutionTier = resolutionTierMap[options.resolution] || options.resolution;
|
|
1100
|
-
|
|
1130
|
+
const supportedTiers = wan3 ? ["480P", "720P", "1080P"] : ["720P", "1080P"];
|
|
1131
|
+
if (tieredProtocol && !supportedTiers.includes(resolutionTier)) {
|
|
1101
1132
|
warnings.push({
|
|
1102
1133
|
type: "unsupported",
|
|
1103
1134
|
feature: "resolution",
|
|
1104
|
-
details:
|
|
1135
|
+
details: `${wan3 ? "wan3" : "wan2.7"} models only support the ${supportedTiers.join(", ")} resolution tiers. The resolution "${options.resolution}" was ignored.`
|
|
1105
1136
|
});
|
|
1106
1137
|
} else {
|
|
1107
1138
|
parameters.resolution = resolutionTier;
|
|
@@ -1111,7 +1142,7 @@ var AlibabaVideoModel = class {
|
|
|
1111
1142
|
}
|
|
1112
1143
|
}
|
|
1113
1144
|
if (supportsRatio) {
|
|
1114
|
-
const ratio = (
|
|
1145
|
+
const ratio = (_e = (_d = alibabaOptions == null ? void 0 : alibabaOptions.ratio) != null ? _d : options.aspectRatio) != null ? _e : options.resolution != null ? deriveRatioFromResolution(options.resolution) : void 0;
|
|
1115
1146
|
if (ratio != null) {
|
|
1116
1147
|
parameters.ratio = ratio;
|
|
1117
1148
|
}
|
|
@@ -1120,11 +1151,11 @@ var AlibabaVideoModel = class {
|
|
|
1120
1151
|
parameters.prompt_extend = alibabaOptions.promptExtend;
|
|
1121
1152
|
}
|
|
1122
1153
|
if ((alibabaOptions == null ? void 0 : alibabaOptions.shotType) != null) {
|
|
1123
|
-
if (
|
|
1154
|
+
if (tieredProtocol) {
|
|
1124
1155
|
warnings.push({
|
|
1125
1156
|
type: "unsupported",
|
|
1126
1157
|
feature: "shotType",
|
|
1127
|
-
details: "wan2.7 models do not support the shotType option. Describe the shot structure in the prompt instead
|
|
1158
|
+
details: `${wan3 ? "wan3" : "wan2.7"} models do not support the shotType option. Describe the shot structure in the prompt instead.`
|
|
1128
1159
|
});
|
|
1129
1160
|
} else {
|
|
1130
1161
|
parameters.shot_type = alibabaOptions.shotType;
|
|
@@ -1133,7 +1164,7 @@ var AlibabaVideoModel = class {
|
|
|
1133
1164
|
if ((alibabaOptions == null ? void 0 : alibabaOptions.watermark) != null) {
|
|
1134
1165
|
parameters.watermark = alibabaOptions.watermark;
|
|
1135
1166
|
}
|
|
1136
|
-
const audio = (
|
|
1167
|
+
const audio = (_f = options.generateAudio) != null ? _f : alibabaOptions == null ? void 0 : alibabaOptions.audio;
|
|
1137
1168
|
if (audio != null) {
|
|
1138
1169
|
if (wan27) {
|
|
1139
1170
|
warnings.push({
|
|
@@ -1187,15 +1218,15 @@ var AlibabaVideoModel = class {
|
|
|
1187
1218
|
abortSignal: options.abortSignal,
|
|
1188
1219
|
fetch: this.config.fetch
|
|
1189
1220
|
});
|
|
1190
|
-
const taskId = (
|
|
1221
|
+
const taskId = (_g = createResponse.output) == null ? void 0 : _g.task_id;
|
|
1191
1222
|
if (!taskId) {
|
|
1192
1223
|
throw new import_provider4.AISDKError({
|
|
1193
1224
|
name: "ALIBABA_VIDEO_GENERATION_ERROR",
|
|
1194
1225
|
message: `No task_id returned from Alibaba API. Response: ${JSON.stringify(createResponse)}`
|
|
1195
1226
|
});
|
|
1196
1227
|
}
|
|
1197
|
-
const pollIntervalMs = (
|
|
1198
|
-
const pollTimeoutMs = (
|
|
1228
|
+
const pollIntervalMs = (_h = alibabaOptions == null ? void 0 : alibabaOptions.pollIntervalMs) != null ? _h : 5e3;
|
|
1229
|
+
const pollTimeoutMs = (_i = alibabaOptions == null ? void 0 : alibabaOptions.pollTimeoutMs) != null ? _i : 6e5;
|
|
1199
1230
|
const startTime = Date.now();
|
|
1200
1231
|
let finalResponse;
|
|
1201
1232
|
let responseHeaders;
|
|
@@ -1221,7 +1252,7 @@ var AlibabaVideoModel = class {
|
|
|
1221
1252
|
fetch: this.config.fetch
|
|
1222
1253
|
});
|
|
1223
1254
|
responseHeaders = pollHeaders;
|
|
1224
|
-
const taskStatus = (
|
|
1255
|
+
const taskStatus = (_j = statusResponse.output) == null ? void 0 : _j.task_status;
|
|
1225
1256
|
if (taskStatus === "SUCCEEDED") {
|
|
1226
1257
|
finalResponse = statusResponse;
|
|
1227
1258
|
break;
|
|
@@ -1229,11 +1260,11 @@ var AlibabaVideoModel = class {
|
|
|
1229
1260
|
if (taskStatus === "FAILED" || taskStatus === "CANCELED") {
|
|
1230
1261
|
throw new import_provider4.AISDKError({
|
|
1231
1262
|
name: "ALIBABA_VIDEO_GENERATION_FAILED",
|
|
1232
|
-
message: `Video generation ${taskStatus.toLowerCase()}. Task ID: ${taskId}. ${(
|
|
1263
|
+
message: `Video generation ${taskStatus.toLowerCase()}. Task ID: ${taskId}. ${(_l = (_k = statusResponse.output) == null ? void 0 : _k.message) != null ? _l : ""}`
|
|
1233
1264
|
});
|
|
1234
1265
|
}
|
|
1235
1266
|
}
|
|
1236
|
-
const videoUrl = (
|
|
1267
|
+
const videoUrl = (_m = finalResponse == null ? void 0 : finalResponse.output) == null ? void 0 : _m.video_url;
|
|
1237
1268
|
if (!videoUrl) {
|
|
1238
1269
|
throw new import_provider4.AISDKError({
|
|
1239
1270
|
name: "ALIBABA_VIDEO_GENERATION_ERROR",
|
|
@@ -1258,13 +1289,20 @@ var AlibabaVideoModel = class {
|
|
|
1258
1289
|
alibaba: {
|
|
1259
1290
|
taskId,
|
|
1260
1291
|
videoUrl,
|
|
1261
|
-
...((
|
|
1292
|
+
...((_n = finalResponse == null ? void 0 : finalResponse.output) == null ? void 0 : _n.actual_prompt) ? { actualPrompt: finalResponse.output.actual_prompt } : {},
|
|
1262
1293
|
...(finalResponse == null ? void 0 : finalResponse.usage) ? {
|
|
1263
1294
|
usage: {
|
|
1264
1295
|
duration: finalResponse.usage.duration,
|
|
1265
1296
|
outputVideoDuration: finalResponse.usage.output_video_duration,
|
|
1266
1297
|
resolution: finalResponse.usage.SR,
|
|
1267
|
-
size: finalResponse.usage.size
|
|
1298
|
+
size: finalResponse.usage.size,
|
|
1299
|
+
// wan3-only. Spread rather than set to undefined so the
|
|
1300
|
+
// metadata shape for older wan models is unchanged.
|
|
1301
|
+
...finalResponse.usage.input_video_duration != null ? {
|
|
1302
|
+
inputVideoDuration: finalResponse.usage.input_video_duration
|
|
1303
|
+
} : {},
|
|
1304
|
+
...finalResponse.usage.fps != null ? { fps: finalResponse.usage.fps } : {},
|
|
1305
|
+
...finalResponse.usage.ratio != null ? { ratio: finalResponse.usage.ratio } : {}
|
|
1268
1306
|
}
|
|
1269
1307
|
} : {}
|
|
1270
1308
|
}
|
|
@@ -1274,7 +1312,7 @@ var AlibabaVideoModel = class {
|
|
|
1274
1312
|
};
|
|
1275
1313
|
|
|
1276
1314
|
// src/version.ts
|
|
1277
|
-
var VERSION = true ? "1.0.
|
|
1315
|
+
var VERSION = true ? "1.0.50" : "0.0.0-test";
|
|
1278
1316
|
|
|
1279
1317
|
// src/alibaba-provider.ts
|
|
1280
1318
|
function createAlibaba(options = {}) {
|