4.7 KiB
| phase | plan | type |
|---|---|---|
| 05-image-url-server | 2 | execute |
Purpose: Enable img2img workflows by passing input images to providers as URLs, completing the multi-provider image generation pipeline. Output: Working img2img support for Replicate and fal.ai models.
<execution_context> ~/.claude/get-shit-done/workflows/execute-phase.md ~/.claude/get-shit-done/templates/summary.md </execution_context>
@.planning/PROJECT.md @.planning/ROADMAP.md @.planning/STATE.mdPrior plan in this phase:
@.planning/phases/05-image-url-server/05-01-SUMMARY.md
Relevant source files:
@src/app/api/generate/route.ts @src/lib/images/index.ts @src/store/workflowStore.ts
Tech stack available: Image URL utilities from 05-01, provider dispatch pattern in generate route Established patterns: Header-based API key passing, server-side provider execution
Provider image parameter requirements:
- Replicate: Parameter name varies by model (commonly
image,input_image). Format: URI (URL or data URI). - fal.ai: Parameter is
image_url. Format: URL string or data URI.
Note: Different Replicate models use different parameter names (image, input_image, image_prompt). Start with image as it's most common for img2img models. Future enhancement could detect from model schema.
Do NOT convert base64 to URL here - that happens at the call site (workflow execution).
TypeScript compiles: npx tsc --noEmit
generateWithReplicate passes image parameter to prediction input when images provided
fal.ai is consistent: always use image_url parameter name.
TypeScript compiles: npx tsc --noEmit
generateWithFal passes image_url parameter when images provided
Pattern:
const uploadedImageIds: string[] = [];
try {
// Process images, track IDs
// Call provider
} finally {
deleteImages(uploadedImageIds);
}
This ensures:
- Small images (<256KB) use efficient data URIs
- Large images use temporary URLs served by /api/images/[id]
- Images cleaned up immediately after provider fetches them (success or failure)
- No memory accumulation
- Gemini path unchanged (it handles base64 directly)
Build succeeds:
npm run buildLarge images converted to URLs and cleaned up after provider call completes
<success_criteria>
- All tasks completed
- All verification checks pass
- No TypeScript errors
- Replicate and fal.ai can receive image inputs for img2img workflows
- Phase 5 complete </success_criteria>