| 12345678910111213141516171819202122232425 |
- import { streamText } from "ai";
- import { getVideoPrompt } from "@/lib/catalog";
- export const maxDuration = 30;
- // Generate prompt from catalog - uses Remotion schema's prompt template with custom rules
- const SYSTEM_PROMPT = getVideoPrompt();
- const MAX_PROMPT_LENGTH = 500;
- const DEFAULT_MODEL = "anthropic/claude-haiku-4.5";
- export async function POST(req: Request) {
- const { prompt } = await req.json();
- const sanitizedPrompt = String(prompt || "").slice(0, MAX_PROMPT_LENGTH);
- const result = streamText({
- model: process.env.AI_GATEWAY_MODEL || DEFAULT_MODEL,
- system: SYSTEM_PROMPT,
- prompt: sanitizedPrompt,
- temperature: 0.7,
- });
- return result.toTextStreamResponse();
- }
|