Yuu_jiang_ on X (#6849): 100milionseek and Coarena take at most 8 images a request, counted over the whole conversation, tool results included, and every turn after the ninth screenshot failed with no way on but /clear. ID-VerNe's max-images (the commit before) set one number from the CLI. This builds on it: - The cap is per provider, and optionally per model: max-images=8, or max-images=8,gemini-3-flash=10. The exact model is looked up first, then its upstream name, then "*" for all. The provider's cap moves with a model's local id like the other per-model limits. - 100milionseek's "At most 8 images per request (MAX_IMAGES)." and Coarena's "A request may carry at most 8 images." are learned as Copilot's words are, by provider and model, so the first refusal is the last. A user's own number is fitted before any refusal; a learned one that is smaller still lowers it. - Images are counted everywhere, a tool_result's too; the oldest are left out first and the latest user turn keeps its own. Only the request sent changes; session files are not touched. A request with no cap, or within it, goes out byte for byte as it came. - The provider editor's Advanced (folded unless set) has Images per request under Max output, in maximages.js, imported as that field is drawn, in every language. A GUI save keeps the value when the field isn't drawn. An editor opened and closed is not dirty (the draft takes the value only when typed), and the import, like keyrates.js's, draws nothing once the editor has closed: before that, a quick close threw "Cannot read properties of null (reading 'maxImages')" and ('keyPriceRates'), which add-sheet and key-box-once caught. - Budgets: app.js and the core +354, said in core_budget_test.go. What was run: - go test -count=1 -timeout 45m ./... on mote at618bfc1a9+ these two commits: 102 packages ok; internal/tui red on TestEveryWordHasZh ("subagent pool", red on main, fixed by6fbc24a05). After rebasing on origin/mainc9e8422fa: internal/gui (budgets), tui, agent, testenv, gateway and provider: all ok. gofmt clean; GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./... ok on mica. - At618bfc1a9+ these commits, on mote: provider-max-images 60/0, add-sheet 6/0, add-button 6/0, key-box-once 20/0, nokey-editor 4/0, provider-base-api 4/0, add-sheet-custom 32/0, kimi-subagent-pool 20/0, sync-signins-except 20/0; old-webkit 4/2 (#6030 headerpresets, #5919), i18n-keys 3/1 (#6877), provider-max-output 4/20 (#6209), editor-hints 30/10 (the same at origin/main, in #6934). - The whole GUI suite (1569 files, chromium + webkit, every language) on mote at the pre-fix head under another session's suite: 153 files red. Each red file rerun at the fixed head and at origin/mainad585ccd6on mica (and mote for the close ones). Red at head only: add-button (Escape showed the discard confirm: the dirty draft, fixed), add-sheet and key-box-once (the null draft above, fixed); now 3/0, 6/0, 20/0, provider-max-images 60/0. Every other red file is red the same at origin/main, the same subtests: filed with its numbers as #6934 (the #6782 class). i18n-keys' ", with an image" is #6877, old-webkit #6030/#5919, provider-max-output #6209. Broken by hand (each red, then put back): the relay words left out (TestImageCapLearnedFromRelayWords), per-model lookup by upstream name gone (TestMaxImagesOnAModelListedByItsOwnID), a copy made when nothing applies (TestImageCapNoneIsTheSameBytes), the learned cap over the user's (TestMaxImagesStandsOverTheLearnedCap), the GUI save dropping it (TestProviderSaveKeepsMaxImages), the CLI's empty value (TestProviderSetMaxImages), the cap not moving with a local id, the JS parse without its 1000 limit and the field not unfolding Advanced (provider-max-images), and the draft written on open (provider-max- images' Escape check, 20 red). Not tried: no real 100milionseek or Coarena account (the words are the reporter's literal ones); no GUI run on Windows or Linux; the suite's GUI half ran under load, so many reds are shared timeouts. Co-authored-by: ID-VerNe <yuu_seeing@foxmail.com>
36 lines
1.9 KiB
JavaScript
36 lines
1.9 KiB
JavaScript
// A provider's Images per request (#6849, Yuu_jiang_ on X: 100milionseek
|
||
// and Coarena take 8 images a request and refuse the ninth): one for all
|
||
// its models and model=n for one, as the context window is set. The
|
||
// gateway leaves the oldest images out down to it before sending
|
||
// (image_cap.go). The provider editor's Advanced draws it under Max
|
||
// output; app.js imports this as the editor opens (outputField), so it
|
||
// weighs nothing on the core.
|
||
window.maxImagesField = function (p) {
|
||
// the one for all models first, then model=n by id; the draft takes it
|
||
// only when typed, so an editor opened and closed has nothing to discard
|
||
const was = draft?.maxImages ?? Object.entries(p?.maxImages || {}).sort(([a], [b]) => (a !== "*") - (b !== "*") || (a > b) - (a < b)).map(([k, n]) => (k === "*" ? n : k + "=" + n)).join(", ");
|
||
const im = input(was, t("e.g. 8 · or gemini-3-flash=10, comma separated"));
|
||
im.classList.add("max-images");
|
||
im.oninput = () => { if (draft) draft.maxImages = im.value; };
|
||
return field(t("Images per request"), im, t("The most images one request carries: the oldest are left out first, the latest message's kept; empty leaves it to the vendor"));
|
||
};
|
||
|
||
// maxImagesOf is the draft's Images per request as saved, by model id
|
||
// ("*" for all, {} for none), or false once its error is shown; with no
|
||
// field drawn it is undefined, and the save keeps what was set
|
||
window.maxImagesOf = function (ed) {
|
||
const im = ed.querySelector("input.max-images");
|
||
if (!im) return undefined;
|
||
const map = {};
|
||
for (const x of im.value.split(/[,,\n]/).map((x) => x.trim()).filter(Boolean)) {
|
||
const m = /^(?:(.+?)\s*=\s*)?(\d+)$/.exec(x);
|
||
if (!m || +m[2] > 1000) {
|
||
shown(im)?.focus(NO_SCROLL);
|
||
editorError(t("Images per request: {v} is not a whole number up to 1000", { v: x }), "warn");
|
||
return false;
|
||
}
|
||
if (+m[2]) map[m[1] || "*"] = +m[2];
|
||
}
|
||
return map;
|
||
};
|