feat(shorts): worker force scenes for AI-tips — terminal/compare/fix/bullets/bang
This commit is contained in:
@@ -237,13 +237,27 @@ async function renderScript(script) {
|
||||
}
|
||||
|
||||
// 3. Remotion timeline (frames)
|
||||
const timeline = voiced.map((s) => ({
|
||||
text: s.text,
|
||||
duration: Math.max(30, Math.round(s.durationSec * FPS)),
|
||||
label: s.label,
|
||||
sentences: s.sentences || undefined,
|
||||
stat: extractStatData(s.text),
|
||||
}));
|
||||
const timeline = voiced.map((s) => {
|
||||
const t = {
|
||||
text: s.text,
|
||||
duration: Math.max(30, Math.round(s.durationSec * FPS)),
|
||||
label: s.label,
|
||||
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
|
||||
// (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" {
|
||||
if (seg.scene) return seg.scene;
|
||||
const label = (seg.label || "").toUpperCase();
|
||||
// AI-tips scenes: terminal hook, mistake→compare(✗), insight→bullet list,
|
||||
// fix→compare(✓), bang for conflict.
|
||||
// AI-tips scenes handled by worker override; here we only route the shared
|
||||
// creative variety (bang for twist, bullets for insight) — HOOK stays title.
|
||||
if (label === "THE MISTAKE" || label === "WHY IT FAILS") return "compare";
|
||||
if (label === "THE FIX") return "fix";
|
||||
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 (seg.source) return seg.source.type as "tweet" | "thread" | "news";
|
||||
if (seg.stat) return "stat";
|
||||
const stat = extractStat(seg.text);
|
||||
if (stat) return "stat";
|
||||
if (label === "THE CONFLICT") return "bang";
|
||||
if (index % 3 === 2) return "title";
|
||||
return "caption";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user