Files
magpie/internal/settingsapi
yetone f6a538ece9 images: a resolution tier, 1K, 2K or 4K, in Settings and the image MCP (skingstyle48487 on X)
Asking the image MCP for 4K through a relay came back at 2K: nothing
told the model how large to draw. Settings › Models › Images now has
Image resolution (Automatic, 1K, 2K, 4K; an app menu, saved as
imageResolution), and generate_image takes a resolution argument. The
agent's own resolution or WIDTHxHEIGHT size wins over the setting.

The images API takes `resolution` (or a tier given as size, "4K"), and
each vendor gets it in its own field:
- Gemini: imageConfig.imageSize (3.x image models; 2.x draws at 1K);
- chat image models (Gemini's): image_config.image_size;
- OpenRouter /images: resolution;
- Grok Imagine: resolution 1k or 2k (its largest);
- Seedream (Ark): the size tier the model has, or its pixels for a ratio;
- MiniMax H3: area;
- GPT Image 2 and other WxH images APIs: pixels at the ratio, within
  GPT Image 2's limits (edge 3840, 655,360 to 8,294,400 pixels, /16);
- gpt-image-1, DALL·E and SenseNova keep their own sizes.
A vendor that answers 400 or 422 to a tier is asked once more without
it. An unknown resolution is a 400. Both MCPs now say what size each
image came back at, and when that is under the tier asked.

The row is drawn by videogen.js, after Video generation's, so app.js
keeps its budget (it was at 1,088,641 to the byte); the server keeps
imageResolution when a save doesn't send it (TestSettingsImageResolution),
so prefsKeep doesn't carry it. The menu has no notes: "The model's own"
was a plugin's key already.

Run (magpie-desktop WSL on xiaomi-gpu; mote was over load 18 all day):
- gofmt -l: clean; go vet -tags nogui ./... and GOOS=windows go vet
  ./...: ok.
- go test ./internal/gateway -count=1 (1995s), ./internal/imagemcp,
  ./internal/settings, ./internal/settingsapi: ok; at this head go vet
  -tags nogui of gui, gateway and settingsapi, and gateway -run
  "Tier|ImagesAPIResolution|ImageMCP|Draw|Image", settingsapi and
  imagemcp: ok.
- New: draw_tier_test.go (each protocol's field, a fake upstream for
  the images API and the image MCP, the 400 retry, the precedence).
- At this head (on 88b65d758): go test -tags nogui ./internal/gui -run
  "Budget|I18n|SettingsImage": ok; node --test i18n-keys,
  image-resolution (22 of 22: chromium and webkit, en zh zh-TW ja de,
  1100 and 420 wide), video-gen-pick and old-webkit: 62 of 64. The 2 reds are
  old-webkit's "compat.js is the first..." (guideback.js) and "the
  styles hold up in Safari 15.0" (app.css :has()), the same on a clean
  copy of origin/main 88b65d758: #6570.
- Broken by hand: imagesAPISize returning the size as given, the retry
  off, chat image_size and OpenRouter resolution dropped, the image MCP
  ignoring the setting, the server's keep of imageResolution removed,
  a zh string removed: each turned its test red.

Not run yet: the full go test ./... and the whole GUI suite (WSL's one
suite slot was taken by another session); they run after this push.
Not tried against a real vendor.
2026-11-19 00:27:58 +08:00
..