The provider editor's Advanced held some thirty rows in one run (item 19). They now sit under four small headings, Routing, Models, Limits and cost, and Connection, each row keeping its order inside its group; a row the list doesn't name stays with the one before it, and the headings show only when two groups are used. No page, row or fold moves elsewhere. advgroups.js is imported when Providers first draws, so it weighs nothing on the core script, and the editor opens with the headings already in place. Not done from item 19: a routing group's strategy stays under the group's Advanced. The owner folded it there on purpose (9edc6506e, 11-09, "the Add group form was too long"; and for providers on 11-12, "这些也要折叠在高级里"), and routing-advanced holds the provider side. New test: advanced-headings, for an account and a key, both engines, every language: the headings in order, Routing/Stays under Routing, Context window under Models, Requests at once under Limits and cost, Proxy under Connection, the heading across the whole row. Broken by hand: both groupAdvanced(advIn) calls removed, advanced-headings 10 of 10 red; put back, 10 of 10 green. Run (mote, Chromium and WebKit, en zh zh-TW ja de): - before the rebase, 23 GUI files: every one green except plugin-provider-options (my bug, fixed in this branch before the push) and settings-groups' "warm-ups and check-in in each service's provider editor", red the same way at fresh origin/main98c487d09(an extra "Spend extra usage" row; #6597, commented with the sha). - rebased on origin/main98c487d09: advanced-headings, plugin-provider-options, i18n-keys, routing-advanced, provider-prefs, settings-search, panel-profiles, builtins, chatgpt-usage-why, provider-concurrency, websearch-places, library-mcp-hub all green; go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii, plugin, provider and access ok; go vet ok. No budget raised. The Codex client row07d19510fadded to the Codex provider's Advanced sits under Connection, beside User-Agent: which client the requests say they come from. advanced-headings has a Codex account for it; with the row left out of the list, 10 of 10 red. Again at the pushed head, rebased on origin/main39c5040d7and07d19510f(mote, Chromium and WebKit, every language): advanced-headings, plugin-provider-options, i18n-keys, routing-advanced, provider-prefs, settings-search, panel-profiles, builtins, chatgpt-usage-why, provider-concurrency, websearch-places, library-mcp-hub, codex-client, codex-client-editor and nav-timeout all green; go test ./internal/gui -run 'TestCoreScriptBudget|TestI18n|TestCSS' ok; ./internal/library, pii, plugin, provider, access, ghtoken, davsync and gwmw ok, and the gateway and agent tests whose strings changed; gofmt -l empty; go vet, GOOS=linux go vet -tags nogui ./... and GOOS=windows go vet ./internal/... clean. (GOOS=linux go vet ./... without nogui stops in Wails' cgo-only webview_window_linux.go, the same on origin/main 39c5040d7.) Not tried: the real app window, and Linux/Windows runs (cross-OS go vet only).
44 lines
2.3 KiB
JavaScript
44 lines
2.3 KiB
JavaScript
// advGroups puts the provider editor's Advanced rows under four small
|
|
// headings (item 19 of the 11-17 scan: some thirty rows in one run read as
|
|
// a wall). Each row keeps its own order inside its group, and a row this
|
|
// list doesn't name stays with the row before it. A heading shows only
|
|
// when Advanced holds rows of two groups or more. app.js's groupAdvanced
|
|
// imports this when an editor first opens, so it weighs nothing on the
|
|
// core.
|
|
(() => {
|
|
const GROUPS = [
|
|
["Routing", ["Routing", "Rate limited", "Stays", "Resets", "Warm up", "Check in", "Claude Code", "Fallback", "Rests", "Errors"]],
|
|
["Models", ["Context window", "Max output", "Compaction", "Compact at", "Images", "Web search"]],
|
|
["Limits and cost", ["Requests at once", "Accounts at once", "Requests per minute", "Queue size", "Price rate", "Free for me", "Billing", "Rate windows", "Account balance", "Balance URL", "Balance field"]],
|
|
["Connection", ["Headers", "Extra body", "Reply headers", "Request headers to pass", "Proxy", "Upstream", "Key header", "User-Agent", "Codex client", "Masking", "Certificate", "HTTP version", "WebSocket", "Agents"]],
|
|
];
|
|
window.advGroups = function (box) {
|
|
if (box.dataset.grouped) return;
|
|
box.dataset.grouped = "1";
|
|
const of = new Map();
|
|
GROUPS.forEach(([, labels], i) => labels.forEach((k) => of.set(t(k), i)));
|
|
// a row is its label and the control after it; anything else (the
|
|
// balance slot, a placeholder a lazy module fills) is a row of its own
|
|
const rows = [];
|
|
for (let n = box.firstChild; n; ) {
|
|
const next = n.nextSibling;
|
|
if (n.nodeName === "LABEL" && next) {
|
|
rows.push({ nodes: [n, next], key: n.firstChild?.textContent?.trim() });
|
|
n = next.nextSibling;
|
|
} else {
|
|
rows.push({ nodes: [n], key: n.classList?.contains("bal-slot") ? t("Account balance") : "" });
|
|
n = next;
|
|
}
|
|
}
|
|
let last = GROUPS.length - 1;
|
|
for (const r of rows) last = r.group = of.has(r.key) ? of.get(r.key) : last;
|
|
const used = new Set(rows.map((r) => r.group));
|
|
const heads = used.size > 1;
|
|
for (const [i, [name]] of GROUPS.entries()) {
|
|
if (!used.has(i)) continue;
|
|
if (heads) box.append(el("div", "adv-head", t(name)));
|
|
for (const r of rows) if (r.group === i) box.append(...r.nodes);
|
|
}
|
|
};
|
|
})();
|