Skip to content

Open source CapCut alternative.

TypeScript

feat(site): animate_reference renders the referenced image as the literal first frame [rebuild]

David Le8b6768d35fa6
diff --git a/site/src/cut/lib/aiTools.ts b/site/src/cut/lib/aiTools.ts
index a9e47d1d..1a2218f0 100644
--- a/site/src/cut/lib/aiTools.ts
+++ b/site/src/cut/lib/aiTools.ts
@@ -624,6 +624,22 @@ export async function runAiTool(
? { resolution: input.resolution }
: {}),
};
+ // "Animate this image": the referenced frame is the product, so it seeds
+ // the render untouched — no image-model redesign in between.
+ if (refs.length > 0 && input.animate_reference === true) {
+ return {
+ ...launchVeoJob(projectId, prompt, input, {
+ ...veoOpts,
+ refs: [refs[0]],
+ composeRefs: false,
+ // The most Veo permits with an image input; the seed carries the
+ // subject, so a person-safety downgrade beats losing it.
+ personGeneration: "ALLOW_ADULT",
+ }),
+ note:
+ "Animating the referenced image as the literal opening frame — the clip previews in this chat when it lands, in a minute or two.",
+ };
+ }
// Staged, like the scene pipeline: reference work happens in the image
// model first — it holds identity far better than any video model — and
// the video model then animates the approved frame. The still lands as
diff --git a/site/src/cut/server/ai/catalog.ts b/site/src/cut/server/ai/catalog.ts
index ba0b36e4..424606d5 100644
--- a/site/src/cut/server/ai/catalog.ts
+++ b/site/src/cut/server/ai/catalog.ts
@@ -287,7 +287,7 @@ export const AI_TOOLS: AiToolDef[] = [
{
name: "generate_video",
description:
- "Generate an AI video clip from a text prompt (Donkey's hosted Veo model) — the default for any video ask: \"generate/make a video of/about X\" means ONE clip from this tool, even though it sounds whole. Reach for generate_scene only when they name a narrated multi-shot production (a story, episode, or narrated short). When the user asks you to write or improve the prompt itself, put it in chat and wait for them to ask for the video. reference_asset_id anchors the render on one project image or video: the tool first designs the opening frame from it with the image model (that still previews in this chat), then animates that exact frame — so tell the user it designs the frame, then renders. The render takes a minute or two and the tool RETURNS as soon as it's started — the clip previews as a live card in this chat when it finishes. Pass add_to_timeline:true (or an index) only when they asked for it in the cut; otherwise the user drags it in from the card. Needs the user signed in to Donkey (spends their credits).",
+ "Generate an AI video clip from a text prompt (Donkey's hosted Veo model) — the default for any video ask: \"generate/make a video of/about X\" means ONE clip from this tool, even though it sounds whole. Reach for generate_scene only when they name a narrated multi-shot production (a story, episode, or narrated short). When the user asks you to write or improve the prompt itself, put it in chat and wait for them to ask for the video. reference_asset_id anchors the render on one project image or video: by default the tool first designs the opening frame from it with the image model (that still previews in this chat), then animates that exact frame — so tell the user it designs the frame, then renders. When the user wants the referenced image itself brought to life (\"animate this image/picture\"), pass animate_reference:true — the image becomes the literal first frame, unchanged, and the prompt describes only the motion. The render takes a minute or two and the tool RETURNS as soon as it's started — the clip previews as a live card in this chat when it finishes. Pass add_to_timeline:true (or an index) only when they asked for it in the cut; otherwise the user drags it in from the card. Needs the user signed in to Donkey (spends their credits).",
inputSchema: obj({
prompt: str("The shot to generate — describe motion, subject, and mood"),
tier: { type: "string", enum: ["fast", "high"], description: "fast = quicker/cheaper (default), high = best quality" },
@@ -295,6 +295,7 @@ export const AI_TOOLS: AiToolDef[] = [
aspect: { type: "string", enum: ["16:9", "9:16"], description: "Clip shape (default: the project aspect)" },
resolution: { type: "string", enum: ["720p", "1080p"], description: "Output detail (default 720p)" },
reference_asset_id: str("One project asset id (image or video) the clip's opening frame is designed from"),
+ animate_reference: bool("The referenced image IS the opening frame: animate it directly, unchanged, skipping the frame-design step (use when the user says to animate that image)"),
add_to_timeline: bool("Insert the clip on the video track when it lands (default false — it stays on its chat card until the user asks)"),
index: num("Insert position on the video track (passing it implies add_to_timeline)"),
}, ["prompt"]),
@@ -740,7 +741,7 @@ Rules:
- First decide what the user wants handed back: an edit to the project, or words in chat. "Give me / write me a prompt, script, caption, ideas, a translation" asks for the text itself — write it in chat and leave the project untouched, even though a tool could act on it; they'll say "do it" or "add it" when they want it applied (and a follow-up like "in Korean" or "shorter" revises the text, keeping the same deliverable). A complaint or observation ("ugh, this is cluttered") is words too: sympathize, offer what you could do, and touch nothing until they say go. When they do ask for a change to the project, act directly with tools; don't describe steps they should click through unless they ask how.
- Use ids exactly as given in the state, and act on what your tools return — each reports what it changed, so batch independent edits into one step and call get_state only when the snapshot is stale or a result surprised you.
- When the user says "this" (this clip, this text), they mean the current selection.
-- Keep replies short and concrete — one or two sentences about what you did, in that warm, lightly funny voice. You have no name and never name the app; greet with a short "How can I help?" / "What would you like to do?". No headings, no fluff.
+- Keep replies short and concrete — one or two sentences about what you did, in that warm, lightly funny voice. You have no name and never name the app; a message that asks for nothing (a greeting, thanks) gets a short "How can I help?" / "What would you like to do?" back — words alone, no tool calls. No headings, no fluff.
- Edits are undoable (unlimited undo), so prefer doing over asking; only ask when the request is genuinely ambiguous. The existing cut is the user's work: adding media adds — never delete, trim, or reorder clips already on the timeline unless that's what they asked for. Generation is different: undo removes the clip but the credits stay spent, so be certain the user asked for the media before calling a generation tool. Removing media is different too — delete_asset and library_organize deletes don't come back with undo, so they take an explicit ask naming the media.
- Times are seconds. The frame is the project's aspect: 1080×1920 (9:16) or 1920×1080 (16:9) — see project.aspect in editor_state.
- Read list_skills / read_skill before working in an area you're unsure about — they document every setting.