From f7359ad1b20d1fe73c53dc9c9db5b4a1c111e6d9 Mon Sep 17 00:00:00 2001 From: multipleof4 Date: Fri, 20 Mar 2026 21:14:36 -0700 Subject: [PATCH] Feat: UI helpers and prompt builders --- assets/js/ui.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 assets/js/ui.js diff --git a/assets/js/ui.js b/assets/js/ui.js new file mode 100644 index 0000000..f67050c --- /dev/null +++ b/assets/js/ui.js @@ -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"; + } +}