vidspotai-shared 1.0.65 → 1.0.67
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/lib/services/aiGen/providers/bytedance/bytedance.service.d.ts.map +1 -1
- package/lib/services/aiGen/providers/bytedance/bytedance.service.js +11 -3
- package/lib/services/analytics.service.js +4 -2
- package/lib/utils/helpers.d.ts.map +1 -1
- package/lib/utils/helpers.js +6 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bytedance.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/bytedance/bytedance.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAI9E,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;IAIb,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"bytedance.service.d.ts","sourceRoot":"","sources":["../../../../../src/services/aiGen/providers/bytedance/bytedance.service.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,wBAAwB,EAAE,MAAM,8BAA8B,CAAC;AACxE,OAAO,EACL,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,EAClB,MAAM,UAAU,CAAC;AAUlB,qBAAa,gBAAiB,SAAQ,wBAAwB;IAC5D,OAAO,CAAC,QAAQ,CAAC,OAAO,CACsD;IAI9E,OAAO,CAAC,cAAc;IAStB,OAAO,CAAC,WAAW;IAIb,aAAa,CACjB,MAAM,EAAE,qBAAqB,GAC5B,OAAO,CAAC,qBAAqB,CAAC;IAkK3B,gBAAgB,CAAC,EACrB,IAAI,EACJ,cAAc,EACd,cAAyB,GAC1B,EAAE,iBAAiB,GAAG,OAAO,CAAC,iBAAiB,CAAC;IA4HjD,aAAa,CAAC,MAAM,EAAE,iBAAiB,GAAG,MAAM;CAgDjD"}
|
|
@@ -131,12 +131,20 @@ class ByteDanceService extends baseAiGenProvider_service_1.BaseAiGenProviderServ
|
|
|
131
131
|
if (code === "InvalidParameter.UnsupportedImageFormat" || (code?.includes("UnsupportedImageFormat"))) {
|
|
132
132
|
throw new errors_1.UserFacingError("Your input image format is not supported. Please use JPEG or PNG.");
|
|
133
133
|
}
|
|
134
|
-
|
|
134
|
+
// Seedance 2.x reports image-related errors against `content[N]` (the
|
|
135
|
+
// reference image is the Nth item in the multipart `content` array)
|
|
136
|
+
// rather than the older flat `image_url` param. Treat both shapes the
|
|
137
|
+
// same so the user sees a friendly hint instead of a system alert.
|
|
138
|
+
const isImageParam = param?.includes("image_url") || /^content\[\d+\]$/.test(param ?? "");
|
|
139
|
+
if (code === "InvalidParameter" && isImageParam) {
|
|
135
140
|
if (message.includes("aspect ratio")) {
|
|
136
141
|
throw new errors_1.UserFacingError("Your input image's aspect ratio is not supported by this model. Please use an image with an aspect ratio between 0.40 and 2.50 (e.g. 1:1, 9:16, 16:9).");
|
|
137
142
|
}
|
|
138
|
-
if (
|
|
139
|
-
|
|
143
|
+
if (/pixel count|must be greater than or equal to \d+/i.test(message) ||
|
|
144
|
+
message.includes("width") ||
|
|
145
|
+
message.includes("height") ||
|
|
146
|
+
message.includes("px")) {
|
|
147
|
+
throw new errors_1.UserFacingError("Your input image is too small for this model. Please use a higher-resolution image (at least 640×640, or 300px on the shorter side).");
|
|
140
148
|
}
|
|
141
149
|
throw new errors_1.UserFacingError(`Your input image is not valid: ${message}`);
|
|
142
150
|
}
|
|
@@ -118,7 +118,9 @@ exports.AnalyticsService = AnalyticsService;
|
|
|
118
118
|
* map key under `failuresByCode`. Empty/undefined collapses to `unknown`.
|
|
119
119
|
*/
|
|
120
120
|
function sanitizeCodeKey(code) {
|
|
121
|
-
if (
|
|
121
|
+
if (code == null || code === "")
|
|
122
122
|
return "unknown";
|
|
123
|
-
return
|
|
123
|
+
// Defensive: providers occasionally return numeric codes (e.g. Google's
|
|
124
|
+
// gRPC status codes). Coerce to string before regex-replacing.
|
|
125
|
+
return String(code).replace(/[.\/~*[\]]/g, "_");
|
|
124
126
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAElB,WAAW,EACZ,MAAM,kBAAkB,CAAC;AAE1B,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,eAAO,MAAM,eAAe,GAC1B,SAAS,MAAM,KACd,mBAAmB,GAAG,IASxB,CAAC;AAEF,eAAO,MAAM,WAAW,GAAI,SAAS,MAAM,KAAG,kBAAkB,GAAG,IASlE,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAC3B,MAAM,mBAAmB,EACzB,OAAM,kBAA+C,WAgBtD,CAAC;AAEF,eAAO,MAAM,kBAAkB,GAAI,MAAM,MAAM,EAAE,oBAAiB,KAAG,MASpE,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,2BAA2B,EAAE,OAAO,CAAC,MAAM,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAInF,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,YAAY,EAAE,kBAAkB,GAAG,MAAM,CAEnF;AAED,eAAO,MAAM,kBAAkB,uBAAuB,CAAC;AAEvD,eAAO,MAAM,qBAAqB,GAChC,MAAM,MAAM,EACZ,MAAM,cAAc,EACpB,KAAI,cAAkC,EACtC,UAAS,IAAI,GAAG,IAAW,KA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tB,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAqDrB,wBAAgB,yBAAyB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAatE"}
|
package/lib/utils/helpers.js
CHANGED
|
@@ -159,8 +159,12 @@ async function generateAndValidate({ userPrompt, systemPrompt, jsonSchema, zodSc
|
|
|
159
159
|
return parsed;
|
|
160
160
|
}
|
|
161
161
|
catch (err) {
|
|
162
|
-
|
|
163
|
-
|
|
162
|
+
// Returning null here previously caused downstream "Cannot read properties
|
|
163
|
+
// of null" crashes in callers that immediately accessed fields on the
|
|
164
|
+
// result. Surface the real failure so the caller can present a friendly
|
|
165
|
+
// error (and so Slack shows the LLM payload that broke).
|
|
166
|
+
const snippet = raw.length > 500 ? `${raw.slice(0, 500)}…` : raw;
|
|
167
|
+
throw new Error(`generateAndValidate: failed to parse or validate model output — ${err?.message}; raw="${snippet}"`);
|
|
164
168
|
}
|
|
165
169
|
}
|
|
166
170
|
function getVideoDurationRangeText(durationType) {
|