feat(shorts): worker force scenes for AI-tips — terminal/compare/fix/bullets/bang
This commit is contained in:
1 parent
a992d73eda
commit
005d9880e6
2 files changed
+25
-11
No files matched your search
@@ -237,13 +237,27 @@ async function renderScript(script) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. Remotion timeline (frames)
|
// 3. Remotion timeline (frames)
|
||||||
const timeline = voiced.map((s) => ({
|
const timeline = voiced.map((s) => {
|
||||||
text: s.text,
|
const t = {
|
||||||
duration: Math.max(30, Math.round(s.durationSec * FPS)),
|
text: s.text,
|
||||||
label: s.label,
|
duration: Math.max(30, Math.round(s.durationSec * FPS)),
|
||||||
sentences: s.sentences || undefined,
|
label: s.label,
|
||||||
stat: extractStatData(s.text),
|
sentences: s.sentences || undefined,
|
||||||
}));
|
stat: extractStatData(s.text),
|
||||||
|
};
|
||||||
|
// AI-agent tips: force scene per label for the terminal/compare/bullets/bang
|
||||||
|
// variety (brands keep their own kinetic/caption mapping).
|
||||||
|
const L = (s.label || "").toUpperCase();
|
||||||
|
if (script.category === "ai-agent-tips") {
|
||||||
|
if (L === "HOOK") t.scene = "terminal";
|
||||||
|
else if (L === "THE MISTAKE" || L === "WHY IT FAILS") t.scene = "compare";
|
||||||
|
else if (L === "THE FIX") t.scene = "fix";
|
||||||
|
else if (L === "THE INSIGHT") t.scene = "bullets";
|
||||||
|
else if (L === "THE CONFLICT") t.scene = "bang";
|
||||||
|
else if (L === "CTA") t.scene = "cta";
|
||||||
|
}
|
||||||
|
return t;
|
||||||
|
});
|
||||||
|
|
||||||
// Inject source card scene — REPLACES the visual of the 2nd segment
|
// Inject source card scene — REPLACES the visual of the 2nd segment
|
||||||
// (story). Total timeline duration stays == audio duration, so the mux
|
// (story). Total timeline duration stays == audio duration, so the mux
|
||||||
|
|||||||
@@ -77,18 +77,18 @@ function extractStat(text: string): { value: string; label: string } | null {
|
|||||||
function pickScene(seg: Segment, index: number): Segment["scene"] | "caption" {
|
function pickScene(seg: Segment, index: number): Segment["scene"] | "caption" {
|
||||||
if (seg.scene) return seg.scene;
|
if (seg.scene) return seg.scene;
|
||||||
const label = (seg.label || "").toUpperCase();
|
const label = (seg.label || "").toUpperCase();
|
||||||
// AI-tips scenes: terminal hook, mistake→compare(✗), insight→bullet list,
|
// AI-tips scenes handled by worker override; here we only route the shared
|
||||||
// fix→compare(✓), bang for conflict.
|
// creative variety (bang for twist, bullets for insight) — HOOK stays title.
|
||||||
if (label === "THE MISTAKE" || label === "WHY IT FAILS") return "compare";
|
if (label === "THE MISTAKE" || label === "WHY IT FAILS") return "compare";
|
||||||
if (label === "THE FIX") return "fix";
|
if (label === "THE FIX") return "fix";
|
||||||
if (label === "THE INSIGHT") return "bullets";
|
if (label === "THE INSIGHT") return "bullets";
|
||||||
if (label === "HOOK") return "terminal";
|
if (label === "THE CONFLICT") return "bang";
|
||||||
|
if (label === "HOOK" || label === "ON SCREEN") return "title";
|
||||||
if (label === "CTA") return "cta";
|
if (label === "CTA") return "cta";
|
||||||
if (seg.source) return seg.source.type as "tweet" | "thread" | "news";
|
if (seg.source) return seg.source.type as "tweet" | "thread" | "news";
|
||||||
if (seg.stat) return "stat";
|
if (seg.stat) return "stat";
|
||||||
const stat = extractStat(seg.text);
|
const stat = extractStat(seg.text);
|
||||||
if (stat) return "stat";
|
if (stat) return "stat";
|
||||||
if (label === "THE CONFLICT") return "bang";
|
|
||||||
if (index % 3 === 2) return "title";
|
if (index % 3 === 2) return "title";
|
||||||
return "caption";
|
return "caption";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user