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 MiniMax model selection
antilya5ad20886b04f
diff --git a/packages/studio/src/components/VideoStudio.jsx b/packages/studio/src/components/VideoStudio.jsxindex 2b8b7b27..eeceab5c 100644--- a/packages/studio/src/components/VideoStudio.jsx+++ b/packages/studio/src/components/VideoStudio.jsx@@ -29,8 +29,8 @@ import {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 { getVeoToolConfiguration } from "../veoModels.js";+import { getGroupedVideoConfiguration, getGroupedVideoCopyKey, getGroupedVideoVariantOptions } from "../groupedVideoModels.js";import {getVideoCommonOptions,getVideoCommonValues,@@ -1048,12 +1048,14 @@ export default function VideoStudio({? workflowFamily?.workflowById.get(selectedWorkflowId) || null: null;const groupedConfiguration = getGroupedVideoConfiguration(selectedModel);- const isVeo = Boolean(getVeoConfiguration(selectedModel));+ const groupCopyKey = getGroupedVideoCopyKey(selectedFamilyId);+ const providerCopy = copy[groupCopyKey] || copy.seedance;const groupCopy = useMemo(() => ({...copy.modelControls,- ...(isVeo ? copy.veo : copy.seedance),- adjustments: { ...copy.modelControls.adjustments, ...(isVeo ? copy.veo.adjustments : {}) },- }), [copy, isVeo]);+ ...providerCopy,+ fields: { ...copy.modelControls.fields, ...providerCopy.fields },+ adjustments: { ...copy.modelControls.adjustments, ...providerCopy.adjustments },+ }), [copy, providerCopy]);const workflowControlState = groupedConfiguration && workflowFamily? { kind: "menu", workflow: null }: getVideoWorkflowControlState(@@ -1123,7 +1125,7 @@ export default function VideoStudio({return {...field,key: "resolution",- ...(!isVeo && !field.value && selectedWorkflowId !== "extend_uploaded_video"+ ...(groupCopyKey === "seedance" && !field.value && selectedWorkflowId !== "extend_uploaded_video"? { label: groupCopy.defaultResolution } : {}),options: field.options.map((option) => {const adjustments = option.disabled ? [] : getGroupedVideoSelectionAdjustments({@@ -1134,7 +1136,7 @@ export default function VideoStudio({return { ...option, adjustmentDescription: describeSelectionAdjustments(adjustments) };}),};- }, [groupedConfiguration, selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, selectedAr, selectedDuration, selectedQuality, describeSelectionAdjustments, groupCopy, isVeo]);+ }, [groupedConfiguration, selectedFamilyId, selectedWorkflowId, selectedModel, selectedResolution, selectedAr, selectedDuration, selectedQuality, describeSelectionAdjustments, groupCopy, groupCopyKey]);const commonOptions = useMemo(() => getVideoCommonOptions(selectedVariant?.model), [selectedVariant],);@@ -2058,6 +2060,7 @@ export default function VideoStudio({}): {};const groupedHistorySettings = grouped ? {+ ...currentModel.fixedParameters,...commonParams,workflowId: selectedWorkflowId,modelParameterValues: { ...generationParameterValues },diff --git a/packages/studio/src/groupedVideoModels.js b/packages/studio/src/groupedVideoModels.jsindex 75cd2ea0..55aa69e0 100644--- a/packages/studio/src/groupedVideoModels.js+++ b/packages/studio/src/groupedVideoModels.js@@ -1,7 +1,8 @@import { SEEDANCE_MODEL_GROUP } from "./seedanceModels.js";import { VEO_MODEL_GROUP } from "./veoModels.js";+import { MINIMAX_MODEL_GROUP } from "./minimaxModels.js";-const groups = [SEEDANCE_MODEL_GROUP, VEO_MODEL_GROUP];+const groups = [SEEDANCE_MODEL_GROUP, VEO_MODEL_GROUP, MINIMAX_MODEL_GROUP];const groupByFamilyId = new Map();const configurationByModelId = new Map();const familyNames = {};@@ -25,6 +26,10 @@ export function getGroupedVideoConfiguration(modelId) {return configurationByModelId.get(modelId) || null;}+export function getGroupedVideoCopyKey(familyId) {+ return groupByFamilyId.get(familyId)?.copyKey;+}+export function resolveGroupedVideoVariant(options) {return groupByFamilyId.get(options.familyId)?.resolveVariant(options) ?? null;}diff --git a/packages/studio/src/groupedVideoParameters.js b/packages/studio/src/groupedVideoParameters.jsindex dcef7696..f8bedbac 100644--- a/packages/studio/src/groupedVideoParameters.js+++ b/packages/studio/src/groupedVideoParameters.js@@ -5,6 +5,12 @@ import {} from "./seedanceParameters.js";import { SEEDANCE_MODEL_GROUP } from "./seedanceModels.js";import { VEO_MODEL_GROUP } from "./veoModels.js";+import { MINIMAX_MODEL_GROUP } from "./minimaxModels.js";+import {+ getMiniMaxResolutionOptions,+ getMiniMaxSelectionAdjustments,+ planMiniMaxSelection,+} from "./minimaxParameters.js";import { getGroupedVideoConfiguration } from "./groupedVideoModels.js";import {getVeoResolutionOptions,@@ -25,6 +31,12 @@ const groups = [resolutions: getVeoResolutionOptions,adjustments: getVeoSelectionAdjustments,},+ {+ familyNames: MINIMAX_MODEL_GROUP.familyNames,+ plan: planMiniMaxSelection,+ resolutions: getMiniMaxResolutionOptions,+ adjustments: getMiniMaxSelectionAdjustments,+ },];const handlersByFamilyId = new Map();for (const group of groups) {diff --git a/packages/studio/src/messages/en/videoStudio.json b/packages/studio/src/messages/en/videoStudio.jsonindex 6b2052b9..e636fc8e 100644--- a/packages/studio/src/messages/en/videoStudio.json+++ b/packages/studio/src/messages/en/videoStudio.json@@ -237,5 +237,45 @@"adjustments": {"speed": "Generation: {value}"}+ },+ "minimax": {+ "speed": "Speed",+ "speeds": {+ "standard": "Standard speed",+ "fast": "Fast"+ },+ "speedDescriptions": {+ "standard": "",+ "fast": "Faster generation."+ },+ "provider": "Customization",+ "providerHelp": "Use a LoRA or the Spicy model.",+ "profiles": {+ "standard": {+ "label": "Standard",+ "description": ""+ },+ "lora": {+ "label": "LoRA",+ "description": "Apply custom styles or characters."+ },+ "spicy": {+ "label": "Spicy",+ "description": "Alternative model for image animation."+ }+ },+ "adjustments": {+ "profile": "Customization: {value}"+ },+ "fields": {+ "go_fast": {+ "title": "Extra speed",+ "description": "Trades detail for speed."+ },+ "loras": {+ "title": "LoRAs",+ "description": "Add up to 3 custom styles or characters."+ }+ }}}diff --git a/packages/studio/src/messages/zh/videoStudio.json b/packages/studio/src/messages/zh/videoStudio.jsonindex 668be565..4dcb4544 100644--- a/packages/studio/src/messages/zh/videoStudio.json+++ b/packages/studio/src/messages/zh/videoStudio.json@@ -237,5 +237,45 @@"adjustments": {"speed": "生成方式:{value}"}+ },+ "minimax": {+ "speed": "速度",+ "speeds": {+ "standard": "标准速度",+ "fast": "快速"+ },+ "speedDescriptions": {+ "standard": "",+ "fast": "更快生成。"+ },+ "provider": "自定义",+ "providerHelp": "使用 LoRA 或 Spicy 模型。",+ "profiles": {+ "standard": {+ "label": "标准",+ "description": ""+ },+ "lora": {+ "label": "LoRA",+ "description": "应用自定义风格或角色。"+ },+ "spicy": {+ "label": "Spicy",+ "description": "用于图片动画的另一种模型。"+ }+ },+ "adjustments": {+ "profile": "自定义:{value}"+ },+ "fields": {+ "go_fast": {+ "title": "额外加速",+ "description": "以细节换取速度。"+ },+ "loras": {+ "title": "LoRA",+ "description": "最多添加 3 个自定义风格或角色。"+ }+ }}}diff --git a/packages/studio/src/minimaxModels.js b/packages/studio/src/minimaxModels.jsnew file mode 100644index 00000000..66674785--- /dev/null+++ b/packages/studio/src/minimaxModels.js@@ -0,0 +1,141 @@+import { i2vModels, t2vModels } from "./models.js";++export const MINIMAX_FAMILY_NAMES = Object.freeze({+ "minimax-h3": "MiniMax H3",+ "minimax-hailuo-2.3": "Hailuo 2.3",+ "minimax-hailuo-02": "Hailuo 02",+});++const FACET_OPTIONS = Object.freeze({+ profile: [+ { value: "standard", label: "Standard" },+ { value: "lora", label: "LoRA" },+ { value: "spicy", label: "Spicy" },+ ],+ speed: [+ { value: "standard", label: "Standard" },+ { value: "fast", label: "Fast" },+ ],+});+const FACET_LABELS = Object.freeze({ profile: "Customization", speed: "Speed" });+const EMPTY_OPTIONS = Object.freeze([]);+const modelIds = new Set([...t2vModels, ...i2vModels].map((model) => model.id));+const configurations = new Map();+const selectionIndex = new Map();++function coordinateKey({ profile, speed }) {+ return `${profile}\u0000${speed}`;+}++function register(modelId, familyId, workflowIds, facets = {}) {+ if (!modelIds.has(modelId)) return;+ const config = Object.freeze({+ familyId, profile: "standard", speed: "standard", service: "standard",+ ...facets, workflowIds: Object.freeze(workflowIds),+ });+ configurations.set(modelId, config);+ let workflows = selectionIndex.get(familyId);+ if (!workflows) selectionIndex.set(familyId, workflows = new Map());+ for (const workflowId of workflowIds) {+ let group = workflows.get(workflowId);+ if (!group) {+ group = { modelIds: [], variants: new Map(), defaultConfiguration: config };+ workflows.set(workflowId, group);+ }+ group.modelIds.push(modelId);+ const key = coordinateKey(config);+ let services = group.variants.get(key);+ if (!services) group.variants.set(key, services = new Map());+ services.set(config.service, modelId);+ }+}++// Standard/Pro and official/Open endpoints are selected by resolution, while+// speed and optional LoRA/Spicy profiles remain explicit generation choices.+for (const familyId of ["minimax-hailuo-02", "minimax-hailuo-2.3"]) {+ for (const service of ["standard", "pro"]) {+ register(`${familyId}-${service}-t2v`, familyId, [null], { service });+ register(`${familyId}-${service}-i2v`, familyId,+ familyId === "minimax-hailuo-02" ? ["animate_image", "keyframes"] : ["animate_image"],+ { service });+ }+}+register("minimax-hailuo-2.3-fast", "minimax-hailuo-2.3", ["animate_image"], { speed: "fast" });++for (const service of ["official", "open"]) {+ const stem = `minimax-h3${service === "open" ? "-open" : ""}`;+ register(`${stem}-text-to-video`, "minimax-h3", [null], { service });+ register(`${stem}-image-to-video`, "minimax-h3", ["animate_image", "keyframes"], { service });+ register(`${stem}-reference-to-video`, "minimax-h3", ["references"], { service });+}+for (const [stem, workflowIds] of [+ ["text-to-video", [null]],+ ["image-to-video", ["animate_image", "keyframes"]],+ ["reference-to-video", ["references"]],+]) {+ register(`minimax-h3-${stem}-lora`, "minimax-h3", workflowIds, { profile: "lora", service: "open" });+}+register("minimax-h3-image-to-video-spicy", "minimax-h3", ["animate_image", "keyframes"], {+ profile: "spicy", service: "open",+});++for (const workflows of selectionIndex.values()) {+ for (const group of workflows.values()) {+ Object.freeze(group.modelIds);+ group.fields = Object.entries(FACET_OPTIONS).flatMap(([key, options]) => {+ const values = new Set(group.modelIds.map((modelId) => configurations.get(modelId)[key]));+ return values.size > 1 ? [{+ key, label: FACET_LABELS[key],+ options: Object.freeze(options.filter((option) => values.has(option.value))),+ }] : [];+ });+ }+}++export const MINIMAX_WORKFLOW_VARIANTS = Object.freeze(Object.fromEntries(+ [...selectionIndex].map(([familyId, workflows]) => [familyId, Object.freeze(Object.fromEntries(+ [...workflows].filter(([workflowId]) => workflowId !== null)+ .map(([workflowId, group]) => [workflowId, group.modelIds]),+ ))]),+));++export function getMiniMaxConfiguration(modelId) {+ return configurations.get(modelId) || null;+}++export function getMiniMaxVariants(familyId, workflowId = null) {+ return selectionIndex.get(familyId)?.get(workflowId)?.modelIds || EMPTY_OPTIONS;+}++export function resolveMiniMaxVariant({+ familyId, workflowId = null, currentModelId = null, changes = {},+}) {+ if (Object.keys(changes).some((key) => key !== "profile" && key !== "speed")) return null;+ const group = selectionIndex.get(familyId)?.get(workflowId);+ if (!group) return null;+ const current = getMiniMaxConfiguration(currentModelId);+ const selected = current?.familyId === familyId ? current : group.defaultConfiguration;+ const key = coordinateKey({ ...selected, ...changes });+ const services = group.variants.get(key);+ if (!services) return null;+ if (current?.familyId === familyId && current.workflowIds.includes(workflowId) &&+ coordinateKey(current) === key) return currentModelId;+ return services.get(selected.service) || services.values().next().value;+}++export function getMiniMaxVariantOptions(familyId, workflowId = null, currentModelId = null) {+ const group = selectionIndex.get(familyId)?.get(workflowId);+ if (!group) return EMPTY_OPTIONS;+ const current = getMiniMaxConfiguration(currentModelId);+ const selected = current?.familyId === familyId ? current : group.defaultConfiguration;+ return group.fields.map((field) => ({ ...field, value: selected[field.key] }));+}++export const MINIMAX_MODEL_GROUP = Object.freeze({+ copyKey: "minimax",+ familyNames: MINIMAX_FAMILY_NAMES,+ configurations,+ workflowVariants: MINIMAX_WORKFLOW_VARIANTS,+ resolveVariant: resolveMiniMaxVariant,+ getVariantOptions: getMiniMaxVariantOptions,+});diff --git a/packages/studio/src/minimaxParameters.js b/packages/studio/src/minimaxParameters.jsnew file mode 100644index 00000000..82a42c4a--- /dev/null+++ b/packages/studio/src/minimaxParameters.js@@ -0,0 +1,12 @@+import { getMiniMaxConfiguration, getMiniMaxVariants, resolveMiniMaxVariant } from "./minimaxModels.js";+import { createNativeVideoParameters } from "./nativeVideoParameters.js";++export const {+ plan: planMiniMaxSelection,+ resolutions: getMiniMaxResolutionOptions,+ adjustments: getMiniMaxSelectionAdjustments,+} = createNativeVideoParameters({+ getConfiguration: getMiniMaxConfiguration,+ resolveVariant: resolveMiniMaxVariant,+ getResolutionVariants: getMiniMaxVariants,+});diff --git a/packages/studio/src/models.js b/packages/studio/src/models.jsindex d593e6b5..eabdc155 100644--- a/packages/studio/src/models.js+++ b/packages/studio/src/models.js@@ -49,6 +49,13 @@ const SEEDANCE_25_SEED_INPUT = Object.freeze({minValue: -1,maxValue: 4294967295,});+const MINIMAX_H3_OPEN_SEED_INPUT = Object.freeze({+ type: "integer",+ title: "Seed",+ name: "seed",+ description: "Random seed. Use -1 for random.",+ default: -1,+});export const t2iModels = [{@@ -5287,6 +5294,9 @@ export const t2vModels = [{"id": "minimax-hailuo-2.3-pro-t2v","name": "MiniMax Hailuo 2.3 Pro",+ // Hailuo 2.3 supports 1080p only at 6s; MuAPI fixes the duration on this route.+ // https://platform.minimax.io/docs/api-reference/video-generation-t2v+ "fixedParameters": { "duration": 6 },"inputs": {"prompt": {"type": "string",@@ -5311,6 +5321,8 @@ export const t2vModels = [{"id": "minimax-hailuo-2.3-standard-t2v","name": "MiniMax Hailuo 2.3 Standard",+ // https://muapi.ai/zh/playground/minimax-hailuo-2.3-standard-t2v+ "fixedParameters": { "resolution": "768p" },"inputs": {"prompt": {"type": "string",@@ -8161,7 +8173,8 @@ export const t2vModels = ["title": "Duration","name": "duration","default": 5- }+ },+ "seed": MINIMAX_H3_OPEN_SEED_INPUT},"provider": "minimax","provider_name": "Minimax"@@ -14947,6 +14960,8 @@ export const i2vModels = ["family": "minimax-2.3","imageField": "image_url","hasPrompt": true,+ "promptRequired": true,+ "fixedParameters": { "duration": 6 },"inputs": {"prompt": {"type": "string",@@ -14978,6 +14993,8 @@ export const i2vModels = ["family": "minimax-2.3","imageField": "image_url","hasPrompt": true,+ "promptRequired": true,+ "fixedParameters": { "resolution": "768p" },"inputs": {"prompt": {"type": "string",@@ -15010,6 +15027,8 @@ export const i2vModels = ["family": "minimax-2.3","imageField": "image_url","hasPrompt": true,+ "promptRequired": true,+ "fixedParameters": { "resolution": "768p" },"inputs": {"prompt": {"type": "string",@@ -20520,6 +20539,7 @@ export const i2vModels = ["family": "minimax-h3","imageField": "image_url","lastImageField": "last_image_url",+ "aspectRatioMode": "inherited","hasPrompt": true,"promptRequired": true,"inputs": {@@ -20579,6 +20599,7 @@ export const i2vModels = ["field": "image","title": "Reference Images","name": "reference_images",+ "maxItems": 9,"items": {"type": "string"}},"reference_videos": {@@ -20586,6 +20607,7 @@ export const i2vModels = ["field": "video","title": "Reference Videos","name": "reference_videos",+ "maxItems": 3,"items": {"type": "string"}},"reference_audios": {@@ -20593,6 +20615,7 @@ export const i2vModels = ["field": "audio","title": "Reference Audio","name": "reference_audios",+ "maxItems": 3,"items": {"type": "string"}},"aspect_ratio": {@@ -20627,6 +20650,7 @@ export const i2vModels = ["family": "minimax-h3","imageField": "image_url","lastImageField": "last_image",+ "aspectRatioMode": "inherited","hasPrompt": true,"promptRequired": true,"inputs": {@@ -20661,7 +20685,8 @@ export const i2vModels = ["title": "Duration","name": "duration","default": 5- }+ },+ "seed": MINIMAX_H3_OPEN_SEED_INPUT},"provider": "minimax","provider_name": "Minimax"@@ -20726,7 +20751,8 @@ export const i2vModels = ["title": "Duration","name": "duration","default": 5- }+ },+ "seed": MINIMAX_H3_OPEN_SEED_INPUT},"provider": "minimax","provider_name": "Minimax"diff --git a/packages/studio/src/nativeVideoParameters.js b/packages/studio/src/nativeVideoParameters.jsnew file mode 100644index 00000000..51730653--- /dev/null+++ b/packages/studio/src/nativeVideoParameters.js@@ -0,0 +1,101 @@+import { videoModelCatalog } from "./modelFamilies.js";+import {+ formatVideoResolution,+ getVideoCommonOptions,+ getVideoCommonValues,+ matchingVideoResolution,+ normalizeVideoResolution,+} from "./videoModelParameters.js";++const modelForId = (modelId) => videoModelCatalog.variantById.get(modelId)?.model;+const FACETS = ["profile", "speed"];+const SELECTION_KEYS = [...FACETS, "resolution"];++// Native parameters and fixed output sizes share controls. Only providers with+// separate resolution endpoints supply additional candidates for those controls.+export function createNativeVideoParameters({ getConfiguration, resolveVariant, getResolutionVariants }) {+ function adjustments({ currentModelId, nativeResolution, commonValues = {}, selection, changes = {} }) {+ const current = getConfiguration(currentModelId);+ const target = getConfiguration(selection.modelId);+ if (!current || current.familyId !== target?.familyId) return [];+ const result = FACETS.filter((key) => !Object.hasOwn(changes, key) && current[key] !== target[key])+ .map((key) => ({ key, from: current[key], to: target[key] }));+ const sourceModel = modelForId(currentModelId);+ const previous = getVideoCommonValues(sourceModel, {+ ...commonValues,+ resolution: matchingVideoResolution(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]).toLowerCase() !== String(next[key]).toLowerCase()) {+ result.push({ key, from: previous[key], to: next[key] });+ }+ }+ return result;+ }++ function plan({ familyId, workflowId = null, currentModelId, changes = {}, nativeResolution, commonValues = {} }) {+ if (Object.keys(changes).some((key) => !SELECTION_KEYS.includes(key))) return null;+ const facetChanges = Object.fromEntries(FACETS.filter((key) => Object.hasOwn(changes, key))+ .map((key) => [key, changes[key]]));+ let modelId = resolveVariant({ familyId, workflowId, currentModelId, changes: facetChanges });+ if (!modelId && Object.keys(facetChanges).length === 0) modelId = resolveVariant({ familyId, workflowId });+ if (!modelId) return null;+ const current = getConfiguration(currentModelId);+ const target = getConfiguration(modelId);+ const sameFamily = current?.familyId === familyId;+ const explicitResolution = Object.hasOwn(changes, "resolution");+ const desiredResolution = explicitResolution ? changes.resolution+ : sameFamily ? nativeResolution ?? commonValues.resolution : undefined;+ let resolution = matchingVideoResolution(modelForId(modelId), desiredResolution);+ if (resolution === undefined && getResolutionVariants) {+ let fallback;+ for (const candidateId of getResolutionVariants(familyId, workflowId)) {+ const config = getConfiguration(candidateId);+ if (config.profile !== target.profile) continue;+ const match = matchingVideoResolution(modelForId(candidateId), desiredResolution);+ if (match === undefined) continue;+ if (config.speed === target.speed) {+ modelId = candidateId;+ resolution = match;+ break;+ }+ if (explicitResolution && !Object.hasOwn(changes, "speed") && !fallback) {+ fallback = { modelId: candidateId, resolution: match };+ }+ }+ if (resolution === undefined && fallback) ({ modelId, resolution } = fallback);+ }+ if (explicitResolution && resolution === undefined) return null;+ resolution = getVideoCommonValues(modelForId(modelId), { resolution }).resolution;+ const selection = { modelId, ...(resolution === undefined ? {} : { resolution }) };+ return { selection, adjustments: adjustments({ currentModelId, nativeResolution, commonValues, selection, changes }) };+ }++ function resolutions(familyId, workflowId = null, currentModelId = null, nativeResolution) {+ const config = getConfiguration(currentModelId);+ if (!config || config.familyId !== familyId || !config.workflowIds.includes(workflowId)) {+ return { value: "", options: [] };+ }+ const model = modelForId(currentModelId);+ const resolution = getVideoCommonValues(model, {+ resolution: matchingVideoResolution(model, nativeResolution),+ }).resolution;+ const candidates = getResolutionVariants ? getResolutionVariants(familyId, workflowId) : [currentModelId];+ const values = new Set();+ for (const modelId of candidates) {+ if (getConfiguration(modelId).profile !== config.profile) continue;+ for (const value of getVideoCommonOptions(modelForId(modelId)).resolutions) values.add(normalizeVideoResolution(value));+ }+ const options = [...values].map((value) => {+ const selection = plan({ familyId, workflowId, currentModelId, changes: { resolution: value } })?.selection;+ return { value, label: formatVideoResolution(value), ...selection, disabled: !selection };+ });+ return { value: resolution === undefined ? "" : normalizeVideoResolution(resolution), options };+ }++ return { plan, resolutions, adjustments };+}diff --git a/packages/studio/src/seedanceModels.js b/packages/studio/src/seedanceModels.jsindex b82a8396..b7488723 100644--- a/packages/studio/src/seedanceModels.js+++ b/packages/studio/src/seedanceModels.js@@ -301,6 +301,7 @@ export function getSeedanceVariantOptions(familyId, workflowId = null, currentMo}export const SEEDANCE_MODEL_GROUP = Object.freeze({+ copyKey: "seedance",familyNames: SEEDANCE_FAMILY_NAMES,configurations,workflowVariants: SEEDANCE_WORKFLOW_VARIANTS,diff --git a/packages/studio/src/veoModels.js b/packages/studio/src/veoModels.jsindex e3c85f8f..9dbfcc6e 100644--- a/packages/studio/src/veoModels.js+++ b/packages/studio/src/veoModels.js@@ -90,6 +90,7 @@ export function getVeoVariantOptions(familyId, workflowId = null, currentModelId}export const VEO_MODEL_GROUP = Object.freeze({+ copyKey: "veo",familyNames: VEO_FAMILY_NAMES,configurations,workflowVariants: VEO_WORKFLOW_VARIANTS,diff --git a/packages/studio/src/veoParameters.js b/packages/studio/src/veoParameters.jsindex ed9dda98..3a24641d 100644--- a/packages/studio/src/veoParameters.js+++ b/packages/studio/src/veoParameters.js@@ -1,93 +1,8 @@-import { videoModelCatalog } from "./modelFamilies.js";import { getVeoConfiguration, resolveVeoVariant } from "./veoModels.js";-import { getVideoCommonOptions, getVideoCommonValues } from "./videoModelParameters.js";+import { createNativeVideoParameters } from "./nativeVideoParameters.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,- })),- };-}+export const {+ plan: planVeoSelection,+ resolutions: getVeoResolutionOptions,+ adjustments: getVeoSelectionAdjustments,+} = createNativeVideoParameters({ getConfiguration: getVeoConfiguration, resolveVariant: resolveVeoVariant });diff --git a/packages/studio/src/videoModelParameters.js b/packages/studio/src/videoModelParameters.jsindex f3a0eec9..bf8e108a 100644--- a/packages/studio/src/videoModelParameters.js+++ b/packages/studio/src/videoModelParameters.js@@ -51,7 +51,9 @@ export function getVideoCommonOptions(model) {const options = Object.fromEntries(COMMON_FIELDS.map(([, field, key]) =>[key, field === "aspect_ratio" && model.aspectRatioMode === "inherited"? []- : schemaOptions(model.inputs?.[field])]));+ : model.fixedParameters?.[field] !== undefined+ ? [model.fixedParameters[field]]+ : schemaOptions(model.inputs?.[field])]));optionsByModel.set(model, options);return options;}@@ -71,6 +73,18 @@ 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]];+ return value === undefined || !model.inputs?.[field] ? [] : [[field, value]];}));}++export const normalizeVideoResolution = (value) => String(value).toLowerCase();++export function formatVideoResolution(value) {+ const normalized = normalizeVideoResolution(value);+ return normalized.endsWith("k") ? normalized.toUpperCase() : normalized;+}++export function matchingVideoResolution(model, value) {+ return getVideoCommonOptions(model).resolutions.find((option) =>+ normalizeVideoResolution(option) === normalizeVideoResolution(value));+}diff --git a/packages/studio/src/videoWorkflows.js b/packages/studio/src/videoWorkflows.jsindex e2c23ff4..eba8d7fb 100644--- a/packages/studio/src/videoWorkflows.js+++ b/packages/studio/src/videoWorkflows.js@@ -76,14 +76,6 @@ export const VIDEO_WORKFLOW_VARIANTS = Object.freeze({"kling-v3.0-std-motion-control",],},- "minimax-h3": {- animate_image: ["minimax-h3-open-image-to-video", "minimax-h3-image-to-video"],- keyframes: ["minimax-h3-open-image-to-video", "minimax-h3-image-to-video"],- references: [- "minimax-h3-open-reference-to-video",- "minimax-h3-reference-to-video",- ],- },"gemini-omni": {animate_image: ["gemini-omni-image-to-video"],references: ["gemini-omni-image-to-video"],@@ -165,10 +157,6 @@ export const VIDEO_WORKFLOW_VARIANTS = Object.freeze({animate_image: ["wan2.1-image-to-video"],references: ["wan2.1-reference-video"],},- "minimax-hailuo-02": {- animate_image: ["minimax-hailuo-02-pro-i2v", "minimax-hailuo-02-standard-i2v"],- keyframes: ["minimax-hailuo-02-pro-i2v", "minimax-hailuo-02-standard-i2v"],- },"kling-v2.1": {animate_image: ["kling-v2.1-pro-i2v",