ITADN

feat(replicate): support image-to-image editing models (Flux Kontext, etc.)

#1363Openisamu 创建于 2026-04-30
I
isamucommented
## Background PR #1362 で Replicate t2i モデルを多数追加したが、i2i (image-to-image editing) モデルは現状の agent では参照画像を活かせない。 **i2i editing の例:** - 入力: 既存画像 + プロンプト「車の色を青に」 - 出力: 編集後画像 ## Affected Models 現状 `provider2ImageAgent.replicate.models` から除外しているもの: | モデル | 参照画像の param | 形式 | |---|---|---| | \`black-forest-labs/flux-kontext-pro\` | \`input_image\` | 単体 string (URL or base64) | | \`black-forest-labs/flux-kontext-max\` | \`input_image\` | 単体 string | | \`black-forest-labs/flux-1.1-pro\` | \`image_prompt\` | 単体 string (任意) | | \`black-forest-labs/flux-1.1-pro-ultra\` | \`image_prompt\` | 単体 string (任意) | | \`black-forest-labs/flux-pro\` | \`image_prompt\` | 単体 string (任意) | | \`black-forest-labs/flux-dev\` | \`image\` | 単体 string | | \`luma/photon\` | \`image_reference_url\` / \`style_reference_url\` / \`character_reference_url\` | 個別 URL | | \`ideogram-v3-*\` | \`image\` (inpainting) + \`mask\` | 別用途 | ## Current Behavior \`image_replicate_agent.ts:42-49\` は \`image_input\` (array, base64) を渡す形式で固定: \`\`\`ts if (referenceImages && referenceImages.length > 0) { input.image_input = referenceImages.map(...); } \`\`\` → \`bytedance/seedream-4\`, \`google/nano-banana\`, \`black-forest-labs/flux-2-dev\` など \`image_input\` 形式のモデルは参照画像が渡るが、上記モデルでは渡らない (t2i としては動くが editing 機能が活きない)。 ## Proposed Approach Movie 側 (\`provider2MovieAgent.replicate.modelParams\`) で採用済みのパターンに揃える: - \`provider2ImageAgent.replicate\` に \`modelParams\` を追加 - 各モデルごとに reference image の param 名と形式 (array vs single, URL vs base64) を宣言 - agent 側はその param 名と形式に従って input を組み立てる \`\`\`ts modelParams: { \"black-forest-labs/flux-kontext-pro\": { reference_image_param: \"input_image\", reference_image_format: \"single_base64\", }, \"black-forest-labs/flux-2-dev\": { reference_image_param: \"input_images\", reference_image_format: \"array_base64\", }, // ... } \`\`\` ## Out of Scope - Mask-based inpainting (Ideogram の \`mask\` param) — UI/UX 設計から必要 - Multi-reference (Luma Photon の image/style/character 別指定) — 別 schema 拡張が必要 ## Related - PR #1362 (Replicate t2i モデル追加 — このPRで除外したものを本 issue で対応)
0 条评论