[diffusion] fix: Support default response_format=url in /v1/images/generations to avoid 400 errors when response_format is omitted (#19360)

Co-authored-by: Makcum888e <79456407+Makcum888e@users.noreply.github.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
This commit is contained in:
joesun
2026-02-27 19:47:38 +08:00
committed by GitHub
parent 98e433e305
commit ca5f2e2ed1
2 changed files with 6 additions and 2 deletions

View File

@@ -102,7 +102,8 @@ curl -sS -X POST "http://localhost:30010/v1/images/generations" \
```
> **Note**
> The `response_format=url` option is not supported for `POST /v1/images/generations` and will return a `400` error.
> If `response_format=url` is used and cloud storage is not configured, the API returns
> a relative URL like `/v1/images/<IMAGE_ID>/content`.
**Edit an image**
@@ -136,7 +137,8 @@ curl -sS -X POST "http://localhost:30010/v1/images/edits" \
**Download image content**
When `response_format=url` is used with `POST /v1/images/edits`, the API returns a relative URL like `/v1/images/<IMAGE_ID>/content`.
When `response_format=url` is used with `POST /v1/images/generations` or `POST /v1/images/edits`,
the API returns a relative URL like `/v1/images/<IMAGE_ID>/content`.
**Endpoint:** `GET /v1/images/{image_id}/content`

View File

@@ -159,6 +159,8 @@ async def generations(
result,
b64_list=b64_list,
cloud_url=cloud_url,
# Provide a local fallback URL when cloud upload is unavailable, mirroring /v1/images/edits.
fallback_url=f"/v1/images/{request_id}/content",
)
return ImageResponse(**response_kwargs)