Skip to content

Commit 63783d1

Browse files
myxamediyarclaude
andcommitted
fix(video): keep fal settings enabled without a start frame
- Drop the optional start frame fields from `dependsOn`: an array there disables the field until every entry is filled, which greyed out the settings for text-only runs. Options and conditions already re-read all block values. - Pass the run's abort signal through to the start frame download. - The fal tool now offers `visualReference` to agents for models with an image-to-video endpoint; update the provider selection test. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 069d18e commit 63783d1

3 files changed

Lines changed: 10 additions & 11 deletions

File tree

‎apps/sim/blocks/blocks/video_generator.ts‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ const FALAI_AUDIO_DEFAULT_OFF_MODELS = ['kling-o3-pro', 'kling-o3-4k']
4747
const FAL_MODEL_DEFAULT = { id: 'default', label: 'Model default' } as const
4848
const endpointModels = falVideoModels.filter((model) => !model.legacyId)
4949

50+
// Never list these optional fields in `dependsOn`: an array there disables the field until every
51+
// entry has a value. Options and conditions already re-read all block values on any change.
5052
const START_FRAME_FIELDS = ['visualReferenceInput', 'visualReferenceUpload']
5153
const HIDDEN = { field: 'provider', value: [] }
5254

@@ -78,7 +80,7 @@ function tuningField(id: string, title: string, key: FalSettingKey): SubBlockCon
7880
? { field: 'provider', value: 'falai' }
7981
: HIDDEN
8082
},
81-
dependsOn: ['model', ...START_FRAME_FIELDS],
83+
dependsOn: ['model'],
8284
options: (params) => {
8385
if (!params) {
8486
const values = endpointModels.flatMap((model) =>
@@ -179,10 +181,6 @@ function withFalVideoCatalog(subBlocks: SubBlockConfig[]): SubBlockConfig[] {
179181
const image = getFalVideoModel(values?.model)?.image
180182
return image && !image[key] && hasStartFrame(values) ? HIDDEN : condition
181183
},
182-
dependsOn: [
183-
...(Array.isArray(subBlock.dependsOn) ? subBlock.dependsOn : []),
184-
...START_FRAME_FIELDS,
185-
],
186184
},
187185
]
188186
return [subBlock]
@@ -207,7 +205,7 @@ const directVideoFields = (
207205
title,
208206
type: key === 'promptOptimizer' ? 'switch' : 'dropdown',
209207
value: key === 'promptOptimizer' ? undefined : () => FAL_MODEL_DEFAULT.id,
210-
dependsOn: ['provider', 'model', ...START_FRAME_FIELDS],
208+
dependsOn: ['provider', 'model'],
211209
condition: (values) => ({
212210
field: 'provider',
213211
value: selectedDirectModel(values)?.settings?.[key] ? [String(values?.provider)] : [],

‎apps/sim/lib/internal/video/client.ts‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -117,12 +117,13 @@ const MAX_REFERENCE_IMAGE_BYTES = Math.floor(((5 * 1024 * 1024 - 512) * 3) / 4)
117117

118118
async function readReferenceImageDataUri(
119119
file: UserFile,
120-
requestId: string,
120+
{ requestId, signal }: VideoGenerationContext,
121121
label: string
122122
): Promise<string> {
123123
assertKnownSizeWithinLimit(file.size, MAX_REFERENCE_IMAGE_BYTES, label)
124124
const buffer = await downloadFileFromStorage(file, requestId, logger, {
125125
maxBytes: MAX_REFERENCE_IMAGE_BYTES,
126+
signal,
126127
})
127128
assertKnownSizeWithinLimit(buffer.length, MAX_REFERENCE_IMAGE_BYTES, label)
128129
return `data:${file.type};base64,${buffer.toString('base64')}`
@@ -134,7 +135,7 @@ async function generateWithDirectProvider(
134135
): Promise<VideoGenerationResult> {
135136
const prepared = buildDirectVideoRequest(input)
136137
const { protocol } = prepared.model
137-
const { signal, requestId } = context
138+
const { signal } = context
138139
const headers: Record<string, string> = { 'Content-Type': 'application/json' }
139140
if (protocol === 'gemini') {
140141
headers['x-goog-api-key'] = input.apiKey
@@ -145,7 +146,7 @@ async function generateWithDirectProvider(
145146
if (input.visualReference) {
146147
prepared.body.promptImage = await readReferenceImageDataUri(
147148
input.visualReference,
148-
requestId,
149+
context,
149150
'Runway reference image'
150151
)
151152
}
@@ -378,7 +379,7 @@ async function generateWithFalAI(
378379
if (input.visualReference && imageField) {
379380
body[imageField] = await readReferenceImageDataUri(
380381
input.visualReference,
381-
requestId,
382+
context,
382383
'Fal.ai start frame image'
383384
)
384385
signal?.throwIfAborted()

‎apps/sim/providers/utils.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2245,7 +2245,7 @@ describe('transformBlockTool configured selectors', () => {
22452245
)
22462246

22472247
expect(result?.id).toBe('video_falai')
2248-
expect(result?.parameters?.properties).not.toHaveProperty('visualReference')
2248+
expect(result?.parameters?.properties).toHaveProperty('visualReference')
22492249
const prepared = prepareToolExecution(
22502250
result!,
22512251
{ prompt: 'A paper boat', provider: 'runway', model: 'gen-4-turbo' },

0 commit comments

Comments
 (0)