Feat: UI helpers and prompt builders

This commit is contained in:
2026-03-20 21:14:36 -07:00
parent 85f7860f22
commit f7359ad1b2

18
assets/js/ui.js Normal file
View File

@@ -0,0 +1,18 @@
export const FIRST_PROMPT_TEMPLATE = "minimal black and white line doodle, single stroke, white background, kawaii style, {userPrompt}";
export function firstPrompt(userPrompt) {
return FIRST_PROMPT_TEMPLATE.replace("{userPrompt}", userPrompt);
}
export function nextFramePrompt(frameCount) {
return `imagine we are trying to create a ${frameCount} frame gif. generate the next meaningful frame`;
}
export function clampForm(form) {
form.frameCount = Math.min(24, Math.max(2, Number(form.frameCount || 4)));
form.fps = Math.min(24, Math.max(1, Number(form.fps || 6)));
if (form.model !== "google/gemini-3.1-flash-image-preview" && form.imageSize === "0.5K") {
form.imageSize = "1K";
}
}