Phase 06: Video & Polish
- 4 plans created (06-01 through 06-04)
- 11 total tasks defined
- Addresses ISS-001 (model parameter adaptation)
Plans:
- 06-01: GenerateVideo node with video model selector
- 06-02: Video playback in output node
- 06-03: Custom model parameters from provider schemas
- 06-04: Edge case handling and final polish
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Import uploadImageForUrl, shouldUseImageUrl, deleteImages from @/lib/images
- Process images for Replicate/fal providers before generation
- Small images (<256KB) use data URIs directly
- Large images converted to temporary URLs via /api/images/[id]
- Cleanup uploaded images in finally block (success or failure)
- Gemini path unchanged (handles base64 directly)
- Add image parameter to predictionInput when images array provided
- Log image input presence for debugging
- Uses 'image' param name (most common for img2img models)
Phase 05: Image URL Server
- 2 plans created
- 6 total tasks defined
- Request-scoped cleanup (no TTL) to prevent memory accumulation
- Ready for execution
- Extract last segment from model ID (e.g., "effects" from "kling-video/v1.6/pro/effects")
- Append as suffix if not already in name: "Kling 1.6 - effects"
- Helps differentiate model variants with same display name
- Show all capability badges (txt→img, img→img, txt→vid, img→vid)
- Display model ID below name to differentiate similar models
- Larger cover images (20x20 instead of 16x16)
- Taller cards with 3-line description (was 2)
- Better visual differentiation for fal.ai model variants
- Replicate's search API endpoint unreliable, use client-side filtering
- Always cache full model list for Replicate (not per-search-query)
- Apply search filter on cached models for faster subsequent searches
- Remove unused ReplicateSearchResponse and ReplicateSearchResult types
- Add ModelSearchDialog with search, provider filter, and capability filter
- Integrate with /api/models endpoint using API key headers
- Display model grid with cover images, provider badges, and descriptions
- Update addNode to accept optional initialData for pre-configured nodes
- Replace placeholder in FloatingActionBar with actual dialog
- Dialog opens when provider icon is clicked with provider filter in state
- Placeholder UI shows "Coming in 04-02" message
- Close button properly resets modelSearchOpen state
- Ready for 04-02 to implement full search functionality
- Add modelSearchOpen/modelSearchProvider state to workflowStore
- Add setModelSearchOpen action to toggle dialog with provider filter
- Add ProviderIconButton component with Replicate (R) and fal.ai (lightning) icons
- Replicate icon only visible when API key is configured
- fal.ai icon always visible (works without key but rate limited)
- Add useEffect to migrate legacy nodes without selectedModel on mount
- Derive selectedModel from model field for legacy workflows
- Ensures UI reflects correct provider/model for migrated nodes
- Add API key headers (X-Replicate-API-Key, X-Fal-API-Key) for external providers
- Include selectedModel in request payload for provider routing
- Update logging to show provider-specific info
- Apply same changes to regenerateNode for consistency
- Migrate nanoBanana nodes without selectedModel on workflow load
- Derive selectedModel from legacy model field (nano-banana, nano-banana-pro)
- Set provider to gemini and appropriate displayName for migrated nodes
Refactor generate API route to support multiple providers:
- Accept both legacy format and new format with selectedModel
- Route requests to Replicate, fal.ai, or Gemini based on provider
- Extract Gemini logic into generateWithGemini() helper function
- Add generateWithReplicate() and generateWithFal() server-side helpers
- Get provider API keys from request headers (X-Replicate-API-Key, X-Fal-API-Key)
- Preserve backward compatibility for existing Gemini-based workflows
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement generation via fal.ai's fal.run API:
- POST to https://fal.run/{modelId} with prompt and parameters
- Use "Key {apiKey}" auth header (works without key but rate limited)
- Extract image URL from response (handles images array, image object, or output string)
- Fetch image and convert to base64 data URL
- Return GenerationOutput with type: "image"
Note: Image inputs skipped for now (Phase 5 adds URL server)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement generation via Replicate's prediction API:
- POST to /predictions with model version and prompt
- Poll /predictions/{id} until succeeded/failed/canceled
- Fetch output image URL and convert to base64 data URL
- Return GenerationOutput with type: "image"
Note: Image inputs skipped for now (Phase 5 adds URL server)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Video models were getting text-to-image capability by default.
Now properly detects video models (by keywords like video, animate,
motion, luma, kling, minimax) and only assigns video capabilities.
Both APIs return paginated results but we were only fetching page 1.
Now fetches up to 5 pages from Replicate (~125 models) and 10 pages
from fal.ai to get more complete model lists.
UAT-005: Video models were showing in image-only dropdown because
the API wasn't filtering by capabilities param. Now filters results
based on ?capabilities=text-to-image,image-to-image query param.
UAT-004: Replicate shows first page only (~25 models) - this is
expected API behavior. Full pagination can be added later.
Tasks completed: 3/3
- Add SelectedModel type and update NanoBananaNodeData
- Create GenerateImageNode with provider/model selector
- Update store and canvas references
SUMMARY: .planning/phases/03-generate-node-refactor/03-01-SUMMARY.md
- Rename loadNanoBananaDefaults to loadGenerateImageDefaults (keep alias)
- Rename saveNanoBananaDefaults to saveGenerateImageDefaults (keep alias)
- Update createDefaultNodeData to set default selectedModel for Gemini
- Update WorkflowCanvas nodeTypes to use GenerateImageNode
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add SelectedModel interface for multi-provider model selection in image
generation nodes. Update NanoBananaNodeData with optional selectedModel
field for backward compatibility with existing workflows.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename target from Generate to GenerateImage
- Filter model selector to image capabilities only (text-to-image, image-to-image)
- Note GenerateVideo node deferred to Phase 6
Phase 2: Model Discovery is now complete with all 3 plans executed:
- 02-01: Replicate provider
- 02-02: fal.ai provider
- 02-03: Model caching and unified API
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Export cache utilities from provider index and add listAllModels/
searchAllModels helper functions for multi-provider operations.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add /api/models endpoint that aggregates models from all configured
providers. Supports caching, search, provider filtering, and handles
partial failures gracefully.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add in-memory cache for provider model lists with 10-minute TTL.
Includes get/set/invalidate functions and cache key generation.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>