From 005d9880e6b4ca2ac5678254efa17f50ba083267 Mon Sep 17 00:00:00 2001 From: asepharyana Date: Tue, 22 Sep 2026 22:42:29 +0700 Subject: [PATCH] =?UTF-8?q?feat(shorts):=20worker=20force=20scenes=20for?= =?UTF-8?q?=20AI-tips=20=E2=80=94=20terminal/compare/fix/bullets/bang?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/render-worker.mjs | 28 +++++++++++++++++++++------- src/remotion/ShortsVideo.tsx | 8 ++++---- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/scripts/render-worker.mjs b/scripts/render-worker.mjs index 5a261c1..8a4f1aa 100644 --- a/scripts/render-worker.mjs +++ b/scripts/render-worker.mjs @@ -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 diff --git a/src/remotion/ShortsVideo.tsx b/src/remotion/ShortsVideo.tsx index 5400f97..1927c87 100644 --- a/src/remotion/ShortsVideo.tsx +++ b/src/remotion/ShortsVideo.tsx @@ -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"; }