@@ -156,22 +156,22 @@ function selectedDirectModel(values?: Record<string, unknown>) {
156156
157157const directVideoFields = (
158158 [
159- [ 'directDuration ' , 'Duration (seconds)' , 'durations' ] ,
160- [ 'directAspectRatio ' , 'Aspect Ratio' , 'aspectRatios' ] ,
161- [ 'directResolution ' , 'Resolution' , 'resolutions' ] ,
159+ [ 'duration ' , 'Duration (seconds)' , 'durations' ] ,
160+ [ 'aspectRatio ' , 'Aspect Ratio' , 'aspectRatios' ] ,
161+ [ 'resolution ' , 'Resolution' , 'resolutions' ] ,
162162 [ 'directGenerateAudio' , 'Generate Audio' , 'audio' ] ,
163- [ 'directPromptOptimizer ' , 'Prompt Optimizer' , 'promptOptimizer' ] ,
163+ [ 'promptOptimizer ' , 'Prompt Optimizer' , 'promptOptimizer' ] ,
164164 ] as const
165165) . map (
166166 ( [ id , title , key ] ) : SubBlockConfig => ( {
167167 id,
168168 title,
169- type : 'dropdown' ,
170- value : ( ) => FAL_MODEL_DEFAULT . id ,
169+ type : key === 'promptOptimizer' ? 'switch' : 'dropdown' ,
170+ value : key === 'promptOptimizer' ? undefined : ( ) => FAL_MODEL_DEFAULT . id ,
171171 dependsOn : [ 'provider' , 'model' , 'visualReferenceInput' , 'visualReferenceUpload' ] ,
172172 condition : ( values ) => ( {
173- field : 'model ' ,
174- value : selectedDirectModel ( values ) ?. settings ?. [ key ] ? [ String ( values ?. model ) ] : [ ] ,
173+ field : 'provider ' ,
174+ value : selectedDirectModel ( values ) ?. settings ?. [ key ] ? [ String ( values ?. provider ) ] : [ ] ,
175175 } ) ,
176176 options : ( params ) => {
177177 if ( ! params ) {
@@ -193,9 +193,8 @@ const directVideoFields = (
193193 ...choices
194194 . filter ( ( value ) => {
195195 if ( model ?. protocol !== 'minimax-v1' ) return true
196- if ( key === 'durations' && params ?. values . directResolution === '1080P' )
197- return value === 6
198- if ( key === 'resolutions' && Number ( params ?. values . directDuration ) === 10 )
196+ if ( key === 'durations' && params ?. values . resolution === '1080P' ) return value === 6
197+ if ( key === 'resolutions' && Number ( params ?. values . duration ) === 10 )
199198 return value !== '1080P'
200199 return true
201200 } )
@@ -1936,26 +1935,26 @@ export const VideoGeneratorV3Block: BlockConfig = {
19361935 ? normalizeFileInput ( params . visualReference , { single : true } )
19371936 : undefined
19381937 const model = getDirectVideoModel ( params . provider , params . model , Boolean ( visualReference ) )
1939- const setting = ( legacy : string , current : string , supported : unknown ) => {
1938+ const setting = ( key : string , supported : unknown ) => {
19401939 if ( ! supported ) return undefined
1941- const value = params [ current ] ?? params [ legacy ]
1940+ const value = params [ key ]
19421941 return value === FAL_MODEL_DEFAULT . id ? undefined : value
19431942 }
1944- const duration = setting ( 'duration' , 'directDuration' , model ?. settings ?. durations )
1943+ const duration = setting ( 'duration' , model ?. settings ?. durations )
19451944 return {
19461945 provider : params . provider ,
19471946 model : params . model ,
19481947 apiKey : params . apiKey ,
19491948 prompt : params . prompt ,
19501949 visualReference,
19511950 duration : duration ? Number ( duration ) : undefined ,
1952- aspectRatio : setting ( 'aspectRatio' , 'directAspectRatio' , model ?. settings ?. aspectRatios ) ,
1953- resolution : setting ( 'resolution' , 'directResolution' , model ?. settings ?. resolutions ) ,
1951+ aspectRatio : setting ( 'aspectRatio' , model ?. settings ?. aspectRatios ) ,
1952+ resolution : setting ( 'resolution' , model ?. settings ?. resolutions ) ,
19541953 generateAudio : parseOptionalBooleanInput (
1955- setting ( 'generateAudio' , ' directGenerateAudio', model ?. settings ?. audio )
1954+ setting ( 'directGenerateAudio' , model ?. settings ?. audio )
19561955 ) ,
19571956 promptOptimizer : parseOptionalBooleanInput (
1958- setting ( 'promptOptimizer' , 'directPromptOptimizer' , model ?. settings ?. promptOptimizer )
1957+ setting ( 'promptOptimizer' , model ?. settings ?. promptOptimizer )
19591958 ) ,
19601959 endpoint : model ?. protocol === 'minimax-v1' ? params . endpoint : undefined ,
19611960 cameraControl :
@@ -1970,14 +1969,14 @@ export const VideoGeneratorV3Block: BlockConfig = {
19701969 } ,
19711970 inputs : {
19721971 ...VideoGeneratorV2Block . inputs ,
1973- directDuration : { type : 'number' , description : 'Duration for the selected provider model' } ,
1974- directAspectRatio : {
1972+ duration : { type : 'number' , description : 'Duration for the selected provider model' } ,
1973+ aspectRatio : {
19751974 type : 'string' ,
19761975 description : 'Frame size or aspect ratio for the selected provider model' ,
19771976 } ,
1978- directResolution : { type : 'string' , description : 'Resolution for the selected provider model' } ,
1977+ resolution : { type : 'string' , description : 'Resolution for the selected provider model' } ,
19791978 directGenerateAudio : { type : 'boolean' , description : 'Generate audio when supported' } ,
1980- directPromptOptimizer : {
1979+ promptOptimizer : {
19811980 type : 'boolean' ,
19821981 description : 'Enable prompt optimization when supported' ,
19831982 } ,
0 commit comments