Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
feat: let Video Gen choose fal resolution and provider audio (#9232)
Adam Eivy62488d5c5572
diff --git a/client/src/hooks/useVideoGenFieldState.js b/client/src/hooks/useVideoGenFieldState.jsindex 4af6375f67..f64789134a 100644--- a/client/src/hooks/useVideoGenFieldState.js+++ b/client/src/hooks/useVideoGenFieldState.js@@ -25,6 +25,8 @@ export function useVideoGenFieldState({const [grokDuration, setGrokDuration] = useState(GROK_VIDEO_DEFAULT_DURATION);const [falDuration, setFalDuration] = useState('');const [falModelId, setFalModelId] = useState('');+ const [falResolution, setFalResolution] = useState('');+ const [falGenerateAudio, setFalGenerateAudio] = useState(false);const [reactorClipId, setReactorClipId] = useState('');const [reactorSeconds, setReactorSeconds] = useState(REACTOR_DEFAULT_CLIP_LENGTH);const [reactorSeed, setReactorSeed] = useState('');@@ -96,6 +98,8 @@ export function useVideoGenFieldState({grokDuration, setGrokDuration,falDuration, setFalDuration,falModelId, setFalModelId,+ falResolution, setFalResolution,+ falGenerateAudio, setFalGenerateAudio,reactorClipId, setReactorClipId,reactorSeconds, setReactorSeconds,reactorSeed, setReactorSeed,diff --git a/client/src/hooks/useVideoGenForm.js b/client/src/hooks/useVideoGenForm.jsindex 968f19d87c..eec65b53a2 100644--- a/client/src/hooks/useVideoGenForm.js+++ b/client/src/hooks/useVideoGenForm.js@@ -103,6 +103,8 @@ export function useVideoGenForm({grokDuration, setGrokDuration,falDuration, setFalDuration,falModelId, setFalModelId,+ falResolution, setFalResolution,+ falGenerateAudio, setFalGenerateAudio,reactorClipId, setReactorClipId,reactorSeconds, setReactorSeconds,reactorSeed, setReactorSeed,@@ -152,6 +154,12 @@ export function useVideoGenForm({incomingSourceImage,});+ // Each fal model has its own resolution and audio capabilities.+ useEffect(() => {+ setFalResolution('');+ setFalGenerateAudio(false);+ }, [falModelId]);+// Music renders live in the shared library rather than in the browser's// local file picker. Turn a render's deep-link filename into the same File// object the upload panel produces, so the existing multipart submit path,@@ -1299,7 +1307,7 @@ export function useVideoGenForm({// Snapshot the current validated state into a wire payload. The submit flow// stays pure so all three backend contracts can be tested independently.const submissionState = {- isGrok, grokDuration, isFal, falDuration, falModelId,+ isGrok, grokDuration, isFal, falDuration, falModelId, falResolution, falGenerateAudio,isReactor, reactorClipId, reactorSeconds, reactorSeed, reactorAspect, remoteSubmissionFields,displaySleepEnabled,prompt, negativePrompt, stylePreset, selectedUniverse,@@ -1321,6 +1329,8 @@ export function useVideoGenForm({grokDuration, setGrokDuration,falDuration, setFalDuration,falModelId, setFalModelId,+ falResolution, setFalResolution,+ falGenerateAudio, setFalGenerateAudio,reactorClipId, setReactorClipId,reactorSeconds, setReactorSeconds,reactorSeed, setReactorSeed,diff --git a/client/src/lib/videoGenSubmission.js b/client/src/lib/videoGenSubmission.jsindex bbb08f5fbc..afc3d867bb 100644--- a/client/src/lib/videoGenSubmission.js+++ b/client/src/lib/videoGenSubmission.js@@ -45,7 +45,7 @@ export function envelopVideoPrompt(text, {}export function buildVideoGenSubmission({- isGrok, grokDuration, isFal, falDuration, falModelId,+ isGrok, grokDuration, isFal, falDuration, falModelId, falResolution, falGenerateAudio,isReactor, reactorClipId, reactorSeconds, reactorSeed, reactorAspect, remoteSubmissionFields,displaySleepEnabled,prompt, negativePrompt, stylePreset, selectedUniverse,@@ -92,6 +92,8 @@ export function buildVideoGenSubmission({// only stamped a promise on the history record that nothing honored.falDuration,falModelId: falModelId || undefined,+ ...(falResolution ? { falResolution } : {}),+ ...(falGenerateAudio ? { falGenerateAudio: true } : {}),width: clampImageEdge(width, VIDEO_EDGE_BOUNDS),height: clampImageEdge(height, VIDEO_EDGE_BOUNDS),mode: mode === 'image' ? 'image' : 'text',diff --git a/client/src/lib/videoGenSubmission.test.js b/client/src/lib/videoGenSubmission.test.jsindex 74c0795e01..fbb2c21ca8 100644--- a/client/src/lib/videoGenSubmission.test.js+++ b/client/src/lib/videoGenSubmission.test.js@@ -55,3 +55,22 @@ describe('buildVideoGenSubmission — block streaming request (#6499)', () => {expect(payload.streamingMode).toBeUndefined();});});++describe('buildVideoGenSubmission — fal options (#9232)', () => {+ it('carries selected resolution and provider audio only to the fal backend', () => {+ const options = { falResolution: '4k', falGenerateAudio: true };+ expect(buildVideoGenSubmission(baseArgs({ isFal: true, ...options })))+ .toMatchObject({ backend: 'fal', falResolution: '4k', falGenerateAudio: true });+ const local = buildVideoGenSubmission(baseArgs(options));+ expect(local).not.toHaveProperty('falResolution');+ expect(local).not.toHaveProperty('falGenerateAudio');+ });++ it('omits unset options so the server keeps its resolution and silent defaults', () => {+ const payload = buildVideoGenSubmission(baseArgs({+ isFal: true, falResolution: '', falGenerateAudio: false,+ }));+ expect(payload).not.toHaveProperty('falResolution');+ expect(payload).not.toHaveProperty('falGenerateAudio');+ });+});diff --git a/client/src/pages/VideoGen.fal.test.jsx b/client/src/pages/VideoGen.fal.test.jsxnew file mode 100644index 0000000000..299666b148--- /dev/null+++ b/client/src/pages/VideoGen.fal.test.jsx@@ -0,0 +1,62 @@+import { beforeEach, describe, expect, it } from 'vitest';+import { fireEvent, screen, waitFor } from '@testing-library/react';+import { findEnabledByRole } from '../test/enabledBarrier.js';+import {+ loadVideoGenPage, renderVideoGenPage, resetVideoGenMockState,+ state, videoGenModel, videoGenModelContext, videoGenStatus,+} from '../test/videoGenPageMocks.jsx';++const MODEL = videoGenModel('local-model');+await loadVideoGenPage();++describe('VideoGen curated fal controls (#9232)', () => {+ beforeEach(() => {+ localStorage.clear();+ resetVideoGenMockState();+ state.getVideoGenModelContext.mockResolvedValue(videoGenModelContext([MODEL]));+ state.getVideoGenStatus.mockResolvedValue(videoGenStatus([MODEL], { falEnabled: true }));+ state.modelStatuses = { [MODEL.id]: { id: MODEL.id, repo: MODEL.repo, cached: true, sizeBytes: 100 } };+ state.generateVideo.mockResolvedValue({ jobId: 'job-1' });+ state.attach.mockReturnValue(new Promise(() => {}));+ });++ // Pins field-state → form → submission and pricing before enqueue, including+ // settings disappearing when the selected model no longer offers them.+ it('prices and submits selected options, then clears them for another model', async () => {+ await renderVideoGenPage();+ fireEvent.click(await screen.findByRole('button', { name: 'fal.ai' }));+ const model = await screen.findByLabelText('fal.ai model');+ expect(screen.queryByLabelText('Resolution')).toBeNull();+ expect(screen.queryByLabelText('Provider audio')).toBeNull();++ fireEvent.change(model, { target: { value: 'fal-ai/veo3.1/fast/image-to-video' } });+ const resolution = await screen.findByLabelText('Resolution');+ expect([...resolution.options].map((option) => option.value)).toEqual(['', '720p', '1080p', '4k']);+ expect(resolution.value).toBe('');+ expect(screen.getByLabelText('Provider audio')).not.toBeChecked();+ expect(screen.getByText(/about \$0.80 at list price/)).toHaveTextContent('provider audio off');++ fireEvent.change(resolution, { target: { value: '4k' } });+ expect(screen.getByText(/about \$2.40 at list price/)).toHaveTextContent('at 4k');+ fireEvent.click(screen.getByLabelText('Provider audio'));+ expect(screen.getByText(/about \$2.80 at list price/)).toHaveTextContent('provider audio on');+ fireEvent.change(screen.getByLabelText('Prompt'), { target: { value: 'a fox watches the rain' } });+ await findEnabledByRole('button', { name: /Add to queue/ });+ fireEvent.click(screen.getByRole('button', { name: /Add to queue/ }));+ await waitFor(() => expect(state.generateVideo).toHaveBeenCalled());+ expect(state.generateVideo.mock.calls[0][0]).toMatchObject({+ backend: 'fal', falResolution: '4k', falGenerateAudio: true,+ });++ fireEvent.change(model, { target: { value: 'fal-ai/kling-video/v3/pro/image-to-video' } });+ expect(screen.queryByLabelText('Resolution')).toBeNull();+ expect(screen.getByLabelText('Provider audio')).not.toBeChecked();+ fireEvent.change(model, { target: { value: 'example/custom-video' } });+ expect(screen.queryByLabelText('Resolution')).toBeNull();+ expect(screen.queryByLabelText('Provider audio')).toBeNull();+ expect(screen.getByText(/cost unknown for this model/)).toBeInTheDocument();+ fireEvent.change(model, { target: { value: 'fal-ai/veo3.1/fast/image-to-video' } });+ expect(screen.getByLabelText('Resolution').value).toBe('');+ expect(screen.getByLabelText('Provider audio')).not.toBeChecked();+ });+});diff --git a/client/src/pages/VideoGen.jsx b/client/src/pages/VideoGen.jsxindex f4295d3bd1..49e6a1df46 100644--- a/client/src/pages/VideoGen.jsx+++ b/client/src/pages/VideoGen.jsx@@ -98,7 +98,7 @@ import LoraPicker from '../components/imageGen/LoraPicker';import { VIDEO_RESOLUTIONS, resolutionOptionsForModel } from '../lib/videoGenResolutions';import { GROK_VIDEO_DURATIONS } from '../lib/grokVideoClip.js';import {- FAL_DEFAULT_IMAGE_VIDEO_MODEL, FAL_DEFAULT_TEXT_VIDEO_MODEL, FAL_VIDEO_MODELS, estimateFalVideoCostUsd,+ FAL_DEFAULT_IMAGE_VIDEO_MODEL, FAL_DEFAULT_TEXT_VIDEO_MODEL, FAL_VIDEO_MODELS, getFalVideoModel, falVideoResolutions, estimateFalVideoCostUsd,} from '../lib/falVideoModels.js';import { REACTOR_MAX_PROMPT_LENGTH } from '../lib/reactorVideoClip.js';import { styledVideoPrompt } from '../lib/videoGenSubmission.js';@@ -229,6 +229,7 @@ export default function VideoGen() {const {backend, isGrok, isFal, isReactor, handleBackendChange, grokDuration, setGrokDuration,falDuration, setFalDuration, falModelId, setFalModelId,+ falResolution, setFalResolution, falGenerateAudio, setFalGenerateAudio,reactorClipId, setReactorClipId, reactorSeconds, setReactorSeconds, reactorSeed, setReactorSeed,reactorAspect, setReactorAspect,mode, handleModeChange,@@ -992,6 +993,9 @@ export default function VideoGen() {// python probe, so on a cold load the list itself is normally what lands.const modelsLoading = models.length === 0;const modelFieldVisible = !modelsLoading || modelContextLoading;+ const falModel = getFalVideoModel(falModelId);+ const falResolutions = falVideoResolutions(falModel);+const notConnected = !!status && status.connected === false && !needsByovProbe;// reactor.inc rejects a prompt over 800 characters outright, and the limit@@ -1638,17 +1642,43 @@ export default function VideoGen() {className="w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent"/></FormField>+ {falModel?.resolution && (+ <FormField label="Resolution" labelClassName="block text-xs font-medium text-gray-400 mb-1">+ <select+ value={falResolution}+ onChange={(e) => setFalResolution(e.target.value)}+ className="w-full bg-port-bg border border-port-border rounded-lg px-2 py-2 text-sm text-white focus:outline-none focus:border-port-accent"+ >+ <option value="">Model default</option>+ {falResolutions.map((resolution) => (+ <option key={resolution} value={resolution}>{resolution}</option>+ ))}+ </select>+ </FormField>+ )}+ {falModel?.audio && (+ <label htmlFor="fal-provider-audio" className="flex items-center gap-2 text-sm text-gray-400">+ <input+ id="fal-provider-audio"+ type="checkbox"+ checked={falGenerateAudio}+ onChange={(e) => setFalGenerateAudio(e.target.checked)}+ className="accent-port-accent"+ />+ Provider audio+ </label>+ )}<p className="col-span-2 text-[11px] text-gray-500 leading-snug">Renders on fal.ai's queue API — leave the model blank to use PortOS's default (text-to-video, or image-to-video in Image mode). Counts against your fal.ai balance{(() => {const estimate = estimateFalVideoCostUsd({modelId: falModelId?.trim() || (mode === 'image' ? FAL_DEFAULT_IMAGE_VIDEO_MODEL : FAL_DEFAULT_TEXT_VIDEO_MODEL),seconds: falDuration === '' ? null : Number(falDuration),- width, height,+ width, height, resolution: falResolution, generateAudio: falGenerateAudio,});return estimate == null? ' — cost unknown for this model.'- : ` — about ${formatUsd(estimate)} at list price, at the model's default resolution with provider audio off.`;+ : ` — about ${formatUsd(estimate)} at list price, at ${falResolution || "the model's default resolution"} with provider audio ${falGenerateAudio ? 'on' : 'off'}.`;})()}</p></div>