mirror of
https://github.com/Significant-Gravitas/AutoGPT.git
synced 2026-01-10 07:38:04 -05:00
<!-- Clearly explain the need for these changes: --> This PR adds a new internal block, **AI Image Editor**, which enables **text-based image editing** via BlackForest Labs’ Flux Kontext models on Replicate. This block allows users to input a prompt and optionally a reference image, and returns a transformed image URL. It supports two model variants (Pro and Max), with different cost tiers. This functionality will enhance multimedia capabilities across internal agent workflows and support richer AI-powered image manipulation. --- ### Changes 🏗️ * Added `FluxKontextBlock` in `backend/blocks/flux_kontext.py` * Uses `ReplicateClient` to call Flux Kontext Pro or Max models * Supports inputs for `prompt`, `input_image`, `aspect_ratio`, `seed`, and `model` * Outputs transformed image URL or error * Added credit pricing logic for Flux Kontext models to `block_cost_config.py`: * Pro: 10 credits * Max: 20 credits * Added documentation for the new block at `docs/content/platform/blocks/flux_kontext.md` * Updated block index at `docs/content/platform/blocks/blocks.md` to include Flux Kontext ---  ### Checklist 📋 #### For code changes: * [x] I have clearly listed my changes in the PR description * [x] I have made a test plan * [x] I have tested my changes according to the test plan: <!-- Put your test plan here: --> * [x] Prompt-only input generates an image * [x] Prompt with image applies edit correctly * [x] Image respects specified aspect ratio * [x] Invalid image URL returns helpful error * [x] Using the same seed gives consistent output * [x] Output chaining works: result URI can be used in downstream blocks * [x] Output from Max model shows higher fidelity than Pro <details> <summary>Example test plan</summary> * [x] Create from scratch and execute an agent using Flux Kontext with at least 3 blocks * [x] Import agent with Flux Kontext from file upload, and confirm execution * [x] Upload agent (with Flux Kontext block) to marketplace (internal test) * [x] Import agent from marketplace and confirm correct execution * [x] Edit agent with Flux Kontext block from monitor and confirm output </details> #### For configuration changes: * [x] `.env.example` is updated or already compatible with my changes * [x] `docker-compose.yml` is updated or already compatible with my changes * [x] I have included a list of my configuration changes in the PR description (under **Changes**) * No new environment variables or services introduced <details> <summary>Examples of configuration changes</summary> * N/A </details> --------- Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co>