Unrestricted Open-source alternative to AI video platforms — Free AI image & video generation studio with 600+ models (Flux, Midjourney, Kling, Sora, Veo). No content filters. Self-hosted, MIT licensed.
JavaScript ai-art-generatorai-image-generationai-video-generationfal-ai-alternativegenerative-aiimage-to-videoinvideo-alternativekling-ailipsynclitellm-alternativemidjourney-alternativemuapiopen-sourceopenrouter-alternativeseedance2sora-alternativetext-to-imagetext-to-videouncensoredwan-video
feat(studio): simplify Veo model selection
antilya4e313aa2cfbb
diff --git a/packages/studio/src/components/SeedanceControls.jsx b/packages/studio/src/components/VideoModelControls.jsxsimilarity index 96%rename from packages/studio/src/components/SeedanceControls.jsxrename to packages/studio/src/components/VideoModelControls.jsxindex 7811676f..f681490c 100644--- a/packages/studio/src/components/SeedanceControls.jsx+++ b/packages/studio/src/components/VideoModelControls.jsx@@ -16,7 +16,7 @@ import {const SELECT_CLASS = "w-full rounded-lg border border-white/10 bg-[#17191c] px-3 py-2 text-xs text-white outline-none focus:border-[#22d3ee]/50";const ADVANCED_KEYS = ["seed"];-export function SeedanceOptionControl({ label, field, icon, open, onToggle, onSelect, copy }) {+export function VideoOptionControl({ label, field, icon, open, onToggle, onSelect, copy }) {const controlId = useId();const menuId = `${controlId}-menu`;const { triggerRef, menuRef, onTriggerKeyDown, onMenuKeyDown, restoreFocus } = usePromptMenu({@@ -29,7 +29,7 @@ export function SeedanceOptionControl({ label, field, icon, open, onToggle, onSe: option.label;const selectedLabel = selected ? optionLabel(selected) : field.label || label;if (field.options.length === 0 || (field.options.length === 1 && selected)) {- if (field.key !== "resolution" || (field.options.length === 0 && !field.label)) return null;+ if (field.key === "speed" || (field.options.length === 0 && !field.label)) return null;return (<divrole="group"@@ -100,7 +100,7 @@ export function SeedanceOptionControl({ label, field, icon, open, onToggle, onSe);}-export function SeedanceSettingsControl({+export function VideoSettingsControl({profile, qualities, quality, onProfileChange, onQualityChange, onDefaultResolution,inputs, values, onChange, open, onToggle, copy,}) {diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsxindex 517e4a08..2b8b7b27 100644--- a/packages/studio/src/components/VideoStudio.jsx+++ b/packages/studio/src/components/VideoStudio.jsx@@ -7,7 +7,7 @@ import { formatErrorMessage } from "../utils/formatError.js";import { scopedPersistKey, migrateLegacyPersistKey } from "../persistKey.js";import DrawModal from "./DrawModal.jsx";import ModelParameterControls from "./ModelParameterControls.jsx";-import { SeedanceOptionControl, SeedanceSettingsControl } from "./SeedanceControls.jsx";+import { VideoOptionControl, VideoSettingsControl } from "./VideoModelControls.jsx";import MobileGenerationActions, {GenerationCopyButtons,} from "./MobileGenerationActions.jsx";@@ -28,22 +28,21 @@ import {videoModelMenuEntries as videoModelPickerEntries,videoModelMenuEntryByVariantId as videoModelPickerEntryByVariantId,} from "../modelFamilies.js";+import { getSeedanceEndpointResolution, getSeedanceToolConfiguration } from "../seedanceModels.js";+import { getVeoConfiguration, getVeoToolConfiguration } from "../veoModels.js";+import { getGroupedVideoConfiguration, getGroupedVideoVariantOptions } from "../groupedVideoModels.js";import {- getSeedanceConfiguration,- getSeedanceEndpointResolution,- getSeedanceVariantOptions,- getSeedanceToolConfiguration,-} from "../seedanceModels.js";+ getVideoCommonOptions,+ getVideoCommonValues,+ buildVideoCommonPayload,+} from "../videoModelParameters.js";import {- getSeedanceCommonOptions,- getSeedanceCommonValues,- getSeedanceResolutionOptions,- planSeedanceSelection,- getSeedanceSelectionAdjustments,- buildSeedanceCommonPayload,- migrateSeedanceResolutionSelection,-} from "../seedanceParameters.js";-import { getSeedanceModeDescription } from "../seedanceCopy.js";+ getGroupedVideoResolutionOptions,+ planGroupedVideoSelection,+ getGroupedVideoSelectionAdjustments,+} from "../groupedVideoParameters.js";+import { migrateSeedanceResolutionSelection } from "../seedanceParameters.js";+import { getVideoModeDescription } from "../videoModelCopy.js";import {buildReferenceParams,getModelMediaCapabilities,@@ -55,7 +54,7 @@ import {createModelParameterValues,getSupplementalModelInputs,} from "../modelParameters.js";-import { isContinuationSourceModel } from "../videoToolCapabilities.js";+import { getCompatibleContinuationSources, getContinuationConfig, isContinuationSourceModel } from "../videoToolCapabilities.js";import {appendVideoWorkflowMedia,buildVideoWorkflowMediaParams,@@ -453,7 +452,7 @@ function ModelDropdown({ selectedModel, onSelect, onClose, copy = en }) {{id: "t2v",label: copy.categories.t2v,- entries: videoModelPickerEntries.filter((entry) => entry.variantsByMode.t2v),+ entries: videoModelPickerEntries.filter((entry) => entry.variantsByMode.t2v && !getVeoToolConfiguration(entry.defaultVariant.model.id)),},{id: "i2v",@@ -463,7 +462,7 @@ function ModelDropdown({ selectedModel, onSelect, onClose, copy = en }) {{id: "v2v",label: copy.categories.v2v,- entries: videoModelPickerEntries.filter((entry) => entry.variantsByMode.v2v),+ entries: videoModelPickerEntries.filter((entry) => entry.variantsByMode.v2v || getVeoToolConfiguration(entry.defaultVariant.model.id)),},];const [selectedCategory, setSelectedCategory] = useState("all");@@ -544,11 +543,15 @@ function ModelDropdown({ selectedModel, onSelect, onClose, copy = en }) {return entry.searchText.includes(lf);});const selectedTool = getSeedanceToolConfiguration(selectedModel);+ const selectedVeoTool = getVeoToolConfiguration(selectedModel);const mainEntries = [];const seedanceToolsByGroup = { continueGenerated: [], removeWatermark: [] };+ const veoTools = [];for (const entry of filtered) {const tool = getSeedanceToolConfiguration(entry.defaultVariant.model.id);+ const veoTool = getVeoToolConfiguration(entry.defaultVariant.model.id);if (tool) seedanceToolsByGroup[tool.group][tool.order] = entry;+ else if (veoTool) veoTools[veoTool.order] = entry;else mainEntries.push(entry);}@@ -725,7 +728,7 @@ function ModelDropdown({ selectedModel, onSelect, onClose, copy = en }) {) : (<>{mainEntries.map((entry) => renderItem(entry))}- {mainEntries.length < filtered.length && (+ {Object.values(seedanceToolsByGroup).some((entries) => entries.length > 0) && (<details open={Boolean(search.trim()) || Boolean(selectedTool)} className="mt-2 border-t border-white/5 pt-2"><summary className="cursor-pointer px-3 py-2 text-xs font-semibold text-white/50">{copy.seedance.tools}@@ -741,6 +744,15 @@ function ModelDropdown({ selectedModel, onSelect, onClose, copy = en }) {})}</details>)}+ {veoTools.length > 0 && (+ <details open={Boolean(search.trim()) || Boolean(selectedVeoTool)} className="mt-2 border-t border-white/5 pt-2">+ <summary className="cursor-pointer px-3 py-2 text-xs font-semibold text-white/50">{copy.veo.tools}</summary>+ <p className="px-3 pb-2 text-[11px] text-white/45">{copy.veo.toolsHelp}</p>+ {veoTools.filter(Boolean).map((entry) => renderItem(+ entry, copy.veo.toolNames[getVeoToolConfiguration(entry.defaultVariant.model.id).key],+ ))}+ </details>+ )}</>)}</div>@@ -840,6 +852,7 @@ export default function VideoStudio({const [showCanvas, setShowCanvas] = useState(false);const [isDrawModalOpen, setIsDrawModalOpen] = useState(false);const [generationSources, setGenerationSources] = useState({});+ const [selectedVeoSourceId, setSelectedVeoSourceId] = useState("");// ── history ──const [localHistory, setLocalHistory] = useState([]);@@ -908,8 +921,8 @@ export default function VideoStudio({const getCurrentAspectRatios = useCallback((id) =>- getSeedanceConfiguration(id)- ? getSeedanceCommonOptions(videoModelCatalog.variantById.get(id)?.model).aspectRatios+ getGroupedVideoConfiguration(id)+ ? getVideoCommonOptions(videoModelCatalog.variantById.get(id)?.model).aspectRatios: imageMode? getAspectRatiosForI2VModel(id): getAspectRatiosForVideoModel(id),@@ -918,8 +931,8 @@ export default function VideoStudio({const getCurrentDurations = useCallback((id) =>- getSeedanceConfiguration(id)- ? getSeedanceCommonOptions(videoModelCatalog.variantById.get(id)?.model).durations+ getGroupedVideoConfiguration(id)+ ? getVideoCommonOptions(videoModelCatalog.variantById.get(id)?.model).durations: imageMode ? getDurationsForI2VModel(id) : getDurationsForModel(id),[imageMode],);@@ -949,10 +962,10 @@ export default function VideoStudio({// ── update controls when the selected model changes ─────────────────────const applyControlsForModel = useCallback((modelId, isImageMode, isV2vMode) => {- if (getSeedanceConfiguration(modelId)) {+ if (getGroupedVideoConfiguration(modelId)) {const model = videoModelCatalog.variantById.get(modelId)?.model;- const options = getSeedanceCommonOptions(model);- const values = getSeedanceCommonValues(model, commonParameterValuesRef.current);+ const options = getVideoCommonOptions(model);+ const values = getVideoCommonValues(model, commonParameterValuesRef.current);setShowAr(options.aspectRatios.length > 0);setShowDuration(options.durations.length > 0);setShowResolution(options.resolutions.length > 0);@@ -965,7 +978,7 @@ export default function VideoStudio({if (values.quality !== undefined) setSelectedQuality(values.quality);return;}- if (isV2vMode) {+ if (isV2vMode || getVeoToolConfiguration(modelId)) {setShowAr(false);setShowDuration(false);setShowResolution(false);@@ -1034,8 +1047,14 @@ export default function VideoStudio({const selectedWorkflow = selectedWorkflowId? workflowFamily?.workflowById.get(selectedWorkflowId) || null: null;- const seedanceConfiguration = getSeedanceConfiguration(selectedModel);- const workflowControlState = seedanceConfiguration && workflowFamily+ const groupedConfiguration = getGroupedVideoConfiguration(selectedModel);+ const isVeo = Boolean(getVeoConfiguration(selectedModel));+ const groupCopy = useMemo(() => ({+ ...copy.modelControls,+ ...(isVeo ? copy.veo : copy.seedance),+ adjustments: { ...copy.modelControls.adjustments, ...(isVeo ? copy.veo.adjustments : {}) },+ }), [copy, isVeo]);+ const workflowControlState = groupedConfiguration && workflowFamily? { kind: "menu", workflow: null }: getVideoWorkflowControlState(workflowFamily,@@ -1047,10 +1066,17 @@ export default function VideoStudio({const selectedVariant = videoModelCatalog.variantById.get(selectedModel);const selectedPickerEntry = videoModelPickerEntryByVariantId.get(selectedModel);const selectedTool = getSeedanceToolConfiguration(selectedModel);+ const selectedVeoTool = getVeoToolConfiguration(selectedModel);+ const veoContinuation = selectedVeoTool ? getContinuationConfig(selectedModel) : null;+ const veoSources = useMemo(() => selectedVeoTool+ ? getCompatibleContinuationSources(selectedModel, history) : [],+ [selectedModel, selectedVeoTool, history]);+ const selectedVeoSource = veoSources.find((entry) => entry.requestId === selectedVeoSourceId) || veoSources[0];const selectedPickerLabel = selectedTool? seedanceToolLabel(selectedTool, copy, true)+ : selectedVeoTool ? copy.veo.toolNames[selectedVeoTool.key]: selectedPickerEntry?.name || selectedFamily.name;- const getSeedancePlan = useCallback((options = {}) => planSeedanceSelection({+ const getSelectionPlan = useCallback((options = {}) => planGroupedVideoSelection({familyId: selectedFamilyId,workflowId: selectedWorkflowId,currentModelId: selectedModel,@@ -1061,71 +1087,72 @@ export default function VideoStudio({},...options,}), [selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, selectedAr, selectedDuration, selectedQuality]);- const describeSeedanceAdjustments = useCallback((adjustments) => {+ const describeSelectionAdjustments = useCallback((adjustments) => {const valueLabel = (key, value) => {- if (key === "profile") return copy.seedance.profiles[value]?.label || value;- if (key === "speed") return copy.seedance.speeds[value] || value;- if (key === "resolution" && value === "default") return copy.seedance.defaultResolution;+ if (key === "profile") return groupCopy.profiles[value]?.label || value;+ if (key === "speed") return groupCopy.speeds[value] || value;+ if (key === "resolution" && value === "default") return groupCopy.defaultResolution;return String(value).toLowerCase() === "4k" ? "4K" : value;};return adjustments.map(({ key, to }) =>- copy.seedance.adjustments[key].replace("{value}", valueLabel(key, to))).join(" · ");- }, [copy]);- const seedanceVariantOptions = useMemo(() => seedanceConfiguration- ? getSeedanceVariantOptions(selectedFamilyId, selectedWorkflowId, selectedModel)+ groupCopy.adjustments[key].replace("{value}", valueLabel(key, to))).join(" · ");+ }, [groupCopy]);+ const groupedVariantOptions = useMemo(() => groupedConfiguration+ ? getGroupedVideoVariantOptions(selectedFamilyId, selectedWorkflowId, selectedModel).filter((field) => field.key !== "resolution").map((field) => ({...field,options: field.options.map((option) => {- const plan = getSeedancePlan({ changes: { [field.key]: option.value } });+ const plan = getSelectionPlan({ changes: { [field.key]: option.value } });return {...option,+ description: groupCopy.speedDescriptions?.[option.value],disabled: !plan,- adjustmentDescription: plan ? describeSeedanceAdjustments(plan.adjustments) : "",+ adjustmentDescription: plan ? describeSelectionAdjustments(plan.adjustments) : "",};}),}))- : [], [seedanceConfiguration, selectedFamilyId, selectedWorkflowId, selectedModel, getSeedancePlan, describeSeedanceAdjustments, copy]);- const seedanceProfile = seedanceVariantOptions.find((field) => field.key === "profile");- const seedanceSpeed = seedanceVariantOptions.find((field) => field.key === "speed");- const seedanceResolution = useMemo(() => {- if (!seedanceConfiguration) return null;- const field = getSeedanceResolutionOptions(selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, {+ : [], [groupedConfiguration, selectedFamilyId, selectedWorkflowId, selectedModel, getSelectionPlan, describeSelectionAdjustments, groupCopy]);+ const groupedProfile = groupedVariantOptions.find((field) => field.key === "profile");+ const groupedSpeed = groupedVariantOptions.find((field) => field.key === "speed");+ const groupedResolution = useMemo(() => {+ if (!groupedConfiguration) return null;+ const field = getGroupedVideoResolutionOptions(selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, {aspectRatio: selectedAr, duration: selectedDuration, quality: selectedQuality,});return {...field,key: "resolution",- ...(!field.value && selectedWorkflowId !== "extend_uploaded_video"- ? { label: copy.seedance.defaultResolution } : {}),+ ...(!isVeo && !field.value && selectedWorkflowId !== "extend_uploaded_video"+ ? { label: groupCopy.defaultResolution } : {}),options: field.options.map((option) => {- const adjustments = option.disabled ? [] : getSeedanceSelectionAdjustments({+ const adjustments = option.disabled ? [] : getGroupedVideoSelectionAdjustments({currentModelId: selectedModel, nativeResolution: selectedResolution,commonValues: { aspectRatio: selectedAr, duration: selectedDuration, quality: selectedQuality },selection: option, changes: { resolution: option.value },});- return { ...option, adjustmentDescription: describeSeedanceAdjustments(adjustments) };+ return { ...option, adjustmentDescription: describeSelectionAdjustments(adjustments) };}),};- }, [seedanceConfiguration, selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, selectedAr, selectedDuration, selectedQuality, describeSeedanceAdjustments, copy]);- const seedanceCommonOptions = useMemo(- () => getSeedanceCommonOptions(selectedVariant?.model), [selectedVariant],+ }, [groupedConfiguration, selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, selectedAr, selectedDuration, selectedQuality, describeSelectionAdjustments, groupCopy, isVeo]);+ const commonOptions = useMemo(+ () => getVideoCommonOptions(selectedVariant?.model), [selectedVariant],);- const seedanceModes = useMemo(() => seedanceConfiguration && workflowFamily+ const groupedModes = useMemo(() => groupedConfiguration && workflowFamily? [...(workflowFamily.hasBase ? [{ id: null }] : []), ...workflowFamily.workflows].map((workflow) => {- const plan = getSeedancePlan({ workflowId: workflow.id });+ const plan = getSelectionPlan({ workflowId: workflow.id });return {id: workflow.id,- label: copy.seedance.modes[workflow.id || "text"],- description: getSeedanceModeDescription(+ label: groupCopy.modes[workflow.id || "text"],+ description: getVideoModeDescription(videoModelCatalog.variantById.get(plan?.selection.modelId)?.model,- workflow.id, copy.seedance,+ workflow.id, groupCopy,),- adjustmentDescription: plan ? describeSeedanceAdjustments(plan.adjustments) : "",+ adjustmentDescription: plan ? describeSelectionAdjustments(plan.adjustments) : "",disabled: !plan,};})- : [], [seedanceConfiguration, workflowFamily, getSeedancePlan, describeSeedanceAdjustments, copy]);+ : [], [groupedConfiguration, workflowFamily, getSelectionPlan, describeSelectionAdjustments, groupCopy]);const activeWorkflowMediaDraft = useMemo(() => workflowMediaDraftKey? projectVideoWorkflowMedia(@@ -1141,7 +1168,7 @@ export default function VideoStudio({workflowMediaDrafts,],);- const promptDisabled = shouldDisableVideoPrompt(+ const promptDisabled = Boolean(selectedVeoTool && !selectedVariant?.model.inputs?.prompt) || shouldDisableVideoPrompt(selectedVariant?.model,currentFamilyMode,);@@ -1155,15 +1182,15 @@ export default function VideoStudio({const supplementalInputs = useMemo(() => {const inputs = getSupplementalModelInputs(selectedVariant?.model);- return seedanceConfiguration+ return groupedConfiguration? inputs.filter(({ key }) => key !== "omni_reference_task_type").map(({ key, schema }) => ({key, schema: {- ...schema, ...copy.seedance.fields[key],- ...(key === "generate_audio" && selectedWorkflowId === "edit_video" ? copy.seedance.editAudio : {}),+ ...schema, ...groupCopy.fields[key],+ ...(key === "generate_audio" && selectedWorkflowId === "edit_video" ? groupCopy.editAudio : {}),},})): inputs;- }, [selectedVariant, seedanceConfiguration, selectedWorkflowId, copy],+ }, [selectedVariant, groupedConfiguration, selectedWorkflowId, groupCopy],);const handleModelParameterChange = useCallback((key, value) => {setModelParameterValues((values) => ({ ...values, [key]: value }));@@ -1869,9 +1896,9 @@ export default function VideoStudio({setUploadedAudioUrls((urls) => urls.filter((_, itemIndex) => itemIndex !== index));};- const handleSeedanceSelection = useCallback((plan, family, workflowId) => {+ const handleGroupedSelection = useCallback((plan, family, workflowId) => {if (!plan) {- toast.error(copy.seedance.incompatible);+ toast.error(groupCopy.incompatible);return;}const { selection, adjustments } = plan;@@ -1879,15 +1906,15 @@ export default function VideoStudio({applyUserSelectedVariant(target, target.mode, family, workflowId);if (selection.resolution !== undefined) setSelectedResolution(selection.resolution);if (adjustments.length) {- toast(describeSeedanceAdjustments(adjustments));+ toast(describeSelectionAdjustments(adjustments));}- }, [applyUserSelectedVariant, describeSeedanceAdjustments, copy]);+ }, [applyUserSelectedVariant, describeSelectionAdjustments, groupCopy]);// ── model selection from dropdown ─────────────────────────────────────────const handleModelSelect = useCallback((pickerEntry, category = "all") => {const { family, variantsByMode, defaultVariant } = pickerEntry;- if (pickerEntry.groupedSeedance) {+ if (pickerEntry.groupedVideo) {// Reopening the model picker must not reset a configured version.if (family.id === selectedFamilyId &&(category === "all" || (category === currentFamilyMode &&@@ -1905,17 +1932,18 @@ export default function VideoStudio({const remembered = workflowVariantPreferencesRef.current.get(workflowContextKey(family.id, workflowId),);- const plan = getSeedancePlan({+ const plan = getSelectionPlan({familyId: family.id,workflowId,currentModelId: family.id === selectedFamilyId ? selectedModel : remembered,nativeResolution: family.id === selectedFamilyId ? selectedResolution : undefined,});- handleSeedanceSelection(plan, family, workflowId);+ handleGroupedSelection(plan, family, workflowId);return;}const target = category !== "all"- ? variantsByMode[category]+ ? category === "v2v" && getVeoToolConfiguration(defaultVariant.model.id)+ ? defaultVariant : variantsByMode[category]: variantsByMode[currentFamilyMode] || defaultVariant;if (!target) return;@@ -1937,8 +1965,8 @@ export default function VideoStudio({},[applyUserSelectedVariant,- handleSeedanceSelection,- getSeedancePlan,+ handleGroupedSelection,+ getSelectionPlan,currentFamilyMode,selectedFamilyId,selectedWorkflowId,@@ -1948,8 +1976,8 @@ export default function VideoStudio({);const handleWorkflowSelect = useCallback((workflowId) => {- if (getSeedanceConfiguration(selectedModel)) {- handleSeedanceSelection(getSeedancePlan({ workflowId }), selectedFamily, workflowId);+ if (getGroupedVideoConfiguration(selectedModel)) {+ handleGroupedSelection(getSelectionPlan({ workflowId }), selectedFamily, workflowId);return;}const preferred = workflowVariantPreferencesRef.current.get(@@ -1964,11 +1992,11 @@ export default function VideoStudio({if (target) {applyUserSelectedVariant(target, target.mode, selectedFamily, workflowId);}- }, [applyUserSelectedVariant, selectedFamily, selectedFamilyId, selectedModel, getSeedancePlan, handleSeedanceSelection]);+ }, [applyUserSelectedVariant, selectedFamily, selectedFamilyId, selectedModel, getSelectionPlan, handleGroupedSelection]);const clearWorkflow = useCallback(() => {- if (getSeedanceConfiguration(selectedModel)) {- handleSeedanceSelection(getSeedancePlan({ workflowId: null }), selectedFamily, null);+ if (getGroupedVideoConfiguration(selectedModel)) {+ handleGroupedSelection(getSelectionPlan({ workflowId: null }), selectedFamily, null);return;}const preferred = workflowVariantPreferencesRef.current.get(@@ -1980,24 +2008,24 @@ export default function VideoStudio({preferred,);if (target) applyUserSelectedVariant(target, target.mode, selectedFamily, null);- }, [applyUserSelectedVariant, selectedFamily, selectedFamilyId, selectedModel, getSeedancePlan, handleSeedanceSelection]);+ }, [applyUserSelectedVariant, selectedFamily, selectedFamilyId, selectedModel, getSelectionPlan, handleGroupedSelection]);- const handleSeedanceOptionChange = useCallback((key, value) => {- handleSeedanceSelection(getSeedancePlan({ changes: { [key]: value } }), selectedFamily, selectedWorkflowId);- }, [selectedFamily, selectedWorkflowId, getSeedancePlan, handleSeedanceSelection]);+ const handleGroupedOptionChange = useCallback((key, value) => {+ handleGroupedSelection(getSelectionPlan({ changes: { [key]: value } }), selectedFamily, selectedWorkflowId);+ }, [selectedFamily, selectedWorkflowId, getSelectionPlan, handleGroupedSelection]);- const handleSeedanceResolutionChange = useCallback((option) => {+ const handleGroupedResolutionChange = useCallback((option) => {if (option.disabled) return;- const adjustments = getSeedanceSelectionAdjustments({+ const adjustments = getGroupedVideoSelectionAdjustments({currentModelId: selectedModel,nativeResolution: selectedResolution,commonValues: commonParameterValuesRef.current,selection: option,changes: { resolution: option.value },});- handleSeedanceSelection({ selection: option, adjustments }, selectedFamily, selectedWorkflowId);+ handleGroupedSelection({ selection: option, adjustments }, selectedFamily, selectedWorkflowId);setOpenDropdown(null);- }, [handleSeedanceSelection, selectedFamily, selectedWorkflowId, selectedModel, selectedResolution]);+ }, [handleGroupedSelection, selectedFamily, selectedWorkflowId, selectedModel, selectedResolution]);// ── add to local history ──────────────────────────────────────────────────const addToLocalHistory = useCallback((entry) => {@@ -2019,25 +2047,25 @@ export default function VideoStudio({return;}const currentModel = getCurrentModel();- const seedance = getSeedanceConfiguration(selectedModel);- const generationParameterValues = seedance && currentModel.inputs?.omni_reference_task_type+ const grouped = getGroupedVideoConfiguration(selectedModel);+ const generationParameterValues = grouped && currentModel.inputs?.omni_reference_task_type? { ...modelParameterValues, omni_reference_task_type: "auto" }: modelParameterValues;- const seedanceCommonParams = seedance- ? buildSeedanceCommonPayload(currentModel, {+ const commonParams = grouped+ ? buildVideoCommonPayload(currentModel, {aspectRatio: selectedAr, duration: selectedDuration,resolution: selectedResolution, quality: selectedQuality,}): {};- const seedanceHistorySettings = seedance ? {- ...seedanceCommonParams,+ const groupedHistorySettings = grouped ? {+ ...commonParams,workflowId: selectedWorkflowId,modelParameterValues: { ...generationParameterValues },} : {};const isExtendMode = currentModel?.requiresRequestId;const capabilities = getModelMediaCapabilities(currentModel);- const requestSource = generationSources[selectedFamily.id];- const trimmedPrompt = prompt.trim();+ const requestSource = selectedVeoTool ? selectedVeoSource : generationSources[selectedFamily.id];+ const trimmedPrompt = promptDisabled ? "" : prompt.trim();const workflowMedia = selectedWorkflowId? activeWorkflowMediaDraft || {}: {@@ -2059,7 +2087,7 @@ export default function VideoStudio({alert(`${selectedFamily.name} does not support audio references.`);return;}- if (currentModel?.promptRequired && !trimmedPrompt) {+ if ((currentModel?.promptRequired || veoContinuation?.promptRequired) && !trimmedPrompt) {alert(copy.errors.noPromptForModel);return;}@@ -2122,7 +2150,7 @@ export default function VideoStudio({const v2vParams = {model: selectedModel,...buildSupplementalInputPayload(currentModel, generationParameterValues),- ...seedanceCommonParams,+ ...commonParams,...referenceParams,};if (currentModel?.hasPrompt && trimmedPrompt) {@@ -2131,13 +2159,13 @@ export default function VideoStudio({res = await processV2V(apiKey, v2vParams);if (!res?.url) throw new Error(copy.errors.noVideoUrlReturned);- const genId = res.id || Date.now().toString();+ const genId = res.request_id || res.id || Date.now().toString();const entry = {id: genId,url: res.url,prompt: currentModel?.hasPrompt ? trimmedPrompt : "",model: selectedModel,- ...seedanceHistorySettings,+ ...groupedHistorySettings,timestamp: new Date().toISOString(),};addToLocalHistory(entry);@@ -2153,23 +2181,23 @@ export default function VideoStudio({const i2vParams = {model: selectedModel,...buildSupplementalInputPayload(currentModel, generationParameterValues),- ...seedanceCommonParams,+ ...commonParams,...referenceParams,};if (trimmedPrompt) i2vParams.prompt = trimmedPrompt;const aspectRatios = getAspectRatiosForI2VModel(selectedModel);- if (!seedance && aspectRatios.length > 0) i2vParams.aspect_ratio = selectedAr;+ if (!grouped && aspectRatios.length > 0) i2vParams.aspect_ratio = selectedAr;const durations = getDurationsForI2VModel(selectedModel);- if (!seedance && durations.length > 0) i2vParams.duration = selectedDuration;+ if (!grouped && durations.length > 0) i2vParams.duration = selectedDuration;const resolutions = getResolutionsForI2VModel(selectedModel);- if (!seedance && resolutions.length > 0) i2vParams.resolution = selectedResolution;- if (!seedance && selectedQuality) i2vParams.quality = selectedQuality;+ if (!grouped && resolutions.length > 0) i2vParams.resolution = selectedResolution;+ if (!grouped && selectedQuality) i2vParams.quality = selectedQuality;if (showEffect && selectedEffect) i2vParams.name = selectedEffect;res = await generateI2V(apiKey, i2vParams);if (!res?.url) throw new Error(copy.errors.noVideoUrlReturned);- const genId = res.id || Date.now().toString();+ const genId = res.request_id || res.id || Date.now().toString();setGenerationSources((sources) =>recordGenerationSource(sources, selectedFamily.id, genId, selectedModel),);@@ -2178,9 +2206,11 @@ export default function VideoStudio({url: res.url,prompt: trimmedPrompt,model: selectedModel,- ...(aspectRatios.length > 0 ? { aspect_ratio: selectedAr } : {}),- duration: selectedDuration,- ...seedanceHistorySettings,+ ...(!grouped ? {+ ...(aspectRatios.length > 0 ? { aspect_ratio: selectedAr } : {}),+ duration: selectedDuration,+ } : {}),+ ...groupedHistorySettings,timestamp: new Date().toISOString(),};addToLocalHistory(entry);@@ -2197,27 +2227,27 @@ export default function VideoStudio({const params = {model: selectedModel,...buildSupplementalInputPayload(currentModel, generationParameterValues),- ...seedanceCommonParams,+ ...commonParams,...referenceParams,};if (trimmedPrompt) params.prompt = trimmedPrompt;if (isExtendMode) {params.request_id = requestSource.requestId;- } else if (!seedance) {+ } else if (!grouped) {params.aspect_ratio = selectedAr;}const durations = getDurationsForModel(selectedModel);- if (!seedance && durations.length > 0) params.duration = selectedDuration;+ if (!grouped && durations.length > 0) params.duration = selectedDuration;const resolutions = getResolutionsForVideoModel(selectedModel);- if (!seedance && resolutions.length > 0) params.resolution = selectedResolution;- if (!seedance && selectedQuality) params.quality = selectedQuality;+ if (!grouped && resolutions.length > 0) params.resolution = selectedResolution;+ if (!grouped && !selectedVeoTool && selectedQuality) params.quality = selectedQuality;res = await generateVideo(apiKey, params);if (!res?.url) throw new Error(copy.errors.noVideoUrlReturned);- const genId = res.id || Date.now().toString();+ const genId = res.request_id || res.id || Date.now().toString();setGenerationSources((sources) =>recordGenerationSource(sources, selectedFamily.id, genId, selectedModel),);@@ -2226,9 +2256,11 @@ export default function VideoStudio({url: res.url,prompt: trimmedPrompt,model: selectedModel,- aspect_ratio: selectedAr,- duration: selectedDuration,- ...seedanceHistorySettings,+ ...(!grouped && !selectedVeoTool ? {+ aspect_ratio: selectedAr,+ duration: selectedDuration,+ } : {}),+ ...groupedHistorySettings,timestamp: new Date().toISOString(),};addToLocalHistory(entry);@@ -2254,6 +2286,7 @@ export default function VideoStudio({apiKey,copy,prompt,+ promptDisabled,v2vMode,imageMode,selectedWorkflowId,@@ -2272,6 +2305,9 @@ export default function VideoStudio({uploadedAudioUrls,activeWorkflowMediaDraft,generationSources,+ selectedVeoTool,+ selectedVeoSource,+ veoContinuation,mediaUploading,getCurrentModel,addToLocalHistory,@@ -2379,7 +2415,9 @@ export default function VideoStudio({? copy.placeholders.motionOrEffect: copy.placeholders.motionOrEffectOptional: isExtendMode- ? copy.placeholders.optionalContinueVideo+ ? veoContinuation?.promptRequired+ ? copy.placeholders.continueVideo+ : copy.placeholders.optionalContinueVideo: copy.placeholders.describeVideo;const {@@ -2578,15 +2616,15 @@ export default function VideoStudio({</div><h1 className="text-2xl sm:text-4xl md:text-5xl font-extrabold tracking-tight mb-4 text-center px-4 flex flex-col items-center">- {!selectedTool && <span className="text-white font-black uppercase text-xl sm:text-3xl tracking-wide mb-1 opacity-90">{copy.empty.heading}</span>}+ {!selectedTool && !selectedVeoTool && <span className="text-white font-black uppercase text-xl sm:text-3xl tracking-wide mb-1 opacity-90">{copy.empty.heading}</span>}<span className="text-[#22d3ee] font-black uppercase text-2xl sm:text-4xl sm:mt-1 tracking-tight">- {selectedTool || selectedPickerEntry?.groupedSeedance ? selectedPickerLabel : selectedFamily.name}+ {selectedTool || selectedVeoTool || selectedPickerEntry?.groupedVideo ? selectedPickerLabel : selectedFamily.name}</span></h1>- {!selectedTool && (+ {!selectedTool && !selectedVeoTool && (<p className="text-white/40 text-xs sm:text-sm font-medium tracking-wide text-center max-w-lg leading-relaxed px-4">- {seedanceConfiguration- ? getSeedanceModeDescription(selectedVariant.model, selectedWorkflowId, copy.seedance)+ {groupedConfiguration+ ? getVideoModeDescription(selectedVariant.model, selectedWorkflowId, groupCopy): copy.empty.subtitle}</p>)}@@ -2798,6 +2836,7 @@ export default function VideoStudio({{/* Prompt textarea */}<div className="flex-1 flex flex-col gap-1">+ {!(selectedVeoTool && promptDisabled) && (<PromptTextarearef={textareaRef}value={prompt}@@ -2805,11 +2844,31 @@ export default function VideoStudio({placeholder={promptPlaceholder}disabled={promptDisabled}/>+ )}</div></div>{/* Extend banner */}- {isExtendMode && (+ {selectedVeoTool ? (+ <div className="mx-3 rounded-lg border border-primary/10 bg-primary/5 px-3 py-2">+ {selectedVeoSource ? (+ <label className="flex min-w-0 items-center gap-3 text-xs text-white/70">+ <span className="shrink-0">{copy.veo.sourceVideo}</span>+ <select+ className="min-w-0 flex-1 rounded-lg border border-white/10 bg-[#17191c] px-2 py-2 text-xs text-white"+ value={selectedVeoSource.requestId}+ onChange={(event) => setSelectedVeoSourceId(event.target.value)}+ >+ {veoSources.map((entry, index) => (+ <option key={entry.requestId} value={entry.requestId}>{index + 1}. {entry.prompt || "Veo 3.1"}</option>+ ))}+ </select>+ </label>+ ) : (+ <p className="text-xs text-white/60">{copy.veo.sourceHelp[selectedVeoTool.key]}</p>+ )}+ </div>+ ) : isExtendMode && (<div className="flex items-center gap-2 px-3 py-1.5 mx-3 bg-primary/5 border border-primary/10 rounded-lg text-[10px] text-primary/80 font-medium tracking-tight"><svgwidth="13"@@ -2827,14 +2886,14 @@ export default function VideoStudio({</div>)}- {seedanceConfiguration && selectedVariant.model.aspectRatioMode === "inherited" && (- <p className="px-2 text-[10px] text-white/40">{copy.seedance.inheritedFormat}</p>+ {groupedConfiguration && selectedVariant.model.aspectRatioMode === "inherited" && (+ <p className="px-2 text-[10px] text-white/40">{groupCopy.inheritedFormat}</p>)}- {seedanceConfiguration && selectedWorkflowId === "extend_uploaded_video" && seedanceResolution.options.length === 0 && (- <p className="px-2 text-[10px] text-white/40">{copy.seedance.inheritedVideoResolution}</p>+ {groupedConfiguration && selectedWorkflowId === "extend_uploaded_video" && groupedResolution.options.length === 0 && (+ <p className="px-2 text-[10px] text-white/40">{groupCopy.inheritedVideoResolution}</p>)}- {seedanceResolution?.label && (- <p className="px-2 text-[10px] text-white/40">{copy.seedance.resolutionUnknown}</p>+ {groupedResolution?.label && (+ <p className="px-2 text-[10px] text-white/40">{groupCopy.resolutionUnknown}</p>)}{/* Bottom row: controls + generate */}@@ -2872,8 +2931,8 @@ export default function VideoStudio({<PromptPopoveronClick={(e) => e.stopPropagation()}className="w-[calc(100vw-2rem)] md:w-[480px] max-w-md md:max-w-none max-h-[70vh]"- fitViewport={Boolean(seedanceConfiguration)}- solid={Boolean(seedanceConfiguration)}+ fitViewport={Boolean(groupedConfiguration)}+ solid={Boolean(groupedConfiguration)}><PromptPopoverHeader>{copy.dropdowns.model}</PromptPopoverHeader><ModelDropdown@@ -2937,18 +2996,18 @@ export default function VideoStudio({})}><span className={PROMPT_CONTROL_LABEL_CLASS}>- {seedanceConfiguration- ? copy.seedance.modes[selectedWorkflowId || "text"]+ {groupedConfiguration+ ? groupCopy.modes[selectedWorkflowId || "text"]: getVideoWorkflowControlLabel(selectedWorkflow)}</span>{workflowControlState.kind === "menu" && <PromptChevronIcon />}</button>{workflowControlState.kind === "menu" && openDropdown === "workflow" && (<PromptPopover- className={seedanceConfiguration ? "w-[300px] max-w-[calc(100vw-32px)]" : "min-w-[210px]"}- fitViewport={Boolean(seedanceConfiguration)}- solid={Boolean(seedanceConfiguration)}- style={{ maxHeight: seedanceConfiguration ? "65vh" : "55vh" }}+ className={groupedConfiguration ? "w-[300px] max-w-[calc(100vw-32px)]" : "min-w-[210px]"}+ fitViewport={Boolean(groupedConfiguration)}+ solid={Boolean(groupedConfiguration)}+ style={{ maxHeight: groupedConfiguration ? "65vh" : "55vh" }}onClick={(event) => event.stopPropagation()}><PromptPopoverHeader>{copy.dropdowns.source}</PromptPopoverHeader>@@ -2960,13 +3019,13 @@ export default function VideoStudio({onKeyDown={handleWorkflowMenuKeyDown}className="flex flex-col gap-1">- {(seedanceConfiguration ? seedanceModes : workflowFamily.workflows).map((workflow) => (+ {(groupedConfiguration ? groupedModes : workflowFamily.workflows).map((workflow) => (<PromptMenuItemkey={workflow.id || "text"}selected={selectedWorkflowId === workflow.id}disabled={workflow.disabled}- wrapDescription={Boolean(seedanceConfiguration)}- description={seedanceConfiguration && (+ wrapDescription={Boolean(groupedConfiguration)}+ description={groupedConfiguration && (<>{workflow.description}{workflow.adjustmentDescription && (@@ -2985,7 +3044,7 @@ export default function VideoStudio({{workflow.label}</PromptMenuItem>))}- {!seedanceConfiguration && selectedWorkflow && workflowFamily?.hasBase && (+ {!groupedConfiguration && selectedWorkflow && workflowFamily?.hasBase && (<div className="mt-2 border-t border-white/[0.05] pt-2"><buttontype="button"@@ -3022,33 +3081,33 @@ export default function VideoStudio({</div>)}- <SeedanceOptionControl- label={copy.seedance.speed}- field={seedanceSpeed}- open={openDropdown === "seedance-speed"}- onToggle={toggleDropdown("seedance-speed")}+ <VideoOptionControl+ label={groupCopy.speed}+ field={groupedSpeed}+ open={openDropdown === "generation-speed"}+ onToggle={toggleDropdown("generation-speed")}onSelect={(option) => {- handleSeedanceOptionChange("speed", option.value);+ handleGroupedOptionChange("speed", option.value);setOpenDropdown(null);}}- copy={copy.seedance}+ copy={groupCopy}/>- {seedanceConfiguration ? (- <SeedanceSettingsControl- profile={seedanceProfile}- onDefaultResolution={seedanceConfiguration.profile === "legacy" && seedanceConfiguration.resolution !== "default"- ? () => handleSeedanceOptionChange("resolution", "default") : undefined}- qualities={seedanceCommonOptions.qualities}+ {groupedConfiguration ? (+ <VideoSettingsControl+ profile={groupedProfile}+ onDefaultResolution={groupedConfiguration.profile === "legacy" && groupedConfiguration.resolution !== "default"+ ? () => handleGroupedOptionChange("resolution", "default") : undefined}+ qualities={commonOptions.qualities}quality={selectedQuality}- onProfileChange={(value) => handleSeedanceOptionChange("profile", value)}+ onProfileChange={(value) => handleGroupedOptionChange("profile", value)}onQualityChange={setSelectedQuality}inputs={supplementalInputs}values={modelParameterValues}onChange={handleModelParameterChange}open={openDropdown === "parameters"}onToggle={toggleDropdown("parameters")}- copy={copy.seedance}+ copy={groupCopy}/>) : (<ModelParameterControls@@ -3156,7 +3215,25 @@ export default function VideoStudio({)}{/* Duration btn */}- {showDuration && (+ {groupedConfiguration && (+ <VideoOptionControl+ label={selectedWorkflowId === "extend_uploaded_video" ? groupCopy.extensionDuration : copy.dropdowns.duration}+ field={{+ key: "duration",+ value: selectedDuration,+ options: commonOptions.durations.map((value) => ({ value, label: `${value}s` })),+ }}+ icon={<PromptDurationIcon />}+ open={openDropdown === "duration"}+ onToggle={toggleDropdown("duration")}+ onSelect={(option) => {+ setSelectedDuration(option.value);+ setOpenDropdown(null);+ }}+ copy={groupCopy}+ />+ )}+ {!groupedConfiguration && showDuration && (<div className="relative"><buttontype="button"@@ -3175,9 +3252,7 @@ export default function VideoStudio({onClick={(e) => e.stopPropagation()}><PromptPopoverHeader>- {seedanceConfiguration && selectedWorkflowId === "extend_uploaded_video"- ? copy.seedance.extensionDuration- : copy.dropdowns.duration}+ {copy.dropdowns.duration}</PromptPopoverHeader><PromptMenuList>{getCurrentDurations(selectedModel).map((d) => (@@ -3200,16 +3275,16 @@ export default function VideoStudio({)}{/* Resolution btn */}- <SeedanceOptionControl+ <VideoOptionControllabel={copy.dropdowns.resolution}- field={seedanceResolution}+ field={groupedResolution}icon={<PromptQualityIcon />}open={openDropdown === "resolution"}onToggle={toggleDropdown("resolution")}- onSelect={handleSeedanceResolutionChange}- copy={copy.seedance}+ onSelect={handleGroupedResolutionChange}+ copy={groupCopy}/>- {!seedanceConfiguration && showResolution && (+ {!groupedConfiguration && showResolution && (<div className="relative"><buttontype="button"@@ -3276,7 +3351,7 @@ export default function VideoStudio({{/* Generate button */}<PromptActiononClick={handleGenerate}- disabled={generating || mediaUploading || (selectedTool?.group === "continueGenerated" && !hasContinuationSource)}+ disabled={generating || mediaUploading || (selectedTool?.group === "continueGenerated" && !hasContinuationSource) || (selectedVeoTool && !selectedVeoSource)}>{generating ? (<>diff --git a/packages/studio/src/groupedVideoModels.js b/packages/studio/src/groupedVideoModels.jsnew file mode 100644index 00000000..75cd2ea0--- /dev/null+++ b/packages/studio/src/groupedVideoModels.js@@ -0,0 +1,34 @@+import { SEEDANCE_MODEL_GROUP } from "./seedanceModels.js";+import { VEO_MODEL_GROUP } from "./veoModels.js";++const groups = [SEEDANCE_MODEL_GROUP, VEO_MODEL_GROUP];+const groupByFamilyId = new Map();+const configurationByModelId = new Map();+const familyNames = {};+const workflowVariants = {};+const EMPTY_OPTIONS = Object.freeze([]);++// Register providers once. Model selection does not scan providers or the catalog.+for (const group of groups) {+ Object.assign(familyNames, group.familyNames);+ Object.assign(workflowVariants, group.workflowVariants);+ for (const familyId of Object.keys(group.familyNames)) groupByFamilyId.set(familyId, group);+ for (const [modelId, configuration] of group.configurations) {+ configurationByModelId.set(modelId, configuration);+ }+}++export const GROUPED_VIDEO_FAMILY_NAMES = Object.freeze(familyNames);+export const GROUPED_VIDEO_WORKFLOW_VARIANTS = Object.freeze(workflowVariants);++export function getGroupedVideoConfiguration(modelId) {+ return configurationByModelId.get(modelId) || null;+}++export function resolveGroupedVideoVariant(options) {+ return groupByFamilyId.get(options.familyId)?.resolveVariant(options) ?? null;+}++export function getGroupedVideoVariantOptions(familyId, workflowId, modelId) {+ return groupByFamilyId.get(familyId)?.getVariantOptions(familyId, workflowId, modelId) ?? EMPTY_OPTIONS;+}diff --git a/packages/studio/src/groupedVideoParameters.js b/packages/studio/src/groupedVideoParameters.jsnew file mode 100644index 00000000..dcef7696--- /dev/null+++ b/packages/studio/src/groupedVideoParameters.js@@ -0,0 +1,45 @@+import {+ getSeedanceResolutionOptions,+ getSeedanceSelectionAdjustments,+ planSeedanceSelection,+} from "./seedanceParameters.js";+import { SEEDANCE_MODEL_GROUP } from "./seedanceModels.js";+import { VEO_MODEL_GROUP } from "./veoModels.js";+import { getGroupedVideoConfiguration } from "./groupedVideoModels.js";+import {+ getVeoResolutionOptions,+ getVeoSelectionAdjustments,+ planVeoSelection,+} from "./veoParameters.js";++const groups = [+ {+ familyNames: SEEDANCE_MODEL_GROUP.familyNames,+ plan: planSeedanceSelection,+ resolutions: getSeedanceResolutionOptions,+ adjustments: getSeedanceSelectionAdjustments,+ },+ {+ familyNames: VEO_MODEL_GROUP.familyNames,+ plan: planVeoSelection,+ resolutions: getVeoResolutionOptions,+ adjustments: getVeoSelectionAdjustments,+ },+];+const handlersByFamilyId = new Map();+for (const group of groups) {+ for (const familyId of Object.keys(group.familyNames)) handlersByFamilyId.set(familyId, group);+}++export function planGroupedVideoSelection(options) {+ return handlersByFamilyId.get(options.familyId)?.plan(options) ?? null;+}++export function getGroupedVideoResolutionOptions(familyId, ...args) {+ return handlersByFamilyId.get(familyId)?.resolutions(familyId, ...args) ?? { value: "", options: [] };+}++export function getGroupedVideoSelectionAdjustments(options) {+ const familyId = getGroupedVideoConfiguration(options.selection.modelId)?.familyId;+ return handlersByFamilyId.get(familyId)?.adjustments(options) ?? [];+}diff --git a/packages/studio/src/messages/en/videoStudio.json b/packages/studio/src/messages/en/videoStudio.jsonindex fde859a8..6b2052b9 100644--- a/packages/studio/src/messages/en/videoStudio.json+++ b/packages/studio/src/messages/en/videoStudio.json@@ -90,7 +90,7 @@"deleteItemFailed": "Failed to delete item","noContinuationSource": "Choose a compatible {family} result to continue."},- "seedance": {+ "modelControls": {"modes": {"text": "From prompt","animate_image": "Animate image",@@ -100,18 +100,12 @@"extend_uploaded_video": "Extend video"},"settings": "Settings",- "speed": "Speed",- "speeds": {- "standard": "Standard speed",- "fast": "Fast"- },"quality": "Quality","extensionDuration": "Extension duration","defaultResolution": "Service default","incompatible": "This choice is unavailable for this model version.","incompatibleShort": "Unavailable for this version","inheritedFormat": "Format follows the source image",- "tools": "Seedance video tools","inheritedVideoResolution": "Resolution follows the source video","modeDescriptions": {"text": "Create a video from your description.",@@ -121,6 +115,52 @@"edit_video": "Upload a video and describe your changes.","extend_uploaded_video": "Add new footage to the end of an uploaded video."},+ "defaultVariant": "Default",+ "advanced": "Advanced",+ "adjustments": {+ "resolution": "Uses {value}",+ "duration": "Duration: {value} s",+ "aspectRatio": "Format: {value}",+ "speed": "Speed: {value}",+ "profile": "Service: {value}",+ "quality": "Quality: {value}"+ },+ "fields": {+ "seed": {+ "title": "Seed",+ "description": "Use −1 for random results."+ },+ "high_bitrate": {+ "title": "High bitrate",+ "description": "Larger files, more detail."+ },+ "generate_audio": {+ "title": "Generate audio",+ "description": ""+ },+ "camera_fixed": {+ "title": "Fixed camera",+ "description": "Keep the camera still."+ }+ },+ "provider": "Generation service",+ "providerHelp": "Choose a specific service when needed.",+ "resolutionUnknown": "Output resolution is not specified by this service.",+ "referenceSupport": "Supports: {media}.",+ "referenceMediaTypes": {+ "image": "Images",+ "video": "Video",+ "audio": "Audio"+ },+ "restoreDefaultResolution": "Use the service’s default output size"+ },+ "seedance": {+ "speed": "Speed",+ "speeds": {+ "standard": "Standard speed",+ "fast": "Fast"+ },+ "tools": "Seedance video tools","profiles": {"standard": {"label": "Standard",@@ -155,36 +195,8 @@"description": ""}},- "defaultVariant": "Default","continueGenerated": "Continue a Seedance 2.0 result","removeWatermark": "Remove watermark",- "advanced": "Advanced",- "adjustments": {- "resolution": "Uses {value}",- "duration": "Duration: {value} s",- "aspectRatio": "Format: {value}",- "speed": "Speed: {value}",- "profile": "Service: {value}",- "quality": "Quality: {value}"- },- "fields": {- "seed": {- "title": "Seed",- "description": "Use −1 for random results."- },- "high_bitrate": {- "title": "High bitrate",- "description": "Larger files, more detail."- },- "generate_audio": {- "title": "Generate audio",- "description": ""- },- "camera_fixed": {- "title": "Fixed camera",- "description": "Keep the camera still."- }- },"toolNames": {"continueGenerated": "Continue Seedance 2.0","removeWatermark": "Remove watermark"@@ -194,19 +206,36 @@"vip": "VIP","pro": "Pro"},- "provider": "Generation service",- "providerHelp": "Choose a specific service when needed.",- "resolutionUnknown": "Output resolution is not specified by this service.",- "referenceSupport": "Supports: {media}.",- "referenceMediaTypes": {- "image": "Images",- "video": "Video",- "audio": "Audio"- },"editAudio": {"title": "New audio","description": "Off keeps the original audio."+ }+ },+ "veo": {+ "speed": "Generation",+ "speeds": {+ "standard": "Standard",+ "fast": "Fast",+ "lite": "Lite"},- "restoreDefaultResolution": "Use the service’s default output size"+ "speedDescriptions": {+ "standard": "",+ "fast": "Faster generation.",+ "lite": "Lower cost."+ },+ "tools": "Veo video tools",+ "toolNames": {+ "continueGenerated": "Continue Veo 3.1",+ "upscale": "Create a 4K copy"+ },+ "toolsHelp": "Use a completed Veo 3.1 video.",+ "sourceVideo": "Source video",+ "sourceHelp": {+ "continueGenerated": "Create a 720p video with Veo 3.1 Standard or Fast first.",+ "upscale": "Create a video with Veo 3.1 Standard or Fast first."+ },+ "adjustments": {+ "speed": "Generation: {value}"+ }}}diff --git a/packages/studio/src/messages/zh/videoStudio.json b/packages/studio/src/messages/zh/videoStudio.jsonindex 7ca01913..668be565 100644--- a/packages/studio/src/messages/zh/videoStudio.json+++ b/packages/studio/src/messages/zh/videoStudio.json@@ -90,7 +90,7 @@"deleteItemFailed": "删除项目失败","noContinuationSource": "请选择兼容的 {family} 结果继续生成。"},- "seedance": {+ "modelControls": {"modes": {"text": "文字生成","animate_image": "图片动画",@@ -100,18 +100,12 @@"extend_uploaded_video": "延长视频"},"settings": "设置",- "speed": "速度",- "speeds": {- "standard": "标准速度",- "fast": "快速"- },"quality": "质量","extensionDuration": "续接片段时长","defaultResolution": "服务默认值","incompatible": "此模型版本不支持该选择。","incompatibleShort": "此版本不支持","inheritedFormat": "画面比例继承自原始图片",- "tools": "Seedance 视频工具","inheritedVideoResolution": "分辨率继承自原始视频","modeDescriptions": {"text": "根据你的描述生成视频。",@@ -121,6 +115,52 @@"edit_video": "上传视频并描述你想修改的内容。","extend_uploaded_video": "在上传的视频末尾添加新的片段。"},+ "defaultVariant": "默认",+ "advanced": "高级",+ "adjustments": {+ "resolution": "使用 {value}",+ "duration": "时长:{value} 秒",+ "aspectRatio": "画面比例:{value}",+ "speed": "速度:{value}",+ "profile": "服务:{value}",+ "quality": "质量:{value}"+ },+ "fields": {+ "seed": {+ "title": "随机种子",+ "description": "设为 −1 使用随机结果。"+ },+ "high_bitrate": {+ "title": "高码率",+ "description": "更多细节,更大的文件。"+ },+ "generate_audio": {+ "title": "生成音频",+ "description": ""+ },+ "camera_fixed": {+ "title": "固定镜头",+ "description": "保持镜头静止。"+ }+ },+ "provider": "生成服务",+ "providerHelp": "有特定需要时,可选择指定服务。",+ "resolutionUnknown": "此服务未指定输出分辨率。",+ "referenceSupport": "支持:{media}。",+ "referenceMediaTypes": {+ "image": "图片",+ "video": "视频",+ "audio": "音频"+ },+ "restoreDefaultResolution": "使用服务默认的输出分辨率"+ },+ "seedance": {+ "speed": "速度",+ "speeds": {+ "standard": "标准速度",+ "fast": "快速"+ },+ "tools": "Seedance 视频工具","profiles": {"standard": {"label": "标准版",@@ -155,36 +195,8 @@"description": ""}},- "defaultVariant": "默认","continueGenerated": "续接 Seedance 2.0 结果","removeWatermark": "去除水印",- "advanced": "高级",- "adjustments": {- "resolution": "使用 {value}",- "duration": "时长:{value} 秒",- "aspectRatio": "画面比例:{value}",- "speed": "速度:{value}",- "profile": "服务:{value}",- "quality": "质量:{value}"- },- "fields": {- "seed": {- "title": "随机种子",- "description": "设为 −1 使用随机结果。"- },- "high_bitrate": {- "title": "高码率",- "description": "更多细节,更大的文件。"- },- "generate_audio": {- "title": "生成音频",- "description": ""- },- "camera_fixed": {- "title": "固定镜头",- "description": "保持镜头静止。"- }- },"toolNames": {"continueGenerated": "续接 Seedance 2.0","removeWatermark": "去除水印"@@ -194,19 +206,36 @@"vip": "VIP","pro": "Pro"},- "provider": "生成服务",- "providerHelp": "有特定需要时,可选择指定服务。",- "resolutionUnknown": "此服务未指定输出分辨率。",- "referenceSupport": "支持:{media}。",- "referenceMediaTypes": {- "image": "图片",- "video": "视频",- "audio": "音频"- },"editAudio": {"title": "新音频","description": "关闭时保留原音频。"+ }+ },+ "veo": {+ "speed": "生成方式",+ "speeds": {+ "standard": "标准",+ "fast": "快速",+ "lite": "轻量"},- "restoreDefaultResolution": "使用服务默认的输出分辨率"+ "speedDescriptions": {+ "standard": "",+ "fast": "生成更快。",+ "lite": "费用更低。"+ },+ "tools": "Veo 视频工具",+ "toolNames": {+ "continueGenerated": "续写 Veo 3.1",+ "upscale": "创建 4K 副本"+ },+ "toolsHelp": "使用已生成的 Veo 3.1 视频。",+ "sourceVideo": "源视频",+ "sourceHelp": {+ "continueGenerated": "请先使用 Veo 3.1 标准或快速模式生成 720p 视频。",+ "upscale": "请先使用 Veo 3.1 标准或快速模式生成视频。"+ },+ "adjustments": {+ "speed": "生成方式:{value}"+ }}}diff --git a/packages/studio/src/modelFamilies.js b/packages/studio/src/modelFamilies.jsindex 2529ea36..5701a3dd 100644--- a/packages/studio/src/modelFamilies.js+++ b/packages/studio/src/modelFamilies.js@@ -7,10 +7,10 @@ import {} from "./models.js";import { getModelMediaCapabilities } from "./modelCapabilities.js";import {- getSeedanceConfiguration,- resolveSeedanceVariant,- SEEDANCE_FAMILY_NAMES,-} from "./seedanceModels.js";+ getGroupedVideoConfiguration,+ resolveGroupedVideoVariant,+ GROUPED_VIDEO_FAMILY_NAMES,+} from "./groupedVideoModels.js";const IMAGE_FAMILY_ALIASES = {"bytedance-seededit-v3": "bytedance-seedream-v3",@@ -782,7 +782,7 @@ function buildVideoModelMenuEntries() {const groupedFamilies = new Set();const variantIdsByFamily = new Map();for (const variantId of videoModelCatalog.variantById.keys()) {- const config = getSeedanceConfiguration(variantId);+ const config = getGroupedVideoConfiguration(variantId);if (!config) continue;let variantIds = variantIdsByFamily.get(config.familyId);if (!variantIds) {@@ -792,7 +792,7 @@ function buildVideoModelMenuEntries() {variantIds.add(variantId);}for (const entry of videoModelPickerEntries) {- const config = getSeedanceConfiguration(entry.defaultVariant?.model.id);+ const config = getGroupedVideoConfiguration(entry.defaultVariant?.model.id);if (!config) {entries.push(entry);continue;@@ -808,7 +808,7 @@ function buildVideoModelMenuEntries() {v2v: ["edit_video", "extend_uploaded_video"],})) {for (const workflowId of workflowIds) {- const variantId = resolveSeedanceVariant({ familyId: config.familyId, workflowId });+ const variantId = resolveGroupedVideoVariant({ familyId: config.familyId, workflowId });const variant = videoModelCatalog.variantById.get(variantId);if (variant?.mode === mode) {variantsByMode[mode] = variant;@@ -816,12 +816,12 @@ function buildVideoModelMenuEntries() {}}}- const name = SEEDANCE_FAMILY_NAMES[config.familyId];+ const name = GROUPED_VIDEO_FAMILY_NAMES[config.familyId];entries.push(Object.freeze({id: `${config.familyId}:grouped`,family,name,- groupedSeedance: true,+ groupedVideo: true,variantIds,variantsByMode,defaultVariant: variantsByMode.t2v || variantsByMode.i2v || variantsByMode.v2v,diff --git a/packages/studio/src/models.js b/packages/studio/src/models.jsindex be334ba8..d593e6b5 100644--- a/packages/studio/src/models.js+++ b/packages/studio/src/models.js@@ -4538,7 +4538,9 @@ export const t2vModels = [},"resolution": {"enum": [- "1080p"+ "720p",+ "1080p",+ "4k"],"title": "Resolution","name": "resolution",@@ -4583,7 +4585,9 @@ export const t2vModels = [},"resolution": {"enum": [- "1080p"+ "720p",+ "1080p",+ "4k"],"title": "Resolution","name": "resolution",@@ -4628,7 +4632,9 @@ export const t2vModels = [},"resolution": {"enum": [- "1080p"+ "720p",+ "1080p",+ "4k"],"title": "Resolution","name": "resolution",@@ -13084,6 +13090,7 @@ export const i2vModels = ["family": "veo","imageField": "images_list","hasPrompt": true,+ "promptRequired": true,"inputs": {"prompt": {"type": "string",@@ -13116,6 +13123,7 @@ export const i2vModels = ["family": "veo","imageField": "images_list","hasPrompt": true,+ "promptRequired": true,"inputs": {"prompt": {"type": "string",@@ -14425,7 +14433,9 @@ export const i2vModels = ["name": "resolution","description": "The resolution of the generated video.","enum": [- "1080p"+ "720p",+ "1080p",+ "4k"],"default": "1080p"}@@ -14479,7 +14489,9 @@ export const i2vModels = ["name": "resolution","description": "The resolution of the generated video.","enum": [- "1080p"+ "720p",+ "1080p",+ "4k"],"default": "1080p"}@@ -14530,7 +14542,9 @@ export const i2vModels = ["name": "resolution","description": "The resolution of the generated video.","enum": [- "1080p"+ "720p",+ "1080p",+ "4k"],"default": "1080p"}@@ -14564,7 +14578,8 @@ export const i2vModels = ["description": "The resolution of the generated video.","enum": ["720p",- "1080p"+ "1080p",+ "4k"],"default": "720p"},diff --git a/packages/studio/src/seedanceModels.js b/packages/studio/src/seedanceModels.jsindex 4f12555e..b82a8396 100644--- a/packages/studio/src/seedanceModels.js+++ b/packages/studio/src/seedanceModels.js@@ -299,3 +299,11 @@ export function getSeedanceVariantOptions(familyId, workflowId = null, currentMoconst selected = current?.familyId === familyId ? current : group.defaultConfiguration;return group.optionsByCoordinates.get(coordinateKey(selected));}++export const SEEDANCE_MODEL_GROUP = Object.freeze({+ familyNames: SEEDANCE_FAMILY_NAMES,+ configurations,+ workflowVariants: SEEDANCE_WORKFLOW_VARIANTS,+ resolveVariant: resolveSeedanceVariant,+ getVariantOptions: getSeedanceVariantOptions,+});diff --git a/packages/studio/src/seedanceParameters.js b/packages/studio/src/seedanceParameters.jsindex e0c7618b..1a25689a 100644--- a/packages/studio/src/seedanceParameters.js+++ b/packages/studio/src/seedanceParameters.js@@ -6,75 +6,11 @@ import {resolveSeedanceVariant,} from "./seedanceModels.js";-const COMMON_FIELDS = Object.freeze([- ["aspectRatio", "aspect_ratio", "aspectRatios"],- ["duration", "duration", "durations"],- ["resolution", "resolution", "resolutions"],- ["quality", "quality", "qualities"],-]);--function schemaOptions(schema) {- if (!schema) return [];- if (Array.isArray(schema.enum)) return [...schema.enum];- const minimum = schema.minValue ?? schema.minimum;- const maximum = schema.maxValue ?? schema.maximum;- const step = schema.step ?? (["int", "integer"].includes(schema.type) ? 1 : undefined);- if (- Number.isFinite(minimum) && Number.isFinite(maximum) &&- Number.isFinite(step) && step > 0 && maximum >= minimum- ) {- const count = Math.floor((maximum - minimum) / step + 1e-9) + 1;- // Common controls are small selects. Do not materialize an unbounded or- // unexpectedly large range from a future provider schema.- if (count > 1000) return [];- return Array.from({ length: count }, (_, index) =>- Number((minimum + index * step).toFixed(10)));- }- return schema.default === undefined ? [] : [schema.default];-}--function matchingValue(options, value) {- if (value === undefined || value === null || value === "") return undefined;- return options.find((option) => option === value || String(option) === String(value));-}--function nearestDuration(options, value) {- if (value === undefined || value === null || value === "" || !Number.isFinite(Number(value))) return undefined;- let nearest;- for (const option of options) {- if (Number.isFinite(Number(option)) &&- (nearest === undefined || Math.abs(Number(option) - Number(value)) < Math.abs(Number(nearest) - Number(value)))) {- nearest = option;- }- }- return nearest;-}--export function getSeedanceCommonOptions(model) {- return Object.fromEntries(COMMON_FIELDS.map(([, field, key]) =>- [key, field === "aspect_ratio" && model?.aspectRatioMode === "inherited"- ? []- : schemaOptions(model?.inputs?.[field])]));-}--export function getSeedanceCommonValues(model, previous = {}) {- const options = getSeedanceCommonOptions(model);- return Object.fromEntries(COMMON_FIELDS.map(([key, field, optionsKey]) => {- const allowed = options[optionsKey];- const value = matchingValue(allowed, previous[key]) ??- (key === "duration" ? nearestDuration(allowed, previous[key]) : undefined) ??- matchingValue(allowed, model?.inputs?.[field]?.default) ?? allowed[0];- return [key, value];- }));-}--export function buildSeedanceCommonPayload(model, values = {}) {- const options = getSeedanceCommonOptions(model);- return Object.fromEntries(COMMON_FIELDS.flatMap(([key, field, optionsKey]) => {- const value = matchingValue(options[optionsKey], values[key]);- return value === undefined ? [] : [[field, value]];- }));-}+import {+ getVideoCommonOptions,+ getVideoCommonValues,+ matchingVideoParameterValue as matchingValue,+} from "./videoModelParameters.js";function resolutionLabel(value) {return String(value).toLowerCase() === "4k" ? "4K" : String(value);@@ -87,7 +23,7 @@ function modelForId(modelId) {function followsSourceVideoResolution(modelId) {const config = getSeedanceConfiguration(modelId);if (config.resolution !== "default" || !config.workflowIds.includes("extend_uploaded_video") ||- getSeedanceCommonOptions(modelForId(modelId)).resolutions.length) return false;+ getVideoCommonOptions(modelForId(modelId)).resolutions.length) return false;return !getSeedanceVariantOptions(config.familyId, "extend_uploaded_video", modelId).some((field) => field.key === "resolution" && field.options.some((option) =>!option.disabled && option.value !== "default"));@@ -101,7 +37,7 @@ for (const { model } of videoModelCatalog.variantById.values()) {if (!config) continue;let workflows = selectionCandidates.get(config.familyId);if (!workflows) selectionCandidates.set(config.familyId, workflows = new Map());- const candidate = { model, config, options: getSeedanceCommonOptions(model) };+ const candidate = { model, config, options: getVideoCommonOptions(model) };for (const workflowId of config.workflowIds) {let candidates = workflows.get(workflowId);if (!candidates) workflows.set(workflowId, candidates = []);@@ -117,7 +53,7 @@ function effectiveResolution(modelId, nativeResolution) {if (!config) return undefined;const fixed = getSeedanceEndpointResolution(modelId);if (fixed !== undefined) return fixed;- const native = getSeedanceCommonValues(modelForId(modelId), { resolution: nativeResolution }).resolution;+ const native = getVideoCommonValues(modelForId(modelId), { resolution: nativeResolution }).resolution;if (native !== undefined) return normalizeResolution(native);return followsSourceVideoResolution(modelId) ? undefined : "default";}@@ -141,7 +77,7 @@ function compareScores(left, right) {}function commonAdjustments(model, previous) {- const target = getSeedanceCommonValues(model, previous);+ const target = getVideoCommonValues(model, previous);return ["duration", "aspectRatio", "quality"].flatMap((key) =>previous[key] !== undefined && target[key] !== undefined && String(previous[key]) !== String(target[key])? [{ key, from: previous[key], to: target[key] }] : []);@@ -166,7 +102,7 @@ export function getSeedanceSelectionAdjustments({resolution !== undefined && sourceResolution !== resolution) {adjustments.push({ key: "resolution", from: sourceResolution, to: resolution });}- const visibleCommonValues = getSeedanceCommonValues(modelForId(currentModelId), commonValues);+ const visibleCommonValues = getVideoCommonValues(modelForId(currentModelId), commonValues);adjustments.push(...commonAdjustments(modelForId(selection.modelId), visibleCommonValues));return adjustments;}@@ -209,7 +145,7 @@ export function planSeedanceSelection({if (candidate.config.profile.startsWith("legacy") &&candidate.config.profile !== current?.profile && changes.profile !== candidate.config.profile) continue;const { model, config, options } = candidate;- let resolution = getSeedanceCommonValues(model).resolution;+ let resolution = getVideoCommonValues(model).resolution;if (Object.hasOwn(changes, "resolution")) {if (changes.resolution === "default") {if (config.resolution !== "default") continue;@@ -260,7 +196,7 @@ export function resolveSeedanceSelection({});const withDefaultResolution = (modelId) => {if (!modelId) return null;- const resolution = getSeedanceCommonValues(modelForId(modelId)).resolution;+ const resolution = getVideoCommonValues(modelForId(modelId)).resolution;return { modelId, ...(resolution === undefined ? {} : { resolution }) };};@@ -272,7 +208,7 @@ export function resolveSeedanceSelection({// variants whose provider contract has no native resolution input.for (const modelId of new Set([resolve("default"), resolve(size)])) {if (!modelId) continue;- const native = getSeedanceCommonOptions(modelForId(modelId)).resolutions+ const native = getVideoCommonOptions(modelForId(modelId)).resolutions.find((value) => normalizeResolution(value) === size);if (native !== undefined) return { modelId, resolution: native };if (getSeedanceEndpointResolution(modelId) === size) return { modelId };@@ -291,7 +227,7 @@ export function resolveSeedanceSelection({// The UI can retain its earlier native setting while this field is hidden// and restore that preference when returning to a compatible mode.if (modelId && followsSourceVideoResolution(currentModelId)) {- const resolution = matchingValue(getSeedanceCommonOptions(modelForId(modelId)).resolutions, nativeResolution);+ const resolution = matchingValue(getVideoCommonOptions(modelForId(modelId)).resolutions, nativeResolution);if (resolution !== undefined) return { modelId, resolution };}return withDefaultResolution(modelId);@@ -304,7 +240,7 @@ export function resolveSeedanceSelection({const candidates = new Set([resolve("default"), resolve(), resolve(outputResolution)]);for (const modelId of candidates) {if (!modelId) continue;- const nativeOptions = getSeedanceCommonOptions(modelForId(modelId)).resolutions;+ const nativeOptions = getVideoCommonOptions(modelForId(modelId)).resolutions;const resolution = nativeOptions.find((option) =>String(option).toLowerCase() === outputResolution);if (resolution !== undefined) return { modelId, resolution };@@ -318,7 +254,7 @@ export function resolveSeedanceSelection({// output-size input. Keep the fallback for catalogs that may still be stale.export function migrateSeedanceResolutionSelection(modelId, resolution) {if (modelId !== "seedance-2.5-spicy-text-to-video" && modelId !== "seedance-2.5-spicy-image-to-video") return modelId;- if (getSeedanceCommonOptions(modelForId(modelId)).resolutions.length) return modelId;+ if (getVideoCommonOptions(modelForId(modelId)).resolutions.length) return modelId;return resolveSeedanceSelection({familyId: "seedance-2.5",workflowId: modelId.endsWith("image-to-video") ? "animate_image" : null,diff --git a/packages/studio/src/veoModels.js b/packages/studio/src/veoModels.jsnew file mode 100644index 00000000..e3c85f8f--- /dev/null+++ b/packages/studio/src/veoModels.js@@ -0,0 +1,98 @@+import { i2vModels, t2vModels } from "./models.js";++export const VEO_FAMILY_NAMES = Object.freeze({+ "veo-4": "Veo 4",+ "veo-3.1": "Veo 3.1",+ "veo-3": "Veo 3",+});++const SPEED_OPTIONS = Object.freeze([+ { value: "standard", label: "Standard" },+ { value: "fast", label: "Fast" },+ { value: "lite", label: "Lite" },+]);+const EMPTY_OPTIONS = Object.freeze([]);+const modelIds = new Set([...t2vModels, ...i2vModels].map((model) => model.id));+const configurations = new Map();+const selectionIndex = new Map();++function register(modelId, familyId, speed, workflowIds) {+ if (!modelIds.has(modelId)) return;+ configurations.set(modelId, Object.freeze({+ familyId, speed, workflowIds: Object.freeze(workflowIds),+ }));+ let workflows = selectionIndex.get(familyId);+ if (!workflows) selectionIndex.set(familyId, workflows = new Map());+ for (const workflowId of workflowIds) {+ let variants = workflows.get(workflowId);+ if (!variants) workflows.set(workflowId, variants = new Map());+ variants.set(speed, modelId);+ }+}++// Generation variants only. Extension and 4K upscaling require a previous+// request ID and remain separate tools in the model menu.+for (const [familyId, prefix, speeds] of [+ ["veo-3", "veo3", ["standard", "fast"]],+ ["veo-3.1", "veo3.1", ["standard", "fast", "lite"]],+ ["veo-4", "veo-4", ["standard"]],+]) {+ for (const speed of speeds) {+ const stem = `${prefix}${speed === "standard" ? "" : `-${speed}`}`;+ register(`${stem}-text-to-video`, familyId, speed, [null]);+ register(`${stem}-image-to-video`, familyId, speed,+ familyId === "veo-3.1" ? ["animate_image", "keyframes"] : ["animate_image"]);+ }+}+register("veo3.1-reference-to-video", "veo-3.1", "standard", ["references"]);++const tools = new Map([+ ["veo3.1-extend-video", { key: "continueGenerated", order: 0 }],+ ["veo3.1-4k-video", { key: "upscale", order: 1 }],+]);++export function getVeoToolConfiguration(modelId) {+ return tools.get(modelId);+}++export const VEO_WORKFLOW_VARIANTS = Object.freeze(Object.fromEntries(+ [...selectionIndex].map(([familyId, workflows]) => [familyId, Object.freeze(Object.fromEntries(+ [...workflows].filter(([workflowId]) => workflowId !== null)+ .map(([workflowId, variants]) => [workflowId, Object.freeze([...variants.values()])]),+ ))]),+));++export function getVeoConfiguration(modelId) {+ return configurations.get(modelId) || null;+}++export function resolveVeoVariant({+ familyId, workflowId = null, currentModelId = null, changes = {},+}) {+ if (Object.keys(changes).some((key) => key !== "speed")) return null;+ const variants = selectionIndex.get(familyId)?.get(workflowId);+ if (!variants) return null;+ const current = getVeoConfiguration(currentModelId);+ const speed = changes.speed ?? (current?.familyId === familyId ? current.speed : "standard");+ return variants.get(speed) || null;+}++export function getVeoVariantOptions(familyId, workflowId = null, currentModelId = null) {+ const variants = selectionIndex.get(familyId)?.get(workflowId);+ if (!variants || variants.size < 2) return EMPTY_OPTIONS;+ const current = getVeoConfiguration(currentModelId);+ return [{+ key: "speed",+ label: "Speed",+ value: current?.familyId === familyId ? current.speed : "standard",+ options: SPEED_OPTIONS.filter((option) => variants.has(option.value)),+ }];+}++export const VEO_MODEL_GROUP = Object.freeze({+ familyNames: VEO_FAMILY_NAMES,+ configurations,+ workflowVariants: VEO_WORKFLOW_VARIANTS,+ resolveVariant: resolveVeoVariant,+ getVariantOptions: getVeoVariantOptions,+});diff --git a/packages/studio/src/veoParameters.js b/packages/studio/src/veoParameters.jsnew file mode 100644index 00000000..ed9dda98--- /dev/null+++ b/packages/studio/src/veoParameters.js@@ -0,0 +1,93 @@+import { videoModelCatalog } from "./modelFamilies.js";+import { getVeoConfiguration, resolveVeoVariant } from "./veoModels.js";+import { getVideoCommonOptions, getVideoCommonValues } from "./videoModelParameters.js";++const normalizeResolution = (value) => String(value).toLowerCase();+const modelForId = (modelId) => videoModelCatalog.variantById.get(modelId)?.model;++function matchingResolution(model, value) {+ return getVideoCommonOptions(model).resolutions.find((option) =>+ normalizeResolution(option) === normalizeResolution(value));+}++export function getVeoSelectionAdjustments({+ currentModelId, nativeResolution, commonValues = {}, selection, changes = {},+}) {+ const current = getVeoConfiguration(currentModelId);+ const target = getVeoConfiguration(selection.modelId);+ if (!current || current.familyId !== target?.familyId) return [];+ const adjustments = !Object.hasOwn(changes, "speed") && current.speed !== target.speed+ ? [{ key: "speed", from: current.speed, to: target.speed }]+ : [];+ const sourceModel = modelForId(currentModelId);+ const previous = getVideoCommonValues(sourceModel, {+ ...commonValues,+ resolution: matchingResolution(sourceModel, nativeResolution ?? commonValues.resolution),+ });+ const next = getVideoCommonValues(modelForId(selection.modelId), {+ ...commonValues, resolution: selection.resolution,+ });+ for (const key of ["aspectRatio", "duration", "resolution", "quality"]) {+ if (!Object.hasOwn(changes, key) && previous[key] !== undefined && next[key] !== undefined &&+ String(previous[key]) !== String(next[key])) {+ adjustments.push({ key, from: previous[key], to: next[key] });+ }+ }+ return adjustments;+}++export function planVeoSelection({+ familyId, workflowId = null, currentModelId, changes = {},+ nativeResolution, commonValues = {},+}) {+ if (Object.keys(changes).some((key) => key !== "speed" && key !== "resolution")) return null;+ const speedChanges = Object.hasOwn(changes, "speed") ? { speed: changes.speed } : {};+ let modelId = resolveVeoVariant({ familyId, workflowId, currentModelId, changes: speedChanges });+ // References have one service. Switching modes may select Standard, while+ // an explicit Fast or Lite request must never silently choose another one.+ if (!modelId && !Object.hasOwn(changes, "speed")) {+ modelId = resolveVeoVariant({ familyId, workflowId });+ }+ if (!modelId) return null;+ const model = modelForId(modelId);+ const current = getVeoConfiguration(currentModelId);+ const previous = current?.familyId === familyId ? commonValues : {};+ const desiredResolution = Object.hasOwn(changes, "resolution")+ ? changes.resolution+ : current?.familyId === familyId ? nativeResolution ?? previous.resolution : undefined;+ const matchedResolution = matchingResolution(model, desiredResolution);+ if (Object.hasOwn(changes, "resolution") && matchedResolution === undefined) return null;+ const resolution = getVideoCommonValues(model, {+ ...previous, resolution: matchedResolution,+ }).resolution;+ const selection = { modelId, ...(resolution === undefined ? {} : { resolution }) };+ return {+ selection,+ adjustments: getVeoSelectionAdjustments({+ currentModelId, nativeResolution, commonValues, selection, changes,+ }),+ };+}++export function getVeoResolutionOptions(+ familyId, workflowId = null, currentModelId = null, nativeResolution,+) {+ const config = getVeoConfiguration(currentModelId);+ if (!config || config.familyId !== familyId || !config.workflowIds.includes(workflowId)) {+ return { value: "", options: [] };+ }+ const model = modelForId(currentModelId);+ const resolution = getVideoCommonValues(model, {+ resolution: matchingResolution(model, nativeResolution),+ }).resolution;+ return {+ value: resolution === undefined ? "" : normalizeResolution(resolution),+ options: getVideoCommonOptions(model).resolutions.map((value) => ({+ value: normalizeResolution(value),+ label: normalizeResolution(value) === "4k" ? "4K" : String(value),+ modelId: currentModelId,+ resolution: value,+ disabled: false,+ })),+ };+}diff --git a/packages/studio/src/seedanceCopy.js b/packages/studio/src/videoModelCopy.jssimilarity index 85%rename from packages/studio/src/seedanceCopy.jsrename to packages/studio/src/videoModelCopy.jsindex 82aec6c0..fc20084e 100644--- a/packages/studio/src/seedanceCopy.js+++ b/packages/studio/src/videoModelCopy.js@@ -1,6 +1,6 @@import { getVideoWorkflowMediaSlots } from "./videoWorkflows.js";-export function getSeedanceModeDescription(model, workflowId, copy) {+export function getVideoModeDescription(model, workflowId, copy) {const description = copy.modeDescriptions[workflowId || "text"];if (workflowId !== "references" || !model) return description;diff --git a/packages/studio/src/videoModelParameters.js b/packages/studio/src/videoModelParameters.jsnew file mode 100644index 00000000..f3a0eec9--- /dev/null+++ b/packages/studio/src/videoModelParameters.js@@ -0,0 +1,76 @@+const COMMON_FIELDS = Object.freeze([+ ["aspectRatio", "aspect_ratio", "aspectRatios"],+ ["duration", "duration", "durations"],+ ["resolution", "resolution", "resolutions"],+ ["quality", "quality", "qualities"],+]);+const optionsByModel = new WeakMap();+const EMPTY_OPTIONS = Object.fromEntries(COMMON_FIELDS.map(([, , key]) => [key, []]));++function schemaOptions(schema) {+ if (!schema) return [];+ if (Array.isArray(schema.enum)) return [...schema.enum];+ const minimum = schema.minValue ?? schema.minimum;+ const maximum = schema.maxValue ?? schema.maximum;+ const step = schema.step ?? (["int", "integer"].includes(schema.type) ? 1 : undefined);+ if (+ Number.isFinite(minimum) && Number.isFinite(maximum) &&+ Number.isFinite(step) && step > 0 && maximum >= minimum+ ) {+ const count = Math.floor((maximum - minimum) / step + 1e-9) + 1;+ // Common controls are small selects. Do not materialize an unbounded or+ // unexpectedly large range from a future provider schema.+ if (count > 1000) return [];+ return Array.from({ length: count }, (_, index) =>+ Number((minimum + index * step).toFixed(10)));+ }+ return schema.default === undefined ? [] : [schema.default];+}++export function matchingVideoParameterValue(options, value) {+ if (value === undefined || value === null || value === "") return undefined;+ return options.find((option) => option === value || String(option) === String(value));+}++function nearestDuration(options, value) {+ if (value === undefined || value === null || value === "" || !Number.isFinite(Number(value))) return undefined;+ let nearest;+ for (const option of options) {+ if (Number.isFinite(Number(option)) &&+ (nearest === undefined || Math.abs(Number(option) - Number(value)) < Math.abs(Number(nearest) - Number(value)))) {+ nearest = option;+ }+ }+ return nearest;+}++export function getVideoCommonOptions(model) {+ if (!model) return EMPTY_OPTIONS;+ const cached = optionsByModel.get(model);+ if (cached) return cached;+ const options = Object.fromEntries(COMMON_FIELDS.map(([, field, key]) =>+ [key, field === "aspect_ratio" && model.aspectRatioMode === "inherited"+ ? []+ : schemaOptions(model.inputs?.[field])]));+ optionsByModel.set(model, options);+ return options;+}++export function getVideoCommonValues(model, previous = {}) {+ const options = getVideoCommonOptions(model);+ return Object.fromEntries(COMMON_FIELDS.map(([key, field, optionsKey]) => {+ const allowed = options[optionsKey];+ const value = matchingVideoParameterValue(allowed, previous[key]) ??+ (key === "duration" ? nearestDuration(allowed, previous[key]) : undefined) ??+ matchingVideoParameterValue(allowed, model?.inputs?.[field]?.default) ?? allowed[0];+ return [key, value];+ }));+}++export function buildVideoCommonPayload(model, values = {}) {+ const options = getVideoCommonOptions(model);+ return Object.fromEntries(COMMON_FIELDS.flatMap(([key, field, optionsKey]) => {+ const value = matchingVideoParameterValue(options[optionsKey], values[key]);+ return value === undefined ? [] : [[field, value]];+ }));+}diff --git a/packages/studio/src/videoWorkflows.js b/packages/studio/src/videoWorkflows.jsindex 7c2bbfda..e2c23ff4 100644--- a/packages/studio/src/videoWorkflows.js+++ b/packages/studio/src/videoWorkflows.js@@ -3,11 +3,12 @@ import {videoModelCatalog,videoModelPickerEntryByVariantId,} from "./modelFamilies.js";+import { getSeedanceConfiguration } from "./seedanceModels.js";import {- SEEDANCE_WORKFLOW_VARIANTS,- getSeedanceConfiguration,- resolveSeedanceVariant,-} from "./seedanceModels.js";+ GROUPED_VIDEO_WORKFLOW_VARIANTS,+ getGroupedVideoConfiguration,+ resolveGroupedVideoVariant,+} from "./groupedVideoModels.js";export const VIDEO_WORKFLOW_IDS = Object.freeze(["animate_image",@@ -92,19 +93,6 @@ export const VIDEO_WORKFLOW_VARIANTS = Object.freeze({animate_image: ["grok-imagine-video-1-5-preview"],references: ["grok-imagine-image-to-video"],},- "veo-3.1": {- animate_image: [- "veo3.1-image-to-video",- "veo3.1-fast-image-to-video",- "veo3.1-lite-image-to-video",- ],- keyframes: [- "veo3.1-image-to-video",- "veo3.1-fast-image-to-video",- "veo3.1-lite-image-to-video",- ],- references: ["veo3.1-reference-to-video"],- },"wan-2.7": {animate_image: ["wan2.7-image-to-video"],keyframes: ["wan2.7-image-to-video"],@@ -189,7 +177,7 @@ export const VIDEO_WORKFLOW_VARIANTS = Object.freeze({],keyframes: ["kling-v2.1-pro-i2v"],},- ...SEEDANCE_WORKFLOW_VARIANTS,+ ...GROUPED_VIDEO_WORKFLOW_VARIANTS,});const TECHNICAL_EXCLUDED_VARIANTS = Object.freeze({@@ -309,7 +297,10 @@ export function getVideoWorkflowControlState(workflowFamilyOrId, variantId = nul: workflowFamilyOrId;if (!workflowFamily) return { kind: "hidden", workflow: null };- if (variantId && workflowFamily.unmanagedVariantIds?.has(variantId)) {+ if (variantId && (+ videoModelCatalog.variantById.get(variantId)?.model.requiresRequestId ||+ workflowFamily.unmanagedVariantIds?.has(variantId)+ )) {return { kind: "hidden", workflow: null };}@@ -415,15 +406,15 @@ function sameFamilyVariantId(familyId, variantId) {: null;}-function resolveSeedanceWorkflowVariant(+function resolveGroupedWorkflowVariant(familyId,workflowId,group,currentVariantId,preferredVariantId,) {- const current = getSeedanceConfiguration(currentVariantId);- const preferred = getSeedanceConfiguration(preferredVariantId);+ const current = getGroupedVideoConfiguration(currentVariantId);+ const preferred = getGroupedVideoConfiguration(preferredVariantId);const hasCurrent = current?.familyId === familyId;const hasPreferred = preferred?.familyId === familyId;// Remembering a workflow must not silently change a selected service,@@ -437,7 +428,7 @@ function resolveSeedanceWorkflowVariant(const remembered = variantForId(group, preferredVariantId);if (remembered) return remembered;}- const variantId = resolveSeedanceVariant({+ const variantId = resolveGroupedVideoVariant({familyId,workflowId,currentModelId: hasCurrent@@ -455,8 +446,8 @@ export function resolveVideoWorkflowVariant() {const group = getVideoWorkflowGroup(familyId, workflowId);if (!group) return null;- if (SEEDANCE_WORKFLOW_VARIANTS[familyId]) {- return resolveSeedanceWorkflowVariant(+ if (GROUPED_VIDEO_WORKFLOW_VARIANTS[familyId]) {+ return resolveGroupedWorkflowVariant(familyId, workflowId, group, currentVariantId, preferredVariantId,);}@@ -474,8 +465,8 @@ export function resolveVideoBaseVariant() {const group = getVideoWorkflowGroup(familyId, null);if (!group) return null;- if (SEEDANCE_WORKFLOW_VARIANTS[familyId]) {- return resolveSeedanceWorkflowVariant(+ if (GROUPED_VIDEO_WORKFLOW_VARIANTS[familyId]) {+ return resolveGroupedWorkflowVariant(familyId, null, group, currentVariantId, preferredVariantId,);}@@ -506,7 +497,7 @@ export function resolvePersistedVideoWorkflowSelection(const family = videoModelCatalog.familyByVariantId.get(variantId) || null;const variant = videoModelCatalog.variantById.get(variantId) || null;const workflowFamily = family ? getVideoWorkflowFamily(family.id) : null;- if (!family || !variant || !workflowFamily) {+ if (!family || !variant || !workflowFamily || variant.model.requiresRequestId) {return { family, variant, workflowId: null };}@@ -748,11 +739,12 @@ export function getVideoWorkflowMediaSlots(model, workflowId) {Math.max(capabilities.image.maxItems, 1),{isArray: capabilities.image.isArray,- ...(SEEDANCE_WORKFLOW_VARIANTS[familyId] &&- model.inputs?.[capabilities.image.field]?.minItems > 0+ ...((getSeedanceConfiguration(model.id) &&+ model.inputs?.[capabilities.image.field]?.minItems > 0) ||+ model.id === "veo3.1-reference-to-video"? {required: true,- minItems: model.inputs[capabilities.image.field].minItems,+ minItems: model.inputs?.[capabilities.image.field]?.minItems || 1,requiredMessage: "Please add a reference image.",}: {}),