feat(inpainting): add inpainting endpoint, wire ImageGenerationFunc and return generated image URL
Description
This patch implements an OpenAI-compatible inpainting endpoint and wires image generation into the LocalAI backend. Changes are limited to the LocalAI Go codebase.
-
Adds InpaintingEndpoint handling POST /v1/images/inpainting with multipart/form-data support for image and mask.
-
Endpoint writes a JSON payload with base64 image/mask and prepares a temporary output PNG path, then calls backend.ImageGenerationFunc(...) to perform generation.
-
Introduces and uses the test-friendly indirection ImageGenerationFunc in image.go so the generation logic can be stubbed in tests.
-
Adds unit tests for the inpainting handler (inpainting_test.go) covering missing-files and the happy path (with backend.ImageGenerationFunc stubbed).
-
Registers the inpainting routes and a default model name middleware in openai.go.
-
Updates Swagger (swagger.yaml) and adds a Swaggo-style docstring on the new endpoint for proper OpenAPI generation.
Notes for Reviewers
- inpainting.go (new endpoint)
- inpainting_test.go (new tests)
- image.go (ImageGenerationFunc indirection)
- mcp.go (minor related adjustments)
- openai.go (routes registration)
- swagger.yaml (OpenAPI updates)
Signed commits
- [x] Yes, I signed my commits.
Deploy Preview for localai ready!
| Name | Link |
|---|---|
| Latest commit | 6d14c55624ef53f9411d465660d8f47e87f54de4 |
| Latest deploy log | https://app.netlify.com/projects/localai/deploys/692350f8ee2c320008e38425 |
| Deploy Preview | https://deploy-preview-7328--localai.netlify.app |
| Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify project configuration.
@mudler Can i do something for [TIMEDOUT] in [It] - /Users/runner/work/LocalAI/LocalAI/core/http/app_test.go:994 @ 11/22/25 22:28:28.921 in the apple CI ? Or the problem is on CI side ?