ac4af582301a4e8a29245dbba767eba31334ddf9
2
Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
7301c070f0 |
gateway: /v1/images/edits reads and forwards OpenAI's markup layer (#5364)
OpenAI's images edit takes `markup`, a transparent PNG laid over the
first image to steer the edit (JSON image_url, or a multipart file part;
never beside a mask). magpie read only the mask: a JSON markup stopped in
drawing.Extra, a multipart one was dropped, and neither the ChatGPT
backend's JSON edit nor the plain multipart edit carried it, so an edit
with a markup came back 200 with the layer left out (#5364, kongjianguan,
with the probe and the three places).
drawing has a Markup beside Mask, read from JSON (markup.image_url) and
from a multipart `markup` part, and sent where the mask is: as
{"image_url": data URL} on the ChatGPT/SenseNova JSON edit and as its own
part on the multipart edit. A markup that can't be read, or one sent with
a mask, is a 400 before anything is asked. OpenRouter, Volcengine Ark and
DashScope, which turn a mask away, turn a markup away by name too.
Patch from ggbdpq (mbox sha256 b591c6ad499789c5, matches the issue).
Changed in review:
- "markup" joins drawingRead, so it no longer also rides Extra; on Ark
the raw field went out as an Ark field.
- Ark and DashScope refuse a markup as they refuse a mask; the patch
refused it on OpenRouter only.
- A mask with a markup is a 400 (OpenAI's docs: "Cannot be combined
with mask").
- Tests rewritten: the patch's broken-markup test posted to a server
with no "art" provider, so it would have been a 400 for the unknown
model with or without the fix; the Codex test kept its upstream in a
package global. They now check the bytes that reach the vendor, the
multipart-in case, the mask clash and the three refusals.
Run on mote (-tags nogui, the package's TestMain sandbox):
- TestCodexEditSendsTheMarkup, TestEditSendsTheMarkup/{json,multipart},
TestEditWithAMarkupItCantSendIsRefused/{not base64,beside a mask},
TestMarkupRefusedWhereNoLayerIsTaken: ok.
- Broken by hand: draw.go, draw_dashscope.go, draw_volcengine.go back to
|
||
|
|
03f3e1528b |
gateway: Qwen-Image and Wan 2.7 image models draw on DashScope's own API, so qwen-image-3.0-pro no longer draws nothing (judi0713)
judi0713 on Discord (v0.1.2288): qwen-image-3.0-pro draws when called
directly, but through magpie answers 502 "qwen-image-3.0-pro drew
nothing". DashScope documents its Qwen-Image and Wan 2.7 image models on
its own multimodal-generation API only (docs.qwencloud.com "Qwen-Image
text-to-image", and the Token Plan's "Integrate multimodal generation"):
a POST to <host>/api/v1/services/aigc/multimodal-generation/generation,
answered with the images at output.choices[].message.content[].image.
magpie sent them to the OpenAI images API at /compatible-mode/v1 and, on
its 404, to chat completions, whose answer holds no image it reads. Which
of the two answered the reporter is not seen from here.
Now, on a DashScope provider (dashScope(): Bailian, Model Studio, the Qwen
AI platform and Qwen Cloud, pay as you go and Token Plan, by preset or
host) a model named qwen-image* or wan2.7-image* draws there
(draw_dashscope.go, from drawImages):
- the prompt and any input images (data URLs) as one user message,
parameters watermark false, n when over 1, size as W*H;
- every image of every choice is read; with none, the error says what
DashScope said (message and code), the model's text, or the
finish_reason;
- a mask or a ratio size is a 400 saying what to send instead, with no
request made.
The root is the provider's Chat (or Anthropic) base cut at
/compatible-mode/, /apps/ or /api/v1. Every other provider and model is
unchanged (TestDashScopeDrawsScoped). /v1/images/generations and
/v1/images/edits both go through drawImages, and magpie's generate_image
MCP draws through those two, so all three are covered.
The fixtures are the documented response bytes, not a live answer.
Run (mote, at b06df2557 on
|