@koda-sl/baker-cli 0.294.0-dev.97421c92b → 0.296.0-dev.f25aa60dd
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.
|
@@ -2043,12 +2043,34 @@ function supportsParam(kind, model, param) {
|
|
|
2043
2043
|
return MODEL_REGISTRY[kind]?.[model]?.params[param] !== void 0;
|
|
2044
2044
|
}
|
|
2045
2045
|
var DEFAULT_CLIP_DURATION_S = 5;
|
|
2046
|
+
var SPOKEN_WORDS_PER_SECOND = 2.5;
|
|
2047
|
+
function spokenWordsIn(prompt) {
|
|
2048
|
+
if (!prompt) return 0;
|
|
2049
|
+
const quoted = [
|
|
2050
|
+
...prompt.matchAll(/['"\u201c\u201d\u2018\u2019]([^'"\u201c\u201d\u2018\u2019]{8,})['"\u201c\u201d\u2018\u2019]/g)
|
|
2051
|
+
].map((m) => m[1] ?? "");
|
|
2052
|
+
const text = quoted.join(" ").trim();
|
|
2053
|
+
return text ? text.split(/\s+/).filter(Boolean).length : 0;
|
|
2054
|
+
}
|
|
2046
2055
|
function nearestClipDuration(model, preferred) {
|
|
2047
2056
|
const schema = MODEL_REGISTRY.video_generate[model]?.params.duration;
|
|
2048
2057
|
const allowed = schema?.kind === "number" ? schema.enum : void 0;
|
|
2049
2058
|
if (!allowed?.length || allowed.includes(preferred)) return preferred;
|
|
2050
2059
|
return [...allowed].sort((a, b) => Math.abs(a - preferred) - Math.abs(b - preferred) || a - b)[0];
|
|
2051
2060
|
}
|
|
2061
|
+
function maxClipSeconds(model) {
|
|
2062
|
+
const schema = MODEL_REGISTRY.video_generate[model]?.params.duration;
|
|
2063
|
+
const allowed = schema?.kind === "number" ? schema.enum : void 0;
|
|
2064
|
+
return allowed?.length ? Math.max(...allowed) : void 0;
|
|
2065
|
+
}
|
|
2066
|
+
function splitScriptFor(words, model) {
|
|
2067
|
+
const maxSeconds = maxClipSeconds(model);
|
|
2068
|
+
if (!maxSeconds) return null;
|
|
2069
|
+
const perClip = Math.floor(maxSeconds * SPOKEN_WORDS_PER_SECOND);
|
|
2070
|
+
if (words <= perClip) return null;
|
|
2071
|
+
const clips = Math.ceil(words / perClip);
|
|
2072
|
+
return { clips, wordsPerClip: Math.ceil(words / clips), maxSeconds };
|
|
2073
|
+
}
|
|
2052
2074
|
function promptMaxLength(kind, model) {
|
|
2053
2075
|
const schema = MODEL_REGISTRY[kind]?.[model]?.params.prompt;
|
|
2054
2076
|
return schema?.kind === "string" ? schema.maxLength : void 0;
|
|
@@ -9334,7 +9356,10 @@ export {
|
|
|
9334
9356
|
MODEL_REGISTRY,
|
|
9335
9357
|
supportsParam,
|
|
9336
9358
|
DEFAULT_CLIP_DURATION_S,
|
|
9359
|
+
SPOKEN_WORDS_PER_SECOND,
|
|
9360
|
+
spokenWordsIn,
|
|
9337
9361
|
nearestClipDuration,
|
|
9362
|
+
splitScriptFor,
|
|
9338
9363
|
promptMaxLength,
|
|
9339
9364
|
maxInputSlot,
|
|
9340
9365
|
maxInputReferences,
|
|
@@ -9379,4 +9404,4 @@ export {
|
|
|
9379
9404
|
defaultRegistry,
|
|
9380
9405
|
createEngineFromEnv
|
|
9381
9406
|
};
|
|
9382
|
-
//# sourceMappingURL=chunk-
|
|
9407
|
+
//# sourceMappingURL=chunk-YMHERSTK.js.map
|