Skip to content

Commit 753c1d1

Browse files
authored
fix(remotion): include props in generatePrompt output (#249)
The Remotion schema defines props on composition entries, but generatePrompt did not include those props in its output. As a result, the model had no knowledge of the expected prop shape when generating JSON, causing runtime failures when prop names didn't match the component's expected interface. Changes: - Import zod type for TypeScript support - Extract formatZodType from PromptContext - Add props field to component type definition - Include formatted props string in component description Fixes #224
1 parent 9adcc09 commit 753c1d1

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

packages/remotion/src/schema.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { defineSchema, type PromptContext } from "@json-render/core";
2+
import type { z } from "zod";
23

34
/**
45
* Prompt template for Remotion timeline generation
56
*
67
* Uses JSONL patch format (same as React) but builds up a timeline spec structure.
78
*/
89
function remotionPromptTemplate(context: PromptContext): string {
9-
const { catalog, options } = context;
10+
const { catalog, options, formatZodType } = context;
1011
const { system = "You are a video timeline generator.", customRules = [] } =
1112
options;
1213

@@ -37,7 +38,7 @@ function remotionPromptTemplate(context: PromptContext): string {
3738
const catalogData = catalog as {
3839
components?: Record<
3940
string,
40-
{ description?: string; defaultDuration?: number }
41+
{ description?: string; defaultDuration?: number; props?: z.ZodType }
4142
>;
4243
transitions?: Record<string, { description?: string }>;
4344
effects?: Record<string, { description?: string }>;
@@ -52,8 +53,9 @@ function remotionPromptTemplate(context: PromptContext): string {
5253
const duration = def.defaultDuration
5354
? ` [default: ${def.defaultDuration} frames]`
5455
: "";
56+
const propsStr = def.props ? ` ${formatZodType(def.props)}` : "";
5557
lines.push(
56-
`- ${name}: ${def.description || "No description"}${duration}`,
58+
`- ${name}:${propsStr} ${def.description || "No description"}${duration}`,
5759
);
5860
}
5961
lines.push("");

0 commit comments

Comments
 (0)