The VS Code of video editing, built for agents.
TypeScript
Refactor generation configuration and type handling
konstantin-pauluse3af57b13671
diff --git a/apps/web/src/components/genai/action-bar.tsx b/apps/web/src/components/genai/action-bar.tsxindex 79f21405..467547c8 100644--- a/apps/web/src/components/genai/action-bar.tsx+++ b/apps/web/src/components/genai/action-bar.tsx@@ -19,10 +19,10 @@ import { useGenerate } from "./use-generate";import { useAutoCaptions } from "./use-auto-captions";import { useMediaSelection } from "./selection";import { useTransforms } from "./use-transforms";-import { createDefaultConfig } from "./prompt-input";+import { createDefaultConfig } from "./requests";import { toast } from "somoto";-import type { GenerationConfig } from "./schemas";+import type { GenerationConfig } from "./types";interface ActionBarProps {openPromptInput?(config: GenerationConfig): void;diff --git a/apps/web/src/components/genai/config.ts b/apps/web/src/components/genai/config.tsindex acc00c83..216461df 100644--- a/apps/web/src/components/genai/config.ts+++ b/apps/web/src/components/genai/config.ts@@ -36,9 +36,6 @@ export const MODEL_MODES: Record<ModelId, PromptMode | "TEXT"> = {export type PromptMode = "IMAGE" | "VIDEO" | "VOICE" | "AUDIO";-/** The one model the voice mode speaks with; the UI picks the voice, not the model. */-export const PROMPT_INPUT_VOICE_MODEL = "elevenlabs-v3" satisfies ModelId;-/** What an aspect ratio is worth in pixels, at 1080p. */export const ASPECT_RATIO_DIMENSIONS: Record<string, { width: number; height: number }> = {"16:9": { width: 1920, height: 1080 },@@ -48,22 +45,17 @@ export const ASPECT_RATIO_DIMENSIONS: Record<string, { width: number; height: nu"3:4": { width: 1080, height: 1440 },};-export const PROMPT_INPUT_MODE_OPTIONS = [+export const PROMPT_INPUT_MODE_OPTIONS: { value: PromptMode; label: string; icon: string }[] = [{ value: "IMAGE", label: "Image", icon: "image" },{ value: "VIDEO", label: "Video", icon: "film-video-export" },{ value: "VOICE", label: "Voice", icon: "voice" },{ value: "AUDIO", label: "Audio", icon: "audio" },];-export const PROMPT_INPUT_IMAGE_ASPECT_RATIO_OPTIONS = [- { value: "16:9", label: "16:9 \u00B7 Wide", triggerLabel: "16:9", icon: "aspect-ratio-16-9" },- { value: "9:16", label: "9:16 \u00B7 Vertical", triggerLabel: "9:16", icon: "aspect-ratio-9-16" },- { value: "1:1", label: "1:1 \u00B7 Square", triggerLabel: "1:1", icon: "aspect-ratio-1-1" },- { value: "4:3", label: "4:3 \u00B7 Classic", triggerLabel: "4:3", icon: "aspect-ratio-4-3" },- { value: "3:4", label: "3:4 \u00B7 Tall", triggerLabel: "3:4", icon: "aspect-ratio-3-4" },-];+/** The aspect ratios the prompt box offers; a model may take fewer. */+export type AspectRatio = "16:9" | "9:16" | "1:1" | "4:3" | "3:4";-export const ALL_VIDEO_ASPECT_RATIO_OPTIONS = [+export const ASPECT_RATIO_OPTIONS: { value: AspectRatio; label: string; triggerLabel: string; icon: string }[] = [{ value: "16:9", label: "16:9 \u00B7 Wide", triggerLabel: "16:9", icon: "aspect-ratio-16-9" },{ value: "9:16", label: "9:16 \u00B7 Vertical", triggerLabel: "9:16", icon: "aspect-ratio-9-16" },{ value: "1:1", label: "1:1 \u00B7 Square", triggerLabel: "1:1", icon: "aspect-ratio-1-1" },@@ -71,29 +63,6 @@ export const ALL_VIDEO_ASPECT_RATIO_OPTIONS = [{ value: "3:4", label: "3:4 \u00B7 Tall", triggerLabel: "3:4", icon: "aspect-ratio-3-4" },];-export const PROMPT_INPUT_VARIANT_COUNT_OPTIONS = [- { value: "1", label: "1" },- { value: "2", label: "2" },- { value: "3", label: "3" },- { value: "4", label: "4" },-];--export const ALL_DURATION_OPTIONS = [- { value: "3s", label: "3s" },- { value: "4s", label: "4s" },- { value: "5s", label: "5s" },- { value: "6s", label: "6s" },- { value: "7s", label: "7s" },- { value: "8s", label: "8s" },- { value: "9s", label: "9s" },- { value: "10s", label: "10s" },- { value: "11s", label: "11s" },- { value: "12s", label: "12s" },- { value: "13s", label: "13s" },- { value: "14s", label: "14s" },- { value: "15s", label: "15s" },-];-export const PROMPT_INPUT_RESOLUTION_OPTIONS = [{ value: "4K", label: "4K" },{ value: "1440p", label: "1440p" },@@ -101,138 +70,6 @@ export const PROMPT_INPUT_RESOLUTION_OPTIONS = [{ value: "720p", label: "720p" },];-export type ImageModelOption = {- name: string;- id: ModelId;- icon: string;- description: string;- maxReferences: number;-};--export const PROMPT_INPUT_IMAGE_MODEL_OPTIONS: ImageModelOption[] = [- {- name: "FLUX.2 Klein",- id: "flux-2-klein",- icon: "large-bfl",- description: "Low budget, high quality, fast.",- maxReferences: 4,- },- {- name: "GPT Image 2",- id: "gpt-image-2",- icon: "large-openai",- description: "Flexible sizes up to 4K, true aspect ratios.",- maxReferences: 16,- },- {- name: "Nano Banana 2",- id: "nano-banana-2",- icon: "large-google",- description: "Fast, high quality, flexible edits.",- maxReferences: 14,- },- {- name: "Nano Banana Pro",- id: "nano-banana-pro",- icon: "large-google",- description: "Pro control, readable text, ultra consistent.",- maxReferences: 14,- },- {- name: "Seedream 4.5",- id: "seedream-4.5",- icon: "large-bytedance",- description: "Up to 4K, multi image edits, strong text.",- maxReferences: 14,- },-];--/**- * What a video model takes besides the prompt: a first and a last frame, and- * a switch for the sound it makes (models without one score their video- * themselves, or not at all).- */-export type VideoModelFeature = "start-frame" | "end-frame" | "audio";--export type VideoModelOption = {- name: string;- id: ModelId;- icon: string;- description: string;- features: VideoModelFeature[];- durations: string[];- /** Empty for a model that takes its proportions from the start frame. */- aspectRatios: string[];-};--const seconds = (from: number, to: number) => Array.from({ length: to - from + 1 }, (_, i) => `${from + i}s`);--export const PROMPT_INPUT_VIDEO_MODEL_OPTIONS: VideoModelOption[] = [- {- name: "Kling 3.0",- id: "kling-3-pro",- icon: "large-kling",- description: "Cinematic motion with built-in audio.",- features: ["start-frame", "end-frame", "audio"],- durations: seconds(3, 15),- aspectRatios: ["16:9", "9:16", "1:1"],- },- {- name: "Kling 3.0 Omni",- id: "kling-o3-pro",- icon: "large-kling",- description: "Multi-modal reasoning, strong scenes.",- features: ["start-frame", "audio"],- durations: seconds(3, 15),- aspectRatios: [],- },- {- name: "Seedance 2.0",- id: "seedance-2.0",- icon: "large-bytedance",- description: "Rich motion, lip-synced audio and SFX.",- features: ["start-frame", "end-frame"],- durations: seconds(4, 15),- aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],- },- {- name: "Veo 3.1",- id: "veo-3.1",- icon: "large-google",- description: "Realistic physics, complex scenes.",- features: ["start-frame", "end-frame"],- durations: ["4s", "6s", "8s"],- aspectRatios: ["16:9", "9:16"],- },- {- name: "Veo 3.1 Fast",- id: "veo-3.1-fast",- icon: "large-google",- description: "Same Veo engine, lower cost.",- features: ["start-frame", "end-frame"],- durations: ["4s", "6s", "8s"],- aspectRatios: ["16:9", "9:16"],- },- {- name: "Wan 2.6",- id: "wan-2.6",- icon: "large-wan",- description: "Expressive motion, stylized aesthetics.",- features: ["start-frame"],- durations: ["5s", "10s"],- aspectRatios: ["16:9", "9:16"],- },- {- name: "Hailuo 3 Max",- id: "hailuo-3-max",- icon: "large-hailuo",- description: "Smooth motion, cinematic lighting.",- features: ["start-frame", "end-frame"],- durations: seconds(5, 15),- aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],- },-];-export const PROMPT_INPUT_VOICE_OPTIONS = [{value: "CwhRBWXzGAHq8TQ4Fs17",@@ -397,17 +234,176 @@ export const PROMPT_INPUT_VOICE_OPTIONS = [},];-export const PROMPT_INPUT_AUDIO_MODEL_OPTIONS: { name: string; id: ModelId; icon: string; description: string }[] = [+export type VoiceOption = (typeof PROMPT_INPUT_VOICE_OPTIONS)[number];++/**+ * A model the prompt box makes requests with, and the settings it takes: a+ * setting the model declares is offered (within the values given), one it+ * leaves out is neither offered nor sent. The settings are the API's request+ * fields, so a config becomes a request without knowing the model (see+ * `requests.ts`).+ */+export interface ModelOption {+ id: ModelId;+ mode: PromptMode;+ name: string;+ icon: string;+ description: string;+ /** Empty for a model that takes its proportions from the start frame. */+ aspectRatios?: AspectRatio[];+ /** Images per generation. */+ counts?: number[];+ /** Seconds. */+ durations?: number[];+ voices?: VoiceOption[];+ /** How many reference images the model takes. */+ references?: number;+ /** The frames a video can be made to start or end on. */+ frames?: ("start" | "end")[];+}++const ALL_ASPECT_RATIOS = ASPECT_RATIO_OPTIONS.map((option) => option.value);+const seconds = (from: number, to: number) => Array.from({ length: to - from + 1 }, (_, i) => from + i);++const image = { mode: "IMAGE", aspectRatios: ALL_ASPECT_RATIOS, counts: [1, 2, 3, 4] } satisfies Partial<ModelOption>;+const video = { mode: "VIDEO" } satisfies Partial<ModelOption>;++export const MODEL_OPTIONS: ModelOption[] = [+ {+ ...image,+ id: "flux-2-klein",+ name: "FLUX.2 Klein",+ icon: "large-bfl",+ description: "Low budget, high quality, fast.",+ references: 4,+ },+ {+ ...image,+ id: "gpt-image-2",+ name: "GPT Image 2",+ icon: "large-openai",+ description: "Flexible sizes up to 4K, true aspect ratios.",+ references: 16,+ },+ {+ ...image,+ id: "nano-banana-2",+ name: "Nano Banana 2",+ icon: "large-google",+ description: "Fast, high quality, flexible edits.",+ references: 14,+ },+ {+ ...image,+ id: "nano-banana-pro",+ name: "Nano Banana Pro",+ icon: "large-google",+ description: "Pro control, readable text, ultra consistent.",+ references: 14,+ },+ {+ ...image,+ id: "seedream-4.5",+ name: "Seedream 4.5",+ icon: "large-bytedance",+ description: "Up to 4K, multi image edits, strong text.",+ references: 14,+ },+ {+ ...video,+ id: "kling-3-pro",+ name: "Kling 3.0",+ icon: "large-kling",+ description: "Cinematic motion with built-in audio.",+ frames: ["start", "end"],+ durations: seconds(3, 15),+ aspectRatios: ["16:9", "9:16", "1:1"],+ },+ {+ ...video,+ id: "kling-o3-pro",+ name: "Kling 3.0 Omni",+ icon: "large-kling",+ description: "Multi-modal reasoning, strong scenes.",+ frames: ["start"],+ durations: seconds(3, 15),+ },+ {+ ...video,+ id: "seedance-2.0",+ name: "Seedance 2.0",+ icon: "large-bytedance",+ description: "Rich motion, lip-synced audio and SFX.",+ frames: ["start", "end"],+ durations: seconds(4, 15),+ aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],+ },+ {+ ...video,+ id: "veo-3.1",+ name: "Veo 3.1",+ icon: "large-google",+ description: "Realistic physics, complex scenes.",+ frames: ["start", "end"],+ durations: [4, 6, 8],+ aspectRatios: ["16:9", "9:16"],+ },+ {+ ...video,+ id: "veo-3.1-fast",+ name: "Veo 3.1 Fast",+ icon: "large-google",+ description: "Same Veo engine, lower cost.",+ frames: ["start", "end"],+ durations: [4, 6, 8],+ aspectRatios: ["16:9", "9:16"],+ },+ {+ ...video,+ id: "wan-2.6",+ name: "Wan 2.6",+ icon: "large-wan",+ description: "Expressive motion, stylized aesthetics.",+ frames: ["start"],+ durations: [5, 10],+ aspectRatios: ["16:9", "9:16"],+ },+ {+ ...video,+ id: "hailuo-3-max",+ name: "Hailuo 3 Max",+ icon: "large-hailuo",+ description: "Smooth motion, cinematic lighting.",+ frames: ["start", "end"],+ durations: seconds(5, 15),+ aspectRatios: ["16:9", "9:16", "1:1", "4:3", "3:4"],+ },+ {+ id: "elevenlabs-v3",+ mode: "VOICE",+ name: "ElevenLabs v3",+ icon: "large-elevenlabs",+ description: "Expressive speech in many voices.",+ voices: PROMPT_INPUT_VOICE_OPTIONS,+ },{- name: "ElevenLabs Music",id: "elevenlabs-music",+ mode: "AUDIO",+ name: "ElevenLabs Music",icon: "large-elevenlabs",description: "Full compositions, stems, and lyrics.",},{- name: "ElevenLabs SFX",id: "elevenlabs-sfx",+ mode: "AUDIO",+ name: "ElevenLabs SFX",icon: "large-elevenlabs",description: "Sound effects up to 30s, seamless looping.",},];++/** The models the prompt box offers in `mode`, the first one by default. */+export const modelOptions = (mode: PromptMode) => MODEL_OPTIONS.filter((option) => option.mode === mode);++/** The prompt box's option for `id`; undefined for a model it doesn't make requests with (tools, text). */+export const modelOption = (id: ModelId) => MODEL_OPTIONS.find((option) => option.id === id);diff --git a/apps/web/src/components/genai/prompt-input-actions.tsx b/apps/web/src/components/genai/prompt-input-actions.tsxindex eb2ddd2a..b4fc4416 100644--- a/apps/web/src/components/genai/prompt-input-actions.tsx+++ b/apps/web/src/components/genai/prompt-input-actions.tsx@@ -22,7 +22,7 @@ import { useGenerate } from "./use-generate";import { useMediaSelection } from "./selection";import { useTransforms } from "./use-transforms";-import type { TransformType } from "./schemas";+import type { TransformType } from "./types";export function PromptInputActions() {const { isGenerated, totalCredits, firstJob } = useGenerationRecords();diff --git a/apps/web/src/components/genai/prompt-input.tsx b/apps/web/src/components/genai/prompt-input.tsxindex a299df60..f4a04849 100644--- a/apps/web/src/components/genai/prompt-input.tsx+++ b/apps/web/src/components/genai/prompt-input.tsx@@ -31,31 +31,20 @@ import {} from "solid-js";import {- PROMPT_INPUT_IMAGE_MODEL_OPTIONS,- PROMPT_INPUT_VIDEO_MODEL_OPTIONS,- PROMPT_INPUT_VOICE_MODEL,- PROMPT_INPUT_VOICE_OPTIONS,+ ASPECT_RATIO_OPTIONS,PROMPT_INPUT_MODE_OPTIONS,- PROMPT_INPUT_IMAGE_ASPECT_RATIO_OPTIONS,- PROMPT_INPUT_VARIANT_COUNT_OPTIONS,- ALL_VIDEO_ASPECT_RATIO_OPTIONS,- ALL_DURATION_OPTIONS,- PROMPT_INPUT_AUDIO_MODEL_OPTIONS,+ modelOption,+ modelOptions,// PROMPT_INPUT_RESOLUTION_OPTIONS+ type AspectRatio,type PromptMode,} from "./config";+import { createDefaultConfig, fitToModel } from "./requests";import { createStoredSignal } from "@/lib/store";import { store } from "@/init";import { useGenerate } from "./use-generate";import { PromptInputActions } from "./prompt-input-actions";-import type {- AspectRatio,- GenerationConfig,- ImageGenerationConfig,- VideoGenerationConfig,- VoiceGenerationConfig,- AudioGenerationConfig,-} from "./schemas";+import type { GenerationConfig } from "./types";import { AssetThumbnail } from "@/components/ui/asset-thumbnail";import { useLibrary } from "@/engine/library";import { useEditor } from "@/engine/hooks";@@ -63,57 +52,15 @@ import { droppedFiles, importFiles, pickFiles } from "@/engine/asset-actions";import { useMediaSelection } from "./selection";import { ASSET_DRAG_TYPE } from "@/components/sidebar-left/folder-item";+import type { ModelId } from "@diffusionstudio/api-contract";import type { AssetCache } from "@diffusionstudio/assets";import type { ThumbnailAsset } from "@/components/ui/asset-thumbnail";-export type PromptInputMode = PromptMode;const DEFAULT_BUTTON_CLASS = "text-muted-foreground gap-0 pr-2 pl-0";/** As many references as the prompt box has room for; a model may take fewer. */const MAX_IMAGE_REFERENCES = 5;-type GenerationConfgs = {- IMAGE: ImageGenerationConfig;- VIDEO: VideoGenerationConfig;- VOICE: VoiceGenerationConfig;- AUDIO: AudioGenerationConfig;-};--export function createDefaultConfig<K extends keyof GenerationConfgs>(mode: K, prompt = ""): GenerationConfgs[K] {- switch (mode) {- case "IMAGE":- return {- mode: "IMAGE",- model: PROMPT_INPUT_IMAGE_MODEL_OPTIONS[0].id,- prompt,- aspectRatio: "16:9",- count: 1,- } as GenerationConfgs[K];- case "VIDEO":- return {- mode: "VIDEO",- model: PROMPT_INPUT_VIDEO_MODEL_OPTIONS[0].id,- prompt,- aspectRatio: "16:9",- duration: 6,- generateAudio: true,- } as GenerationConfgs[K];- case "VOICE":- return {- mode: "VOICE",- model: PROMPT_INPUT_VOICE_MODEL,- prompt,- voice: PROMPT_INPUT_VOICE_OPTIONS[0].value,- } as GenerationConfgs[K];- case "AUDIO":- return {- mode: "AUDIO",- model: PROMPT_INPUT_AUDIO_MODEL_OPTIONS[0].id,- prompt,- } as GenerationConfgs[K];- }-}-export interface PromptInputProps {initialConfig?: GenerationConfig;}@@ -134,52 +81,33 @@ export function PromptInput(props: PromptInputProps) {/** Shallow-merge updates into the current config. */const patch = (updates: Partial<GenerationConfig>) => {- setConfig((prev) => ({ ...prev, ...updates }) as GenerationConfig);+ setConfig((prev) => ({ ...prev, ...updates }));};const mode = () => config().mode;const prompt = () => config().prompt;- // These are only read inside their matching <Match when={mode() === …}>- // blocks, so the narrowing is sound.- const imageConfig = () => {- const c = config();- return c.mode === "IMAGE" ? c : undefined;- };- const videoConfig = () => {- const c = config();- return c.mode === "VIDEO" ? c : undefined;- };- const voiceConfig = () => {- const c = config();- return c.mode === "VOICE" ? c : undefined;- };+ /** The model and the settings it takes: what the prompt box offers. */+ const option = createMemo(() => modelOption(config().model) ?? modelOptions(mode())[0]!);+ const options = createMemo(() => modelOptions(mode()));+ const modeLabel = () => PROMPT_INPUT_MODE_OPTIONS.find((o) => o.value === mode())?.label.toLowerCase();- const maxImageReferences = createMemo(() => Math.min(- MAX_IMAGE_REFERENCES,- PROMPT_INPUT_IMAGE_MODEL_OPTIONS.find((m) => m.id === config().model)?.maxReferences ?? MAX_IMAGE_REFERENCES,- ));+ const maxImageReferences = createMemo(() => Math.min(MAX_IMAGE_REFERENCES, option().references ?? 0));- const currentVideoModel = createMemo(() =>- PROMPT_INPUT_VIDEO_MODEL_OPTIONS.find((m) => m.id === config().model),+ const aspectRatioOptions = createMemo(() =>+ ASPECT_RATIO_OPTIONS.filter((o) => option().aspectRatios?.includes(o.value)),+ );+ const countOptions = createMemo(() => (option().counts ?? []).map((n) => ({ value: String(n), label: String(n) })));+ const durationOptions = createMemo(() =>+ (option().durations ?? []).map((seconds) => ({ value: String(seconds), label: `${seconds}s` })),);-- const videoDurationOptions = createMemo(() => {- const model = currentVideoModel();- return model ? ALL_DURATION_OPTIONS.filter((o) => model.durations.includes(o.value)) : [];- });-- const videoAspectRatioOptions = createMemo(() => {- const model = currentVideoModel();- return model ? ALL_VIDEO_ASPECT_RATIO_OPTIONS.filter((o) => model.aspectRatios.includes(o.value)) : [];- });// Pictures on the canvas are offered as references and as video frames:// selecting one is another way of attaching it.const effectiveImageRefIds = createMemo(() => {const lib = library();if (!lib) return [];- const local = imageConfig()?.imageRefIds ?? [];+ const local = config().imageRefIds ?? [];const selected = selectedImages().map((entry) => entry.asset.id).filter((id) => !local.includes(id));@@ -193,11 +121,10 @@ export function PromptInput(props: PromptInputProps) {// A frame the model cannot take is not one the prompt box offers, and// not one a canvas selection quietly attaches either: the declaration is// checked against the model before it runs.- if (!currentVideoModel()?.features.includes(`${frame}-frame`)) return null;+ if (!option().frames?.includes(frame)) return null;const lib = library();- const config = videoConfig();- const explicit = frame === "start" ? config?.startFrameImageId : config?.endFrameImageId;+ const explicit = frame === "start" ? config().startFrameImageId : config().endFrameImageId;const id = explicit ?? selectedImages()[frame === "start" ? 0 : 1]?.asset.id ?? null;return id && lib?.get(id) ? id : null;};@@ -226,13 +153,13 @@ export function PromptInput(props: PromptInputProps) {};const handleModeChange = (value: string) => {- const newMode = value as PromptInputMode;+ const newMode = value as PromptMode;if (newMode === mode()) return;setConfig(createDefaultConfig(newMode, prompt()));};const removeImageReference = (assetId: string) => {- const refs = imageConfig()?.imageRefIds ?? [];+ const refs = config().imageRefIds ?? [];if (refs.includes(assetId)) {patch({ imageRefIds: refs.filter((id) => id !== assetId) });return;@@ -254,7 +181,7 @@ export function PromptInput(props: PromptInputProps) {// `importFiles` reports its own failures.const imported = await importFiles(lib, files, "");const imageAssets = imported.filter((a) => a.type === "IMAGE");- const current = imageConfig()?.imageRefIds ?? [];+ const current = config().imageRefIds ?? [];patch({imageRefIds: [...current, ...imageAssets.map((a) => a.id)].slice(0, maxImageReferences()),});@@ -275,16 +202,12 @@ export function PromptInput(props: PromptInputProps) {};const swapVideoFrameImages = () => {- const c = videoConfig();- patch({- startFrameImageId: c?.endFrameImageId,- endFrameImageId: c?.startFrameImageId,- });+ const c = config();+ patch({ startFrameImageId: c.endFrameImageId, endFrameImageId: c.startFrameImageId });};const clearVideoFrame = (frame: "start" | "end") => {- const explicitId =- frame === "start" ? videoConfig()?.startFrameImageId : videoConfig()?.endFrameImageId;+ const explicitId = frame === "start" ? config().startFrameImageId : config().endFrameImageId;if (explicitId) {patch(frame === "start" ? { startFrameImageId: undefined } : { endFrameImageId: undefined });return;@@ -327,24 +250,14 @@ export function PromptInput(props: PromptInputProps) {patch({ prompt: "" });resizeTextarea();- let submitted: GenerationConfig;-- if (currentConfig.mode === "IMAGE") {- submitted = {- ...currentConfig,- imageRefIds: effectiveImageRefIds(),- };- } else if (currentConfig.mode === "VIDEO") {- submitted = {- ...currentConfig,- startFrameImageId: effectiveStartFrameId() || undefined,- endFrameImageId: effectiveEndFrameId() || undefined,- };- } else {- submitted = currentConfig;- }-- generate(submitted);+ // What the model takes of the selection: none of it for a model without+ // references or frames (see `maxImageReferences`, `frameId`).+ generate({+ ...currentConfig,+ imageRefIds: effectiveImageRefIds(),+ startFrameImageId: effectiveStartFrameId() ?? undefined,+ endFrameImageId: effectiveEndFrameId() ?? undefined,+ });};const handleKeyDown = (e: KeyboardEvent) => {@@ -399,7 +312,7 @@ export function PromptInput(props: PromptInputProps) {dragCounter = 0;setIsDragging(false);- if (mode() !== "IMAGE" && mode() !== "VIDEO") return;+ if (maxImageReferences() === 0 && !option().frames) return;const lib = library();if (!lib) return;@@ -420,48 +333,32 @@ export function PromptInput(props: PromptInputProps) {const imageIds = droppedIds.filter((id) => lib.get(id)?.type === "IMAGE");if (imageIds.length === 0) return;- if (mode() === "VIDEO") {- const c = videoConfig();- if (!c?.startFrameImageId && imageIds[0]) {+ if (option().frames) {+ const c = config();+ if (!c.startFrameImageId && imageIds[0]) {patch({ startFrameImageId: imageIds[0] });}- if (!c?.endFrameImageId && imageIds[1]) {+ if (!c.endFrameImageId && imageIds[1] && option().frames?.includes("end")) {patch({ endFrameImageId: imageIds[1] });}return;}- const current = imageConfig()?.imageRefIds ?? [];+ const current = config().imageRefIds ?? [];patch({ imageRefIds: [...current, ...imageIds].slice(0, maxImageReferences()) });};- const handleVideoModelChange = (id: string) => {- const model = PROMPT_INPUT_VIDEO_MODEL_OPTIONS.find((m) => m.id === id);- if (!model) return;-- const c = videoConfig() ?? createDefaultConfig("VIDEO");- const durationStr = `${c.duration}s`;-- setConfig({- ...c,- model: id,- endFrameImageId: model.features.includes("end-frame") ? c.endFrameImageId : undefined,- generateAudio: model.features.includes("audio") ? (c.generateAudio ?? true) : false,- duration: model.durations.includes(durationStr) ? c.duration : parseInt(model.durations[0], 10),- aspectRatio: model.aspectRatios.length === 0 || model.aspectRatios.includes(c.aspectRatio)- ? c.aspectRatio- : (model.aspectRatios[0] as AspectRatio),- });+ /** Another model of the mode, the settings carried over where it takes them. */+ const handleModelChange = (id: string) => {+ setConfig(fitToModel({ ...config(), model: id as ModelId }));};// ── Accessors for UI menus (string ↔ config conversions) ────────────- const aspectRatioAccessor: Accessor<string> = () =>- imageConfig()?.aspectRatio ?? videoConfig()?.aspectRatio ?? "16:9";- const variantCountAccessor: Accessor<string> = () => String(imageConfig()?.count ?? 1);- const durationAccessor: Accessor<string> = () => `${videoConfig()?.duration ?? 6}s`;+ const aspectRatioAccessor: Accessor<string> = () => config().aspectRatio ?? "";+ const countAccessor: Accessor<string> = () => String(config().count ?? "");+ const durationAccessor: Accessor<string> = () => String(config().duration ?? "");const modelAccessor: Accessor<string> = () => config().model;- const voiceAccessor: Accessor<string> = () => voiceConfig()?.voice ?? PROMPT_INPUT_VOICE_OPTIONS[0].value;- const audioEnabledAccessor = () => videoConfig()?.generateAudio ?? true;+ const voiceAccessor: Accessor<string> = () => config().voice ?? "";return (<div@@ -473,7 +370,7 @@ export function PromptInput(props: PromptInputProps) {><PromptInputActions /><Switch>- <Match when={mode() === "IMAGE"}>+ <Match when={maxImageReferences() > 0}><div class="flex w-full items-start gap-2 overflow-x-auto"><For each={effectiveImageRefIds()}>{(assetId) => (@@ -497,9 +394,9 @@ export function PromptInput(props: PromptInputProps) {</div></Match>- <Match when={mode() === "VIDEO"}>+ <Match when={option().frames}><div class="flex w-full items-center gap-2 overflow-x-auto">- <Show when={currentVideoModel()?.features.includes("start-frame")}>+ <Show when={option().frames?.includes("start")}><Showwhen={effectiveStartFrameId()}fallback={@@ -522,7 +419,7 @@ export function PromptInput(props: PromptInputProps) {)}</Show></Show>- <Show when={currentVideoModel()?.features.includes("end-frame")}>+ <Show when={option().frames?.includes("end")}><Tooltip><TooltipTriggeras={Button}@@ -626,98 +523,55 @@ export function PromptInput(props: PromptInputProps) {</Tooltip><Show when={settingsVisible()}><Separator orientation="vertical" class="min-h-5" />- <Switch>- <Match when={mode() === "IMAGE"}>- <>- <ModelMenu- searchPlaceholder="Search in image models"- options={PROMPT_INPUT_IMAGE_MODEL_OPTIONS}- value={modelAccessor}- onChange={(v) => patch({ model: v })}- />- <PromptInputCompactMenu- aria-label="Select aspect ratio"- menuLabel="Aspect ratio"- value={aspectRatioAccessor}- options={PROMPT_INPUT_IMAGE_ASPECT_RATIO_OPTIONS}- onChange={(v) => patch({ aspectRatio: v as AspectRatio })}- triggerIcon="aspect-ratio-16-9"- />- <PromptInputCompactMenu- aria-label="Select amount of variants"- menuLabel="Amount of variants"- value={variantCountAccessor}- options={PROMPT_INPUT_VARIANT_COUNT_OPTIONS}- onChange={(v) => patch({ count: Number(v) })}- triggerIcon="variants"- />- </>- </Match>- <Match when={mode() === "VIDEO"}>- <>- <ModelMenu- searchPlaceholder="Search in video models"- options={PROMPT_INPUT_VIDEO_MODEL_OPTIONS}- value={modelAccessor}- onChange={handleVideoModelChange}- />- <Show when={videoAspectRatioOptions().length > 0}>- <PromptInputCompactMenu- aria-label="Select aspect ratio"- menuLabel="Aspect ratio"- value={aspectRatioAccessor}- options={videoAspectRatioOptions()}- onChange={(v) => patch({ aspectRatio: v as AspectRatio })}- triggerIcon="aspect-ratio-16-9"- />- </Show>- {/* <PromptInputCompactMenu- aria-label="Select resolution"- menuLabel="Resolution"- value={resolution}- options={PROMPT_INPUT_RESOLUTION_OPTIONS}- onChange={setResolution}- triggerIcon="resolution"- /> */}- <PromptInputCompactMenu- aria-label="Select duration"- menuLabel="Duration"- value={durationAccessor}- options={videoDurationOptions()}- onChange={(v) => patch({ duration: parseInt(v) })}- triggerIcon="duration"- />- <Show when={currentVideoModel()?.features.includes("audio")}>- <Button- variant="ghost"- onClick={() => patch({ generateAudio: !audioEnabledAccessor() })}- class={DEFAULT_BUTTON_CLASS}- >- <Icon- name={audioEnabledAccessor() ? "audio-on" : "audio-off"}- class="size-6"- />- {audioEnabledAccessor() ? "On" : "Off"}- </Button>- </Show>- </>- </Match>- <Match when={mode() === "VOICE"}>- <VoiceMenu- options={PROMPT_INPUT_VOICE_OPTIONS}- value={voiceAccessor}- onChange={(v) => patch({ voice: v })}- />- </Match>- <Match when={mode() === "AUDIO"}>- <ModelMenu- searchPlaceholder="Search in audio models"- options={PROMPT_INPUT_AUDIO_MODEL_OPTIONS}- value={modelAccessor}- onChange={(v) => patch({ model: v })}- />- </Match>- </Switch>+ <Show when={options().length > 1}>+ <ModelMenu+ searchPlaceholder={`Search in ${modeLabel()} models`}+ options={options()}+ value={modelAccessor}+ onChange={handleModelChange}+ />+ </Show>+ <Show when={aspectRatioOptions().length > 0}>+ <PromptInputCompactMenu+ aria-label="Select aspect ratio"+ menuLabel="Aspect ratio"+ value={aspectRatioAccessor}+ options={aspectRatioOptions()}+ onChange={(v) => patch({ aspectRatio: v as AspectRatio })}+ triggerIcon="aspect-ratio-16-9"+ />+ </Show>+ {/* <PromptInputCompactMenu+ aria-label="Select resolution"+ menuLabel="Resolution"+ value={resolution}+ options={PROMPT_INPUT_RESOLUTION_OPTIONS}+ onChange={setResolution}+ triggerIcon="resolution"+ /> */}+ <Show when={countOptions().length > 0}>+ <PromptInputCompactMenu+ aria-label="Select amount of variants"+ menuLabel="Amount of variants"+ value={countAccessor}+ options={countOptions()}+ onChange={(v) => patch({ count: Number(v) })}+ triggerIcon="variants"+ />+ </Show>+ <Show when={durationOptions().length > 0}>+ <PromptInputCompactMenu+ aria-label="Select duration"+ menuLabel="Duration"+ value={durationAccessor}+ options={durationOptions()}+ onChange={(v) => patch({ duration: Number(v) })}+ triggerIcon="duration"+ />+ </Show>+ <Show when={option().voices}>+ {(voices) => <VoiceMenu options={voices()} value={voiceAccessor} onChange={(v) => patch({ voice: v })} />}+ </Show></Show></div><Tooltip>diff --git a/apps/web/src/components/genai/requests.ts b/apps/web/src/components/genai/requests.tsindex 57f583e1..9fbf2c19 100644--- a/apps/web/src/components/genai/requests.ts+++ b/apps/web/src/components/genai/requests.ts@@ -10,13 +10,13 @@import { uploadAsset } from "@/engine/generate";import { AUDIO_SIZE } from "@/engine/insert-asset";-import { ASPECT_RATIO_DIMENSIONS, MODEL_MODES, PROMPT_INPUT_VIDEO_MODEL_OPTIONS, PROMPT_INPUT_VOICE_OPTIONS } from "./config";-import { aspectRatioSchema } from "./schemas";+import { ASPECT_RATIO_DIMENSIONS, MODEL_MODES, modelOption, modelOptions } from "./config";import type { AssetLibrary } from "@diffusionstudio/assets";import type { AssetRef, GenerateRequest, GenerateRequestInput, ModelId } from "@diffusionstudio/api-contract";import type { GenerationOutput } from "@/engine/generate";-import type { GenerationConfig } from "./schemas";+import type { AspectRatio, PromptMode } from "./config";+import type { GenerationConfig } from "./types";const TITLES = {IMAGE: "Image generation failed",@@ -55,42 +55,53 @@ function refs(library: AssetLibrary, ids: (string | undefined)[]): Promise<(Asse}));}+/** `value` when `allowed` has it, else `fallback` when it has that, else its first; undefined without `allowed`. */+function pick<T>(value: T | undefined, allowed: readonly T[] | undefined, fallback?: T): T | undefined {+ if (!allowed?.length) return undefined;+ if (value !== undefined && allowed.includes(value)) return value;+ if (fallback !== undefined && allowed.includes(fallback)) return fallback;+ return allowed[0];+}+/**- * The request `config` makes, its library inputs uploaded. The API validates- * the rest: a model that does not take a setting says so.+ * `config` within what its model takes (see `ModelOption`): a setting the+ * model allows is kept, one it allows other values of falls back to a+ * default, and one it doesn't take is dropped. Every config the prompt box+ * holds has been through here, so its requests are within the model's bounds.*/-export async function toRequest(library: AssetLibrary, config: GenerationConfig): Promise<GenerateRequestInput> {- const model = config.model as ModelId;+export function fitToModel(config: GenerationConfig): GenerationConfig {+ const option = modelOption(config.model) ?? modelOptions(config.mode)[0]!;+ const frame = (frame: "start" | "end", id: string | undefined) => (option.frames?.includes(frame) ? id : undefined);+ return {+ mode: option.mode,+ model: option.id,+ prompt: config.prompt,+ aspectRatio: pick(config.aspectRatio, option.aspectRatios, "16:9"),+ count: pick(config.count, option.counts, 1),+ duration: pick(config.duration, option.durations, 6),+ voice: pick(config.voice, option.voices?.map((voice) => voice.value)),+ imageRefIds: option.references ? config.imageRefIds?.slice(0, option.references) : undefined,+ startFrameImageId: frame("start", config.startFrameImageId),+ endFrameImageId: frame("end", config.endFrameImageId),+ };+}- switch (config.mode) {- case "IMAGE": {- const images = (await refs(library, config.imageRefIds ?? [])).filter((ref) => ref !== undefined);- return {- model,- prompt: config.prompt,- aspectRatio: config.aspectRatio,- count: config.count,- ...(images.length ? { images } : {}),- } as GenerateRequestInput;- }- case "VIDEO": {- const option = PROMPT_INPUT_VIDEO_MODEL_OPTIONS.find((candidate) => candidate.id === model);- const [startFrame, endFrame] = await refs(library, [config.startFrameImageId, config.endFrameImageId]);- return {- model,- prompt: config.prompt,- duration: config.duration,- ...(option?.aspectRatios.length ? { aspectRatio: config.aspectRatio } : {}),- ...(option?.features.includes("audio") ? { generateAudio: config.generateAudio ?? false } : {}),- ...(startFrame ? { startFrame } : {}),- ...(endFrame ? { endFrame } : {}),- } as GenerateRequestInput;- }- case "VOICE":- return { model: "elevenlabs-v3", prompt: config.prompt, voice: config.voice };- case "AUDIO":- return { model, prompt: config.prompt } as GenerateRequestInput;- }+/** The prompt box in `mode`, set up for the mode's first model. */+export function createDefaultConfig(mode: PromptMode, prompt = ""): GenerationConfig {+ return fitToModel({ mode, model: modelOptions(mode)[0]!.id, prompt });+}++/** The request `config` makes, its library inputs uploaded. Settings the config leaves unset are left out. */+export async function toRequest(library: AssetLibrary, config: GenerationConfig): Promise<GenerateRequestInput> {+ const { model, prompt, aspectRatio, count, duration, voice } = config;+ const [startFrame, endFrame, ...images] = await refs(library, [+ config.startFrameImageId,+ config.endFrameImageId,+ ...(config.imageRefIds ?? []),+ ]);+ const uploaded = images.filter((ref) => ref !== undefined);+ const request = { model, prompt, aspectRatio, count, duration, voice, startFrame, endFrame, images: uploaded.length ? uploaded : undefined };+ return Object.fromEntries(Object.entries(request).filter(([, value]) => value !== undefined)) as GenerateRequestInput;}/**@@ -99,49 +110,17 @@ export async function toRequest(library: AssetLibrary, config: GenerationConfig)* asset. Undefined for a request the prompt box does not make (a tool).*/export function toConfig(request: GenerateRequest): GenerationConfig | undefined {- const aspectRatio = (value: unknown) => aspectRatioSchema.safeParse(value).data ?? "16:9";-- switch (request.model) {- case "gpt-image-2":- case "nano-banana-2":- case "nano-banana-pro":- case "seedream-4.5":- case "flux-2-klein":- return {- mode: "IMAGE",- model: request.model,- prompt: request.prompt,- aspectRatio: aspectRatio(request.aspectRatio),- count: Math.min(request.count, 4),- };- case "kling-3-pro":- case "kling-o3-pro":- case "wan-2.6":- case "hailuo-3-max":- case "seedance-2.0":- case "veo-3.1":- case "veo-3.1-fast":- return {- mode: "VIDEO",- model: request.model,- prompt: request.prompt,- aspectRatio: aspectRatio("aspectRatio" in request ? request.aspectRatio : undefined),- duration: request.duration,- generateAudio: "generateAudio" in request ? request.generateAudio : undefined,- };- case "elevenlabs-v3":- return {- mode: "VOICE",- model: request.model,- prompt: request.prompt,- voice: PROMPT_INPUT_VOICE_OPTIONS.some((option) => option.value === request.voice)- ? request.voice- : PROMPT_INPUT_VOICE_OPTIONS[0]!.value,- };- case "elevenlabs-music":- case "elevenlabs-sfx":- return { mode: "AUDIO", model: request.model, prompt: request.prompt };- default:- return undefined;- }+ const option = modelOption(request.model);+ if (!option || !("prompt" in request) || request.prompt === undefined) return undefined;+ // The settings a request of the prompt box's models may carry; `fitToModel` checks them.+ const settings = request as { aspectRatio?: string; count?: number; duration?: number; voice?: string };+ return fitToModel({+ mode: option.mode,+ model: option.id,+ prompt: request.prompt,+ aspectRatio: settings.aspectRatio as AspectRatio | undefined,+ count: settings.count,+ duration: settings.duration,+ voice: settings.voice,+ });}diff --git a/apps/web/src/components/genai/schemas.ts b/apps/web/src/components/genai/schemas.tsdeleted file mode 100644index 4705baa2..00000000--- a/apps/web/src/components/genai/schemas.ts+++ /dev/null@@ -1,59 +0,0 @@-/* This Source Code Form is subject to the terms of the Mozilla Public- * License, v. 2.0. If a copy of the MPL was not distributed with this- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */--import { z } from "zod";--/** What a generation request says, in the vocabulary the prompt input speaks. */--export const aspectRatioSchema = z.enum(["1:1", "4:3", "3:4", "16:9", "9:16"]);-export type AspectRatio = z.infer<typeof aspectRatioSchema>;--export const imageGenerationConfigSchema = z.object({- mode: z.literal("IMAGE"),- model: z.string(),- prompt: z.string(),- aspectRatio: aspectRatioSchema,- count: z.number().int().min(1).max(4),- imageRefIds: z.array(z.string()).optional(),-});--export const videoGenerationConfigSchema = z.object({- mode: z.literal("VIDEO"),- model: z.string(),- prompt: z.string(),- aspectRatio: aspectRatioSchema,- duration: z.number().int().min(1),- generateAudio: z.boolean().optional(),- startFrameImageId: z.string().optional(),- endFrameImageId: z.string().optional(),-});--export const voiceGenerationConfigSchema = z.object({- mode: z.literal("VOICE"),- model: z.string(),- prompt: z.string(),- voice: z.string(),-});--export const audioGenerationConfigSchema = z.object({- mode: z.literal("AUDIO"),- model: z.string(),- prompt: z.string(),-});--export const generationConfigSchema = z.discriminatedUnion("mode", [- imageGenerationConfigSchema,- videoGenerationConfigSchema,- voiceGenerationConfigSchema,- audioGenerationConfigSchema,-]);--export type ImageGenerationConfig = z.infer<typeof imageGenerationConfigSchema>;-export type VideoGenerationConfig = z.infer<typeof videoGenerationConfigSchema>;-export type VoiceGenerationConfig = z.infer<typeof voiceGenerationConfigSchema>;-export type AudioGenerationConfig = z.infer<typeof audioGenerationConfigSchema>;-export type GenerationConfig = z.infer<typeof generationConfigSchema>;--/** What can be done to an asset the selection shows. */-export type TransformType = "upscale" | "removeBackground" | "addAudio";diff --git a/apps/web/src/components/genai/types.ts b/apps/web/src/components/genai/types.tsnew file mode 100644index 00000000..df7c05ef--- /dev/null+++ b/apps/web/src/components/genai/types.ts@@ -0,0 +1,28 @@+/* This Source Code Form is subject to the terms of the Mozilla Public+ * License, v. 2.0. If a copy of the MPL was not distributed with this+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */++import type { ModelId } from "@diffusionstudio/api-contract";+import type { AspectRatio, PromptMode } from "./config";++/**+ * The prompt box's settings: the fields of the request it makes, with inputs+ * named by library asset rather than upload. Which settings are set follows+ * from the model (see `ModelOption` and `fitToModel`), not from the mode.+ */+export interface GenerationConfig {+ mode: PromptMode;+ model: ModelId;+ prompt: string;+ aspectRatio?: AspectRatio;+ count?: number;+ /** Seconds. */+ duration?: number;+ voice?: string;+ imageRefIds?: string[];+ startFrameImageId?: string;+ endFrameImageId?: string;+}++/** What can be done to an asset the selection shows. */+export type TransformType = "upscale" | "removeBackground" | "addAudio";diff --git a/apps/web/src/components/genai/use-generate.ts b/apps/web/src/components/genai/use-generate.tsindex 03f4f69f..58fe8c90 100644--- a/apps/web/src/components/genai/use-generate.ts+++ b/apps/web/src/components/genai/use-generate.ts@@ -8,7 +8,7 @@ import { generate } from "@/engine/generate";import { outputOf, toRequest } from "./requests";import type { GenerateRequest } from "@diffusionstudio/api-contract";-import type { GenerationConfig } from "./schemas";+import type { GenerationConfig } from "./types";/*** Generating onto the canvas: from the prompt box's settings (`generate`), or@@ -20,11 +20,7 @@ export function useGenerate() {const run = (config: GenerationConfig): Promise<void> => {const library = world.get(Library);- const output = outputOf({- model: config.model as GenerateRequest["model"],- count: config.mode === "IMAGE" ? config.count : 1,- aspectRatio: "aspectRatio" in config ? config.aspectRatio : undefined,- });+ const output = outputOf(config);if (!library || !output) return Promise.resolve();return generate(world, output, () => toRequest(library, config));};diff --git a/apps/web/src/components/genai/use-generation-records.ts b/apps/web/src/components/genai/use-generation-records.tsindex eb50f04d..4f961b30 100644--- a/apps/web/src/components/genai/use-generation-records.ts+++ b/apps/web/src/components/genai/use-generation-records.ts@@ -13,7 +13,7 @@ import { useMediaSelection } from "./selection";import { toConfig } from "./requests";import type { Job } from "@diffusionstudio/api-contract";-import type { GenerationConfig } from "./schemas";+import type { GenerationConfig } from "./types";export function useGenerationRecords() {const { media } = useMediaSelection();diff --git a/apps/web/src/components/genai/use-transforms.ts b/apps/web/src/components/genai/use-transforms.tsindex 9dca04a5..5544d2a7 100644--- a/apps/web/src/components/genai/use-transforms.ts+++ b/apps/web/src/components/genai/use-transforms.ts@@ -13,7 +13,7 @@ import { useMediaSelection } from "./selection";import type { AssetRef, GenerateRequestInput } from "@diffusionstudio/api-contract";import type { NodeMedia } from "@/engine/generate";-import type { TransformType } from "./schemas";+import type { TransformType } from "./types";interface Tool {/** What a failure is reported under. */diff --git a/apps/web/src/components/sidebar-left/assets.tsx b/apps/web/src/components/sidebar-left/assets.tsxindex 1768eb33..4bbcda89 100644--- a/apps/web/src/components/sidebar-left/assets.tsx+++ b/apps/web/src/components/sidebar-left/assets.tsx@@ -4,7 +4,7 @@import { basename, dirname } from "@diffusionstudio/assets";import { usePromptInput } from "@/context/prompt-input";-import { createDefaultConfig } from "@/components/genai/prompt-input";+import { createDefaultConfig } from "@/components/genai/requests";import { createEffect, createMemo, createSignal, For, onCleanup, onMount, Show } from "solid-js";import { SidebarTabs } from "@/agent-chat";import { Button } from "../ui/button";diff --git a/apps/web/src/components/sidebar-right/inspector/asset-picker.tsx b/apps/web/src/components/sidebar-right/inspector/asset-picker.tsxindex 01e75e8a..3c7e9b17 100644--- a/apps/web/src/components/sidebar-right/inspector/asset-picker.tsx+++ b/apps/web/src/components/sidebar-right/inspector/asset-picker.tsx@@ -18,7 +18,7 @@ import { Icon } from "@/components/ui/icon";import { Separator } from "@/components/ui/separator";import { LazyAssetItem } from "@/components/sidebar-left/asset-item";import { usePromptInput } from "@/context/prompt-input";-import { createDefaultConfig } from "@/components/genai/prompt-input";+import { createDefaultConfig } from "@/components/genai/requests";import { assetName } from "@diffusionstudio/assets";import { useTrait } from "@diffusionstudio/koota-solid";import { AssetId, isScene } from "@diffusionstudio/runtime";diff --git a/apps/web/src/context/prompt-input.tsx b/apps/web/src/context/prompt-input.tsxindex 7777b575..7b36826f 100644--- a/apps/web/src/context/prompt-input.tsx+++ b/apps/web/src/context/prompt-input.tsx@@ -4,7 +4,7 @@import { createContext, createSignal, useContext } from "solid-js";import type { JSX } from "solid-js";-import type { GenerationConfig } from "@/components/genai/schemas";+import type { GenerationConfig } from "@/components/genai/types";type PromptInputContextValue = {openPromptInput: (config: GenerationConfig) => void;