Skip to content

improvement(media-blocks): new versions of image and video gen with latest models + fixes#4667

Merged
icecrasher321 merged 7 commits into
stagingfrom
improvement/media-gen-blocks
May 19, 2026
Merged

improvement(media-blocks): new versions of image and video gen with latest models + fixes#4667
icecrasher321 merged 7 commits into
stagingfrom
improvement/media-gen-blocks

Conversation

@icecrasher321
Copy link
Copy Markdown
Collaborator

Summary

New versions of image and video gen models

Support for new providers incl. Google Nano Banana, OpenAI Sora, Seeddance via Fal

Updated docs

Type of Change

  • Other: Integration update

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
docs Skipped Skipped May 19, 2026 11:36pm

Request Review

@cursor
Copy link
Copy Markdown

cursor Bot commented May 19, 2026

PR Summary

High Risk
Adds new server-side generation paths that call external AI providers and stores generated media, plus expands Fal.ai model/parameter validation; mistakes here can impact cost, latency/timeouts, and file handling/security around remote URL fetching.

Overview
Adds new generation-capable block versions and tools. Introduces image_generator_v2 (OpenAI GPT Image, Google Gemini/Nano Banana, Fal.ai multi-model) backed by a new image_generate tool and a new POST /api/tools/image route that generates, downloads/validates, and stores images (execution upload when available; otherwise storage fallback).

Updates video generation to a new video_generator_v3. Expands Fal.ai model catalog/params (durations, aspect ratios, resolutions, optional generateAudio) with centralized validation, improves MiniMax defaults and adds an endpoint option affecting resolution, and relaxes aspect-ratio validation for Fal.ai’s model-specific constraints.

Aligns product/docs plumbing. Updates docs pages, integration registry/icon mappings, integrations JSON (including docs URL change for video), built-in tool type lists, and the docs generation script to emit separate icon mappings for docs (including hidden versioned blocks) vs landing (visible only).

Reviewed by Cursor Bugbot for commit 71b4080. Configure here.

Comment thread apps/sim/app/api/tools/image/route.ts
Comment thread apps/sim/app/api/tools/image/route.ts Outdated
Comment thread apps/sim/app/api/tools/image/route.ts
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 19, 2026

Greptile Summary

This PR adds multi-provider image generation (OpenAI GPT Image, Google Nano Banana via Gemini, Fal.ai) through a new image_generator_v2 block and POST /api/tools/image endpoint, and expands the Fal.ai video generation backend with a dozen new models (Veo 3.1 Fast, Sora 2/Pro, Seedance 2.0, Kling v3/o3, LTX 2.3, WAN 2.2) via a config-driven FALAI_MODEL_CONFIGS map.

  • Image route: replaces the old per-provider ad-hoc dispatch with structured generateWithOpenAI, generateWithGemini, and generateWithFalAI helpers; SSRF protection via validateUrlWithDNS/secureFetchWithPinnedIP is correctly applied in bufferFromImageUrl; CANCELLED status is handled in the Fal.ai polling loop.
  • Video route: migrates model-to-endpoint mapping to FALAI_MODEL_CONFIGS, fixes the minimax-hailuo-2.3 endpoint (was incorrectly pointing at hailuo-02), adds generateAudio support, and fixes CANCELLED polling exit.
  • Blocks/tools: adds ImageGeneratorV2Block, imageGenerateTool, and updates falaiVideoTool/minimaxVideoTool descriptions to reflect new model availability.

Confidence Score: 5/5

Safe to merge; all major backend changes are additive, SSRF guards are intact, and the previous polling/status bugs are fixed.

The image and video routes are well-structured with proper input validation, SSRF protection, and terminal-status handling. The config-driven model dispatch replaces fragile hardcoded maps. The two non-blocking nits (duplicate Gemini/Fal.ai model labels, missing duration validation for two legacy Kling configs) have no correctness impact at runtime.

apps/sim/app/api/tools/video/route.ts — the two legacy Kling configs (kling-2.5-turbo-pro, kling-2.1-pro) lack duration option lists; apps/sim/blocks/blocks/image_generator.ts — Gemini model labels duplicate Fal.ai labels.

Important Files Changed

Filename Overview
apps/sim/app/api/tools/image/route.ts Adds a new POST endpoint for multi-provider image generation (OpenAI, Gemini, Fal.ai); includes proper SSRF guards via validateUrlWithDNS/secureFetchWithPinnedIP in bufferFromImageUrl, CANCELLED status handling, and config-driven model validation.
apps/sim/app/api/tools/video/route.ts Refactors Fal.ai video generation to a config-driven FALAI_MODEL_CONFIGS map; adds new models (Veo 3.1 Fast, Sora 2 Pro, Seedance 2.0, Kling v3/o3, LTX 2.3, WAN 2.2); fixes MiniMax hailuo-2.3 endpoint; now handles CANCELLED status. Two legacy Kling model configs lack durationOptions validation.
apps/sim/blocks/blocks/image_generator.ts Adds ImageGeneratorV2Block with multi-provider support; Gemini model labels (Nano Banana 2/Pro/Nano Banana) duplicate Fal.ai model labels, which could confuse users switching providers.
apps/sim/blocks/blocks/video_generator.ts Adds comprehensive sub-block UI for the many new Fal.ai video models with model-specific duration, aspect ratio, resolution, and audio dropdowns; introduces FALAI_LATEST_MODEL_OPTIONS alongside FALAI_PREVIOUS_MODEL_OPTIONS for versioned model selection.
apps/sim/tools/image/generate.ts New tool definition for image_generate; parameters use correct user-only/user-or-llm visibility; clean transform response with graceful error handling.
apps/sim/tools/video/falai.ts Updated model descriptions and added generateAudio param to tool config; matches the new route capabilities cleanly.
apps/sim/tools/video/minimax.ts Updated default model to hailuo-2.3 and added endpoint parameter with standard/pro description; matches route changes.

Sequence Diagram

sequenceDiagram
    participant Client
    participant ImageRoute as POST /api/tools/image
    participant OpenAI as OpenAI API
    participant Gemini as Gemini API
    participant FalAI as Fal.ai Queue

    Client->>ImageRoute: "{provider, apiKey, model, prompt, ...}"
    ImageRoute->>ImageRoute: parseRequest + checkInternalAuth
    alt "provider = openai"
        ImageRoute->>OpenAI: POST /v1/images/generations
        OpenAI-->>ImageRoute: b64_json or url
        ImageRoute->>ImageRoute: bufferFromImageUrl (SSRF-safe)
    else "provider = gemini"
        ImageRoute->>Gemini: POST generateContent
        Gemini-->>ImageRoute: inlineData (base64)
    else "provider = falai"
        ImageRoute->>FalAI: "POST queue.fal.run/{endpoint}"
        FalAI-->>ImageRoute: "{request_id, status_url, response_url}"
        loop Poll every 3s
            ImageRoute->>FalAI: GET status_url
            FalAI-->>ImageRoute: "{status: QUEUED|IN_PROGRESS|COMPLETED|FAILED|CANCELLED}"
        end
        ImageRoute->>FalAI: GET response_url
        FalAI-->>ImageRoute: "{images: [{url, content_type}]}"
        ImageRoute->>ImageRoute: bufferFromImageUrl (SSRF-safe)
    end
    ImageRoute->>ImageRoute: storeGeneratedImage (execution or copilot)
    ImageRoute-->>Client: "{imageUrl, imageFile, metadata}"
Loading

Reviews (3): Last reviewed commit: "address api mismatches" | Re-trigger Greptile

Comment thread apps/sim/app/api/tools/video/route.ts Outdated
Comment thread apps/sim/app/api/tools/video/route.ts
Comment thread apps/sim/app/api/tools/image/route.ts
@icecrasher321
Copy link
Copy Markdown
Collaborator Author

@greptile

@icecrasher321
Copy link
Copy Markdown
Collaborator Author

bugbot run

Comment thread apps/sim/tools/openai/image.ts Outdated
Comment thread apps/sim/app/api/tools/image/route.ts
Comment thread apps/sim/app/api/tools/image/route.ts
Comment thread apps/sim/app/api/tools/video/route.ts
@icecrasher321
Copy link
Copy Markdown
Collaborator Author

bugbot run

@icecrasher321
Copy link
Copy Markdown
Collaborator Author

@greptile

Comment thread apps/sim/blocks/blocks/video_generator.ts
@icecrasher321
Copy link
Copy Markdown
Collaborator Author

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 54d2e1f. Configure here.

@icecrasher321
Copy link
Copy Markdown
Collaborator Author

bugbot run

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 71b4080. Configure here.

@icecrasher321 icecrasher321 merged commit 974a18d into staging May 19, 2026
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant