gui: the provider editor folds rarely used fields under Advanced

The owner: "Provider表单太复杂了…有一些可以折叠在高级里面". Headers,
proxy, concurrency and RPM limits, prices, context and output windows,
native compaction and fallback now sit in an "Advanced" fold beside the
key and models. It opens on its own when any of them is set, keeps the
state it was left in across the editor's redraws (keyed by the provider
being edited), and a Save refused on a field inside it opens it and
focuses that field. A signed-in account's editor folds the same.
Strings in zh, zh-TW, ja and de.

Motion ("整个弹窗高度的改变也应该是丝滑的动画"): the fold grows and
shrinks on one spring-like curve, its rows fading in, its arrow turning,
and the dialog's height follows on the same curve both ways; clicked
again mid-way it turns back from where it is. Reduce motion: at once.

Every dialog holds its place: the element last pressed or focused stays
where it was while the dialog grows or shrinks (a relative top plus a
max-height cap), so the button under the pointer doesn't run away. Where
there is no room above, only a pressed button below the fields shortens
them through the cap; nothing a click does scrolls the fields
(models-fold, names-fold). An element mid-scale (a Copy button's pop) is
measured by its parent (key-copy). The names list holds its height while
drawNames rebuilds it, so WebKit doesn't clamp the editor's scroll mid
rebuild (provider-detect, "Ask on one API moved" 64→190).

Tests: provider-advanced-fold (new, 5 languages × 2 engines, 420px);
about 21 editor tests open Advanced before reaching a folded field;
balance-method and plugin-move find the fold by its class; detect-draft
allows 0.5px. appScriptBudget 1,250,000 and coreScriptBudget 1,426,000
(1,232,466 and 1,405,937 with this).

Run: go test ./internal/gui/ ok. Every GUI file (771) in a full run,
4 at a time; its reds, rerun alone at this head, both engines:
key-copy 8/0, models-fold 4/0, names-fold 8/0, balance-method 42/0,
provider-detect 4/0, plus provider-remove 16/0, plugin-move 8/0,
provider-detect-draft 20/0, provider-advanced-fold 50/0,
provider-add-models 4/0. Red on origin/main as well, filed: #2435
(agent-connect-no-models, fixed in cf21b71ff), #2439 (fonts), #2443
(key-balance-card), #2228 (quota-count-wrap, quota-name-translated),
#1905 (routing-wb-restricted), #2448 (s3-sync); mobile-web and
library-workbuddy-trust red only under load, noted on #1544;
readable-focus and text-size fixed on main in 1a16fc0b5 and d3ca90afc.
This commit is contained in:
yetone
2026-10-16 04:08:02 +08:00
parent fbabe861e2
commit 0cad76cd99
29 changed files with 556 additions and 62 deletions
+6 -2
View File
@@ -2918,8 +2918,9 @@ body.window .ag-sk-icon { width: 22px; height: 22px; border-radius: 6px; }
.editor .more { grid-column: 1 / -1; }
.editor .more summary { font-size: 12px; color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 4px; padding: 2px 0; margin-left: 86px; }
.editor .more summary::-webkit-details-marker { display: none; }
.editor .more summary::before { content: "▸"; font-size: 10px; color: var(--faint); }
.editor .more[open] summary::before { content: "▾"; }
.editor .more summary::before { content: "▸"; font-size: 10px; color: var(--faint); display: inline-block; transition: transform .42s cubic-bezier(.32, .72, 0, 1); }
.editor .more[open]:not(.closing) summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { .editor .more summary::before { transition: none; } }
.editor .more summary:hover { color: var(--fg); }
/* its labels are longer (Anthropic 地址, Responses-URL): their column takes
the longest, on one line, rather than wrap a last 址 under it (#875) */
@@ -3383,6 +3384,9 @@ html.theming, html.theming *, html.theming *::before, html.theming *::after {
}
/* opening and closing are animated from app.js (openModal, closeModal) */
.modal.out { pointer-events: none; }
/* open, it holds its place from a top app.js gives it (holdModal) */
.modal.held { align-items: flex-start; }
.modal .dialog { position: relative; }
.modal .dialog {
width: min(600px, 100%); min-width: 0; max-height: 100%; overflow-y: auto;
border-radius: 14px; background: var(--card);
+239 -43
View File
@@ -67,6 +67,9 @@ let pick = null; // { agent, field, options, items, cursor, anchor }
let editing = null; // provider id being edited; { preset } or { custom: true } for a new one
let draft = null; // the editor's working copy
let naming = null; // the provider whose models' names and levels are open in its editor
let advanced = null; // { of, open }: the editor's Advanced as it was opened or closed by hand, kept by
// what the editor edits (editing), not its draft: a move to the plugin or a
// refresh made under it starts a new draft, and the fold stays as left
let adding = false; // the preset sheet is open
// the partners counted as shown since the sheet opened: once an opening,
// however often it is drawn (countPartner)
@@ -7621,8 +7624,87 @@ function priceRateOfDraft() {
if (!(n >= 0 && n <= 1000) || Math.abs(n * 1000 - Math.round(n * 1000)) > 1e-6) return undefined;
return n;
}
// shown opens every fold x sits in (the editor's Advanced), so a field a
// Save names is there to see and type in; it gives x back
function shown(x) {
for (let d = x?.closest("details"); d; d = d.parentElement?.closest("details")) d.open = true;
return x;
}
// An editor's fold (Advanced, Server address, More endpoints) opens and
// closes as a disclosure does on iOS: its content grows out of the line
// on a spring, its rows coming in one after another, and the dialog round
// it grows or shrinks on the same curve — so the change shows even where
// the fold is taller than the dialog and goes on out of sight below. Its
// arrow turns. At once with Reduce motion, and for a fold a Save opens
// (shown). A click while it moves turns it back from where it is.
const foldMoves = new WeakMap();
document.addEventListener("click", (e) => {
const sum = e.target.closest?.(".editor details.more > summary");
const d = sum?.parentElement, inner = d?.querySelector(":scope > .inner");
if (!inner) return;
const was = foldMoves.get(d);
const closing = was ? !was.closing : d.open;
// told now, not at the toggle a task later: a redraw in between would
// read it as it was
d.onfold?.(!closing);
if (calm()) return;
e.preventDefault();
const box = d.closest(".modal .dialog");
// where it is now, partway included; a shut fold's content still
// measures its whole height
const from = was || closing ? inner.getBoundingClientRect().height : 0;
const boxFrom = box?.getBoundingClientRect().height;
const fade = was ? +getComputedStyle(inner).opacity : 1;
for (const x of was?.anims || []) x.cancel();
// and where it ends, measured as it will be
inner.style.overflow = "";
d.open = !closing;
const to = closing ? 0 : inner.getBoundingClientRect().height;
const boxTo = box?.getBoundingClientRect().height;
d.open = true;
d.classList.toggle("closing", closing);
inner.style.overflow = "hidden";
const shape = closing ? { duration: 420, easing: IOS_EASE } : { duration: 570, easing: SPRING };
const pad = getComputedStyle(inner).paddingTop;
const grow = inner.animate([
{ height: from + "px", paddingTop: from ? pad : "0px" },
{ height: to + "px", paddingTop: closing ? "0px" : pad },
], shape);
const anims = [grow];
if (box && Math.abs(boxTo - boxFrom) > 0.5) anims.push(box.animate([{ height: boxFrom + "px" }, { height: boxTo + "px" }], shape));
if (closing) anims.push(inner.animate([{ opacity: fade }, { opacity: 0, offset: 0.55 }, { opacity: 0 }], { duration: shape.duration, easing: "ease-out" }));
else {
if (fade < 1) anims.push(inner.animate([{ opacity: fade }, { opacity: 1 }], { duration: 200, easing: "ease-out" }));
// the rows come in from just above, one after another; those past
// the first dozen together
let i = 0;
for (const row of inner.children) {
if (row.style.display === "none" || row.hidden) continue;
anims.push(row.animate([{ opacity: 0, transform: "translateY(-6px)" }, { opacity: 1, transform: "none" }],
{ duration: 420, delay: 40 + Math.min(i++, 12) * 16, easing: IOS_EASE, fill: "backwards" }));
}
}
const move = { anims, closing };
foldMoves.set(d, move);
grow.finished.then(() => {
if (foldMoves.get(d) !== move) return;
foldMoves.delete(d);
inner.style.overflow = "";
d.classList.remove("closing");
if (closing) d.open = false;
}, () => {});
}, true); // before the editor, which keeps its clicks to itself
// advancedSet says whether a setting under the editor's Advanced is set,
// which opens it: none hides behind a fold
function advancedSet(d, p) {
return (d.headers || []).some(([k]) => (k || "").trim()) || !!(d.extraBody || "").trim() ||
!!d.proxyMode || Object.values(d.accountProxies || {}).some((x) => x?.mode) ||
[d.concurrency, d.queueLimit, d.queueWait, d.maxRPM, d.priceRate, d.contexts, d.outputs, d.compacts].some((v) => String(v ?? "").trim()) ||
!!(d.searches || d.authHeader || d.passUserAgent || d.unredacted || d.pinUpstream || d.nativeCompaction || d.balanceToken) ||
!!d.fallback?.length || !!p?.balanceToken?.set;
}
function priceRateError(ed) {
ed.querySelector("input.price-rate")?.focus({ preventScroll: true });
shown(ed.querySelector("input.price-rate"))?.focus({ preventScroll: true });
return editorError(t("Price rate: a number from 0 to 1000, at most three decimals"), "warn");
}
function concurrencyDraft(p) {
@@ -7645,10 +7727,10 @@ function queueOfDraft() {
}
function queueError(ed, bad) {
if (bad === "maxRPM") {
ed.querySelector("input.rpm")?.focus({ preventScroll: true });
shown(ed.querySelector("input.rpm"))?.focus({ preventScroll: true });
return editorError(t("Requests per minute: a whole number from 0 to 10000"), "warn");
}
ed.querySelector(bad === "queueLimit" ? "input.queue-limit" : "input.queue-wait")?.focus({ preventScroll: true });
shown(ed.querySelector(bad === "queueLimit" ? "input.queue-limit" : "input.queue-wait"))?.focus({ preventScroll: true });
return editorError(bad === "queueLimit" ? t("Queue size: a whole number from 0 to 10000") : t("Queue wait: a whole number of seconds from 0 to 3600"), "warn");
}
// concurrencyOfDraft is the draft's limit as it is saved — null for none
@@ -7660,7 +7742,7 @@ function concurrencyOfDraft() {
return +v;
}
function concurrencyError(ed) {
ed.querySelector("input.concurrency")?.focus({ preventScroll: true });
shown(ed.querySelector("input.concurrency"))?.focus({ preventScroll: true });
return editorError(t("Concurrency: a whole number from 0 to 1000"), "warn");
}
function proxyDraft(p) {
@@ -8158,6 +8240,89 @@ $("#modal").addEventListener("keydown", (e) => {
e.preventDefault();
(e.shiftKey ? last : first).focus();
});
// A dialog opens centred, then stays put while what it holds grows or
// shrinks (a fold opening, an error line, a list filling): it holds the
// place of whatever the reader last pressed or focused in it, and grows
// and shrinks round that, down to the window's foot, where it stays and
// its fields scroll as a full-height dialog's do. Where there is no
// room left to move, its fields shorten over a pressed button below them,
// so an error line over Remove doesn't push Remove down; a pressed field
// goes with what grows above it, as nothing a click does scrolls. Centred all along, a dialog
// shorter than the window moved by half of every change, the line just
// clicked sliding from under the pointer. Its place is a relative top and
// a cap on its height. A change made in the page is held before it is
// drawn (a mutation's microtask); one that only resizes (an animation, the
// window) a frame later, as an observer can't resize what it observes.
const modalHold = { off: 0, at: null, y: 0, cap: null, capSet: "" };
// how far down the dialog an element sits, to the fraction of a pixel,
// what moves it in an animation (a row coming in) left out. An element
// that scales (a Copy button's pop) is measured by what holds it, as its
// top moves round its middle by more than the matrix says.
function modalDepth(a, d) {
if (!a?.isConnected || !d.contains(a) || a === d || !a.offsetParent) return null;
if (getComputedStyle(d).transform === "none") {
const moves = [];
for (let x = a; x && x !== d; x = x.parentElement) {
const t = getComputedStyle(x).transform;
if (t === "none") continue;
const m = new DOMMatrixReadOnly(t);
if (m.m11 === 1 && m.m22 === 1 && !m.m12 && !m.m21) moves.push(m.m42);
else { a = x.parentElement; moves.length = 0; }
}
if (a === d) return null;
return moves.reduce((y, m) => y - m, a.getBoundingClientRect().top - d.getBoundingClientRect().top - d.clientTop);
}
// the dialog itself coming in: whole pixels, by offsets
let y = 0;
for (let x = a; x && x !== d; x = x.offsetParent) { if (!d.contains(x)) return null; y += x.offsetTop; }
for (let x = a.parentElement; x && x !== d; x = x.parentElement) y -= x.scrollTop;
return y;
}
function modalMark(a) {
const d = $("#modal").firstElementChild, y = modalDepth(a, d);
if (y == null) return;
// a new place to hold lets go of the last one's cap, at the next change
if (a !== modalHold.at) modalHold.cap = null;
modalHold.at = a; modalHold.y = y;
}
const modalCap = () => modalHold.cap == null ? `calc(100% - ${modalHold.off}px)` : `min(calc(100% - ${modalHold.off}px), ${modalHold.cap}px)`;
function holdModal(later) {
const m = $("#modal"), d = m.firstElementChild;
if (m.hidden || !m.classList.contains("held")) return;
// what was pressed, or failing that what has the focus (a redraw swaps
// the pressed element for its copy, and gives that copy the focus)
let y = modalDepth(modalHold.at, d);
if (y == null && d.contains(document.activeElement)) { modalHold.at = document.activeElement; y = modalDepth(modalHold.at, d); }
const want = modalHold.off + (y == null ? 0 : modalHold.y - y);
const c = getComputedStyle(m), h = d.getBoundingClientRect().height;
const space = m.clientHeight - parseFloat(c.paddingTop) - parseFloat(c.paddingBottom);
// grown to the window's foot it stays, capped there, its fields scrolling;
// it moves up only for a window grown too short to show half of it
modalHold.off = Math.max(0, Math.min(want, Math.max(space - h, modalHold.off), space / 2));
if (y != null && want < -0.5) {
// no room above: the fields over a button below them give way
const body = d.querySelector(".ebody");
if (body && !body.contains(modalHold.at)) modalHold.cap = Math.max(0, h + want);
}
d.style.top = modalHold.off + "px";
const cap = () => {
if (!m.classList.contains("held") || modalCap() === modalHold.capSet) return;
d.style.maxHeight = modalHold.capSet = modalCap();
};
if (later) requestAnimationFrame(cap);
else cap();
if (y != null) modalHold.y = modalDepth(modalHold.at, d) ?? y;
}
{
const m = $("#modal"), d = m.firstElementChild, later = () => holdModal(true);
new ResizeObserver(later).observe(d);
new ResizeObserver(later).observe(m);
new MutationObserver(() => holdModal()).observe(d, { childList: true, subtree: true, characterData: true, attributes: true, attributeFilter: ["class", "hidden", "open"] });
m.addEventListener("pointerdown", (e) => modalMark(e.target), true);
m.addEventListener("focusin", (e) => modalMark(e.target), true);
// a scroll moves the marked element, not the dialog
m.addEventListener("scroll", () => modalMark(modalHold.at), true);
}
function openModal(content) {
const m = $("#modal"), d = m.firstElementChild;
const fresh = m.hidden || m.classList.contains("out");
@@ -8195,6 +8360,16 @@ function openModal(content) {
if (body) body.scrollTop = top; // a re-render keeps the place
const nextNames = content.querySelector(".mnames:not([hidden])");
if (namesAt && nextNames?.dataset.provider === namesAt.provider) nextNames.scrollTop = namesAt.top;
if (fresh) {
m.classList.remove("held");
d.style.top = d.style.maxHeight = "";
modalHold.off = d.offsetTop - parseFloat(getComputedStyle(m).paddingTop);
modalHold.at = modalHold.cap = null;
m.classList.add("held");
d.style.top = modalHold.off + "px";
d.style.maxHeight = modalHold.capSet = modalCap();
}
holdModal();
if (!fresh) return;
for (const a of [...m.getAnimations(), ...d.getAnimations()]) a.cancel();
d.style.opacity = d.style.transform = m.style.opacity = "";
@@ -8241,6 +8416,8 @@ function closeModal() {
if (modalDone !== done) return;
modalDone = null;
m.hidden = true;
m.classList.remove("held");
d.style.top = d.style.maxHeight = "";
m.classList.remove("out");
d.replaceChildren();
modalFormBase = "";
@@ -8681,6 +8858,17 @@ function drawEditor(p, presetID) {
return field(t("Upstream"), ptk, t("Cline serves a model from any host its gateway picks; pinned, a request for a DeepSeek model goes only to DeepSeek, which keeps its prompt cache, and fails when DeepSeek can't take it"));
};
// the settings few need — headers, proxy, limits, windows, fallback —
// folded under Advanced, out of the way of the key and the models: open
// when one of them is set, or as it was left in this editor
const adv = el("details", "more advanced");
adv.open = advanced && advanced.of === editing ? advanced.open : advancedSet(draft, p);
const of = editing;
adv.onfold = (open) => { advanced = { of, open }; };
adv.append(el("summary", "", t("Advanced")));
const advIn = el("div", "inner");
adv.append(advIn);
if (p?.account) {
// the sign-in belongs to the agent; magpie only borrows it
const a = p.account;
@@ -8700,24 +8888,25 @@ function drawEditor(p, presetID) {
// a subscription's window too: Codex's backend says 272K for models
// that take 872K (#120)
const cx = input(draft.contexts || "", t("e.g. 128k · or gpt-6=1m, comma separated"));
ed.append(...field(t("Context window"), contextPicks(p, cx), t("How long a request the models take, told to the agents; empty leaves it to the vendor and models.dev")));
ed.append(...outputField());
ed.append(...compactField());
if (p.carriesCompaction) ed.append(...nativeCompactionField(() => true)[0]);
ed.append(...field(t("Fallback"), renderFallback(p), fallbackHint(p)));
advIn.append(...field(t("Context window"), contextPicks(p, cx), t("How long a request the models take, told to the agents; empty leaves it to the vendor and models.dev")));
advIn.append(...outputField());
advIn.append(...compactField());
if (p.carriesCompaction) advIn.append(...nativeCompactionField(() => true)[0]);
advIn.append(...field(t("Fallback"), renderFallback(p), fallbackHint(p)));
const proxies = el("div", "stack");
proxies.append(proxyPicker());
const perAccount = subOf(a.agent) ? accountProxyPicker(a) : null;
if (perAccount) proxies.append(perAccount);
ed.append(...field(t("Proxy"), proxies));
ed.append(...concurrencyField(p));
ed.append(...priceRateField());
if (p.cline) ed.append(...upstreamField());
advIn.append(...field(t("Proxy"), proxies));
advIn.append(...concurrencyField(p));
advIn.append(...priceRateField());
if (p.cline) advIn.append(...upstreamField());
ed.append(...pluginOptionsField(subOf(a.agent)));
// a plugin's provider is reached inside magpie: its plugin:// URLs go
// nowhere to show or test
const urls = [p.chat, p.responses, p.anthropic].filter(Boolean);
if (urls.length && !urls.some((u) => u.startsWith("plugin://"))) ed.append(...field(t("Endpoints"), renderEndpoints(p, p)));
ed.append(adv);
const bar = el("div", "bar");
// removing only hides it from magpie; the agent stays signed in
const del = el("button", "text danger", t("Remove"));
@@ -8729,17 +8918,17 @@ function drawEditor(p, presetID) {
const saveBtn = el("button", "text primary", t("Save"));
saveBtn.onclick = () => {
const cx = parseContexts(draft.contexts || "");
if (cx.error) return editorError(t("Context window: {v} is not a length like 128k or 1m", { v: cx.error }), "warn");
if (cx.error) { shown(ed.querySelector("input.contexts"))?.focus({ preventScroll: true }); return editorError(t("Context window: {v} is not a length like 128k or 1m", { v: cx.error }), "warn"); }
const ox = parseContexts(draft.outputs || "");
if (ox.error) return outputError(ed, ox.error);
const cpx = parseContexts(draft.compacts || "");
if (cpx.error) return compactError(ed, cpx.error);
const proxy = proxyOfDraft();
if (proxy === null) { ed.querySelector(".proxy-url")?.focus(); return editorError(t("Proxy: type its address, like http://127.0.0.1:7890"), "warn"); }
if (proxy === null) { shown(ed.querySelector(".proxy-url"))?.focus({ preventScroll: true }); return editorError(t("Proxy: type its address, like http://127.0.0.1:7890"), "warn"); }
const own = accountProxiesOfDraft();
if (own.missing) {
const line = [...ed.querySelectorAll(".acct-proxy")].find((x) => x.dataset.user.toLowerCase() === own.missing);
line?.querySelector(".proxy-url")?.focus({ preventScroll: true });
shown(line?.querySelector(".proxy-url"))?.focus({ preventScroll: true });
return editorError(t("Proxy of {user}: type its address, like http://127.0.0.1:7890", { user: line?.dataset.user || own.missing }), "warn");
}
const maxConcurrency = concurrencyOfDraft();
@@ -8897,21 +9086,21 @@ function drawEditor(p, presetID) {
// accounts returned above use the agent's own authentication headers.
if (custom) {
if (!draft.headers.length) draft.headers.push(["", ""]);
ed.append(...field(t("Headers"), headerEditor(), t("Extra HTTP headers sent to the vendor, applied after auth. For gateways that need a private scheme.")));
advIn.append(...field(t("Headers"), headerEditor(), t("Extra HTTP headers sent to the vendor, applied after auth. For gateways that need a private scheme.")));
} else {
ed.append(...field(t("Headers"), headerEditor(pr?.headerHints || []), t("Optional headers sent with every request to {p}, applied after auth.", { p: pr?.name || p?.name })));
advIn.append(...field(t("Headers"), headerEditor(pr?.headerHints || []), t("Optional headers sent with every request to {p}, applied after auth.", { p: pr?.name || p?.name })));
}
// and JSON fields of the user's own for each request's body (#1604)
ed.append(...field(t("Extra body"), extraBodyEditor(), t("JSON fields added to the body of every request to the vendor. A field the request has already is kept; write \"!name\" to replace it. ${sessionId} is the conversation's id.")));
advIn.append(...field(t("Extra body"), extraBodyEditor(), t("JSON fields added to the body of every request to the vendor. A field the request has already is kept; write \"!name\" to replace it. ${sessionId} is the conversation's id.")));
const proxies = el("div", "stack");
proxies.append(proxyPicker());
const perKey = keyProxyPicker(p);
if (perKey) proxies.append(perKey);
ed.append(...field(t("Proxy"), proxies));
ed.append(...concurrencyField(p));
ed.append(...priceRateField());
advIn.append(...field(t("Proxy"), proxies));
advIn.append(...concurrencyField(p));
advIn.append(...priceRateField());
if (p?.cline || (isNew && pr?.id === "clinepass")) ed.append(...upstreamField());
if (p?.cline || (isNew && pr?.id === "clinepass")) advIn.append(...upstreamField());
// a relay in front of Anthropic's or OpenAI's API searches the web as
// they do, which magpie can't tell from its host (#359): a client's web
@@ -8923,7 +9112,7 @@ function drawEditor(p, presetID) {
const row = field(t("Web search"), stk, t("For a relay in front of Anthropic's or OpenAI's own API: Claude Code's WebSearch and Codex's web_search go to it as they were sent, not through magpie's search. magpie doesn't automatically search with it for other models, but you can name it as the searcher."));
showSearch = () => { for (const e of row) e.style.display = searchable() ? "" : "none"; };
showSearch();
ed.append(...row);
advIn.append(...row);
}
// which header the key goes in on a third-party Anthropic API: both by
@@ -8946,7 +9135,7 @@ function drawEditor(p, presetID) {
const row = field(t("Key header"), seg, t("Which header the API key goes in on the Anthropic API. Most services take both; pick one for a service that refuses the two together. magpie also switches to one by itself when a service says so."));
showAuth = () => { for (const e of row) e.style.display = twoKeyHeaders() ? "" : "none"; };
showAuth();
ed.append(...row);
advIn.append(...row);
}
// a coding plan that serves only agents it names knows them by their
@@ -8958,7 +9147,7 @@ function drawEditor(p, presetID) {
if (uaPassable()) {
const [utk, ucb] = tick(t("Send the agent's own User-Agent"), !!draft.passUserAgent);
ucb.onchange = () => { draft.passUserAgent = ucb.checked; };
ed.append(...field(t("User-Agent"), utk, t("For a plan that serves only the coding agents it names: each request goes with the User-Agent the agent sent (pi, OpenCode, Claude Code…), not magpie's. Requests magpie makes itself, and ones the agent sent without one, still go as magpie. A User-Agent set in Headers above always wins.")));
advIn.append(...field(t("User-Agent"), utk, t("For a plan that serves only the coding agents it names: each request goes with the User-Agent the agent sent (pi, OpenCode, Claude Code…), not magpie's. Requests magpie makes itself, and ones the agent sent without one, still go as magpie. A User-Agent set in Headers above always wins.")));
}
// a model on this computer or the local network (Ollama, LM Studio, a
@@ -8973,7 +9162,7 @@ function drawEditor(p, presetID) {
const row = field(t("Redaction"), ltk, t("For a model running on this computer or your local network: secrets, personal data and your masked words go to it as written. Leave it off for a local relay or proxy that passes requests on to a vendor."));
showLocal = () => { for (const e of row) e.style.display = onLAN() ? "" : "none"; };
showLocal();
ed.append(...row);
advIn.append(...row);
}
// a provider the user added whose server has a certificate nothing
@@ -9022,7 +9211,7 @@ function drawEditor(p, presetID) {
// make it or unmake it
ed.addEventListener("input", () => balFix.refresh());
}
ed.append(label, wrap);
advIn.append(label, wrap);
}
// StepFun tells a Step Plan's 5-hour, weekly and credit windows only to
@@ -9138,16 +9327,16 @@ function drawEditor(p, presetID) {
// the window agents are told a model has, over what the vendor or
// models.dev says: one for all of them, and model=size for one
const cx = input(draft.contexts || "", t("e.g. 128k · or gpt-6=1m, comma separated"));
if (!decideOnly(p || pr)) ed.append(...field(t("Context window"), contextPicks(p, cx), t("How long a request the models take, told to the agents; empty leaves it to the vendor and models.dev")));
if (!decideOnly(p || pr)) ed.append(...outputField());
if (!decideOnly(p || pr)) advIn.append(...field(t("Context window"), contextPicks(p, cx), t("How long a request the models take, told to the agents; empty leaves it to the vendor and models.dev")));
if (!decideOnly(p || pr)) advIn.append(...outputField());
if (!decideOnly(p || pr)) {
ed.append(...compactField());
advIn.append(...compactField());
const [row, refresh] = nativeCompactionField(carriesCompaction);
ed.append(...row);
advIn.append(...row);
showCompaction = refresh;
}
}
if (p && !decideOnly(p)) ed.append(...field(t("Fallback"), renderFallback(p), fallbackHint(p)));
if (p && !decideOnly(p)) advIn.append(...field(t("Fallback"), renderFallback(p), fallbackHint(p)));
else if (custom) {
const ex = input(draft.extra.join(", "), t("model ids, comma separated · e.g. gpt-5.5, claude-sonnet-5"));
const pick = addFormModels(ex);
@@ -9202,6 +9391,7 @@ function drawEditor(p, presetID) {
refreshEndpoints();
ed.append(...row);
}
ed.append(adv);
if (custom) {
const more = el("details", "more");
@@ -9307,7 +9497,7 @@ function drawEditor(p, presetID) {
const body = { id: p ? slug(draft.id) || p.id : draft.id, from: p?.id, name: draft.name, preset: draft.preset, key: draft.key || "", chat: draft.chat, responses: draft.responses, anthropic: draft.anthropic, gemini: (draft.gemini || "").trim(), catalog: draft.catalog, models: p ? chosenIds() : draft.extra, headers: headersOf(draft.headers), new: isNew };
if (isNew && draft.copyOf) body.copyOf = draft.copyOf;
const xb = extraBodyOf(draft.extraBody);
if (xb.error) { ed.querySelector(".extra-body textarea")?.focus({ preventScroll: true }); return editorError(t("Extra body: {why}", { why: xb.error }), "warn"); }
if (xb.error) { shown(ed.querySelector(".extra-body textarea"))?.focus({ preventScroll: true }); return editorError(t("Extra body: {why}", { why: xb.error }), "warn"); }
body.extraBody = xb.value;
if (decides || custom) body.decide = (custom && draft.api !== "decide" && !p?.decide ? "" : draft.decide || "").trim();
if ((body.decide || "").includes(WORKSPACE)) { ed.querySelector(".workspace-id")?.focus({ preventScroll: true }); return editorError(t("Give the workspace ID your API key belongs to, or pick the Token Plan"), "warn"); }
@@ -9330,7 +9520,7 @@ function drawEditor(p, presetID) {
if (!decideOnly(p || pr)) body.nativeCompaction = !!draft.nativeCompaction && carriesCompaction();
body.passUserAgent = !!draft.passUserAgent && uaPassable();
const cx = parseContexts(draft.contexts || "");
if (cx.error) return editorError(t("Context window: {v} is not a length like 128k or 1m", { v: cx.error }), "warn");
if (cx.error) { shown(ed.querySelector("input.contexts"))?.focus({ preventScroll: true }); return editorError(t("Context window: {v} is not a length like 128k or 1m", { v: cx.error }), "warn"); }
body.contexts = cx.map;
if (!decideOnly(p || pr)) {
const ox = parseContexts(draft.outputs || "");
@@ -9341,12 +9531,12 @@ function drawEditor(p, presetID) {
body.compacts = cpx.map;
}
body.proxy = proxyOfDraft();
if (body.proxy === null) { ed.querySelector(".proxy-url")?.focus(); return editorError(t("Proxy: type its address, like http://127.0.0.1:7890"), "warn"); }
if (body.proxy === null) { shown(ed.querySelector(".proxy-url"))?.focus({ preventScroll: true }); return editorError(t("Proxy: type its address, like http://127.0.0.1:7890"), "warn"); }
if (perKey) {
const own = accountProxiesOfDraft();
if (own.missing) {
const line = ed.querySelector(`.acct-proxy[data-key="${own.missing}"]`);
line?.querySelector(".proxy-url")?.focus({ preventScroll: true });
shown(line?.querySelector(".proxy-url"))?.focus({ preventScroll: true });
return editorError(t("Proxy of {user}: type its address, like http://127.0.0.1:7890", { user: line?.querySelector(".who")?.textContent || own.missing }), "warn");
}
body.accountProxies = own.map;
@@ -9411,6 +9601,7 @@ function contextsText(cx) {
// GPT-6: 272K said, 872K taken), their own most: sizes nobody remembers
// (#120). The pick matching what is typed is lit.
function contextPicks(p, cx) {
cx.classList.add("contexts");
const size = (n) => contextsText({ "*": n });
const picks = [128e3, 200e3, 256e3, 400e3, 512e3, 1e6].map((n) => ({ label: size(n).toUpperCase(), value: size(n) }));
// above the window its vendor says, not the one set here: a model set to
@@ -9523,12 +9714,12 @@ function compactField() {
}
function compactError(ed, v) {
ed.querySelector("input.compacts")?.focus({ preventScroll: true });
shown(ed.querySelector("input.compacts"))?.focus({ preventScroll: true });
return editorError(t("Compact at: {v} is not a number of tokens like 272k", { v }), "warn");
}
function outputError(ed, v) {
ed.querySelector("input.outputs")?.focus({ preventScroll: true });
shown(ed.querySelector("input.outputs"))?.focus({ preventScroll: true });
return editorError(t("Max output: {v} is not a number of tokens like 32k", { v }), "warn");
}
@@ -10534,11 +10725,15 @@ function renderModels(p) {
// saved on its own, every one rewriting the agents' files, so picking a
// model's levels lagged a click behind (ARNO on Discord).
const drawNames = () => {
// drawn again, the list stays where it was scrolled to
const top = names.scrollTop;
// drawn again, the list stays where it was scrolled to, and as tall
// while its rows go back in: a row measured on the way (its API's
// slider) lays the editor out with the list empty, and WebKit pulls
// the editor's scroll up to fit, the button just clicked moving away
const top = names.scrollTop, tall = names.offsetHeight;
names.replaceChildren();
names.hidden = naming !== p.id;
if (names.hidden) return;
names.style.minHeight = tall + "px";
// its own quiet title and a Fold where it opened (Hu9956, #868: the
// only way to close it was the button under the list, out of sight
// once it was open, and the editor read as one long run of settings)
@@ -10861,6 +11056,7 @@ function renderModels(p) {
drawReset();
names.append(row);
}
names.style.minHeight = "";
names.scrollTop = top;
};
// what the provider serves, said in so many words (#1831, kchen0x: with
@@ -12794,8 +12990,8 @@ function balanceFix(p) {
const field = ed?.querySelector(".bal-path");
if (bal) bal.value = draft.balanceURL;
if (field) { field.value = draft.balancePath; field.placeholder = balanceFieldOf(draft.balanceURL); }
const more = ed?.querySelector("details.more");
if (more) more.open = true;
// the Balance URL's own fold, not the first one in the editor
if (bal) shown(bal);
box.refresh();
};
box.append(use);
+4
View File
@@ -2034,6 +2034,7 @@ const I18N = {
"Endpoint": "终结点",
"Your resource's endpoint is needed": "需要填写你的资源终结点",
"Server address": "服务器地址",
"Advanced": "高级",
"Where the server listens; change the port, or give another computer's address": "服务监听的地址;可改端口,或填另一台电脑的地址",
"Address: {v} isn't an address like http://localhost:11434": "地址:{v} 不是形如 http://localhost:11434 的地址",
"your resource's endpoint and key": "你的资源终结点和密钥",
@@ -5679,6 +5680,7 @@ const I18N = {
"Endpoint": "端點",
"Your resource's endpoint is needed": "需要填寫你的資源端點",
"Server address": "伺服器位址",
"Advanced": "進階",
"Where the server listens; change the port, or give another computer's address": "伺服器監聽的位址;可改連接埠,或填另一臺電腦的位址",
"Address: {v} isn't an address like http://localhost:11434": "位址:{v} 不是 http://localhost:11434 這樣的位址",
"your resource's endpoint and key": "你的資源端點和金鑰",
@@ -9303,6 +9305,7 @@ const I18N = {
"Endpoint": "エンドポイント",
"Your resource's endpoint is needed": "リソースのエンドポイントが必要です",
"Server address": "サーバーアドレス",
"Advanced": "詳細設定",
"Where the server listens; change the port, or give another computer's address": "サーバーが待ち受けるアドレスです。ポートを変えるか、別のコンピューターのアドレスを入力します",
"Address: {v} isn't an address like http://localhost:11434": "アドレス:{v} は http://localhost:11434 のようなアドレスではありません",
"your resource's endpoint and key": "リソースのエンドポイントとキー",
@@ -12957,6 +12960,7 @@ const I18N = {
"Endpoint": "Endpunkt",
"Your resource's endpoint is needed": "Der Endpunkt Ihrer Ressource ist erforderlich",
"Server address": "Serveradresse",
"Advanced": "Erweitert",
"Where the server listens; change the port, or give another computer's address": "Wo der Server lauscht; ändern Sie den Port oder geben Sie die Adresse eines anderen Computers an",
"Address: {v} isn't an address like http://localhost:11434": "Adresse: {v} ist keine Adresse wie http://localhost:11434",
"your resource's endpoint and key": "Endpunkt und Schlüssel Ihrer Ressource",
+2 -2
View File
@@ -15,8 +15,8 @@ import (
// so a page can't quietly grow back into the core; a change that needs more
// raises them and says why in its commit.
const (
appScriptBudget = 1_235_000 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core
coreScriptBudget = 1_397_000 // every core script: 1,358,034 after Usage left; 1,380,003 with them
appScriptBudget = 1_250_000 // app.js: 1,198,239 after Usage left (P2); 1,218,098 with the 10-15 fixes to pages still in the core; 1,232,466 with the provider editor's Advanced fold and every dialog holding its place, the core's own (10-16)
coreScriptBudget = 1_426_000 // every core script: 1,358,034 after Usage left; 1,380,003 with them; 1,405,937 with the fold
)
func TestCoreScriptBudget(t *testing.T) {
@@ -101,6 +101,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).first().click();
// Proxy is under Advanced, open already when one is set
{ const adv = page.locator(".editor details.advanced"); await adv.waitFor({ state: "attached" }); if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click(); }
await page.locator(wait).first().waitFor();
return { page, errors, posts };
};
+7 -3
View File
@@ -78,7 +78,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await page.locator(".editor .bal-url").inputValue(), "https://relay.example.com/api/user/self");
assert.equal(await page.locator(".editor .bal-path").inputValue(), "$data.quota / 500000", "usage/token's field gives way to the quota");
assert(await page.locator(".editor details.more").evaluate((d) => d.open), "what changed is in view");
assert(await page.locator(".editor .bal-url").isVisible(), "what changed is in view");
assert(!(await fix.evaluate((e) => e.classList.contains("warn"))));
assert.match(await fix.textContent(), /New-Api-User = your user ID/, "the header /api/user/self wants is asked for");
@@ -171,6 +171,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.locator(".editor input[type=url]").first().fill("https://relay.example.com/v1");
const fix = page.locator(".editor .bal-fix");
assert.equal(await fix.textContent(), "", "no token, no hint");
// the account's token is under Advanced
await page.locator(".editor details.advanced > summary").click();
await tok.fill("access-token");
assert.match(await fix.textContent(), /The token needs a Balance URL/);
await fix.getByRole("button", { name: "Use https://relay.example.com/api/user/self" }).click();
@@ -242,6 +244,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.getByPlaceholder(namePlaceholder, { exact: true }).fill("Sub2API");
await page.locator(".editor input[type=url]").first().fill("https://relay.example.com/v1");
assert.equal(await page.locator(".editor .bal-fix").textContent(), "", "no token, no warning");
// the account's token is under Advanced
await page.locator(".editor details.advanced > summary").click();
await page.locator(".editor input[type=password]").nth(1).fill("eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiIxIn0.c2ln");
} else {
await page.locator(".row.provider", { hasText: "Relay" }).click();
@@ -272,7 +276,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await use.click();
assert.equal(await page.locator(".editor .bal-url").inputValue(), to);
assert.equal(await page.locator(".editor .bal-path").inputValue(), "$data.balance");
assert(await page.locator(".editor details.more").evaluate((d) => d.open));
assert(await page.locator(".editor .bal-url").isVisible(), "what changed is in view");
assert.equal(await fix.textContent(), "", "the warning clears without asking for New-Api-User");
assert.equal(posted.length, 0, "the shortcut changes only the draft");
@@ -315,7 +319,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(posted));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: "Relay" }).click();
await page.locator(".editor details.more summary").click();
await page.locator(".editor details.more:not(.advanced) > summary").click();
await page.locator(".editor .bal-path").fill(typed);
const to = "https://relay.example.com" + endpoint;
await page.locator(".editor .bal-fix").getByRole("button", { name: "Use " + to, exact: true }).click();
+1 -1
View File
@@ -61,7 +61,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", server(posted, lang, saved ? { ...relay, balanceMethod: saved } : relay));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: "Relay" }).click();
await page.locator(".editor details.more summary").click();
await page.locator(".editor details.more:not(.advanced) > summary").click();
const method = page.locator(".editor .bal-method");
await method.waitFor();
+1 -1
View File
@@ -62,7 +62,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.locator(".row.provider", { has: page.locator(".name", { hasText: /^002$/ }) }).click();
const ed = page.locator(".editor");
await ed.waitFor();
const more = ed.locator("details.more");
const more = ed.locator("details.more:not(.advanced)");
await more.locator("summary", { hasText: w.more }).click();
const hint = more.locator(".hint", { hasText: w.prices });
assert.equal(await hint.count(), 1, "one hint names list prices");
+4 -1
View File
@@ -77,6 +77,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
if (lang === "zh") w.tick = zh[0];
await page.locator(".row.provider", { hasText: "ClinePass" }).click();
// Upstream is under Advanced
{ const adv = page.locator(".editor details.advanced"); await adv.waitFor({ state: "attached" }); if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click(); }
const tick = page.locator(".editor label.pin-upstream");
await tick.waitFor();
assert.equal((await tick.textContent()).trim(), w.tick);
@@ -106,7 +108,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(posts.at(-1).body.pinUpstream, false);
await page.locator(".row.provider", { hasText: "Relay" }).click();
await page.locator(".editor input.price-rate").waitFor();
// Relay sets nothing under Advanced, so its editor opens folded
await page.locator(".editor details.advanced:not([open]) input.price-rate").waitFor({ state: "attached" });
assert.equal(await page.locator(".editor label.pin-upstream").count(), 0, "only a Cline provider has it");
assert.deepEqual(errors, []);
});
@@ -54,6 +54,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider").click();
// the Context window is under Advanced
{ const adv = page.locator(".editor details.advanced"); await adv.waitFor({ state: "attached" }); if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click(); }
const picks = page.locator(".cxpicks").first();
assert.deepEqual(await picks.locator(".cxpick").allTextContents(), ["128K", "200K", "256K", "400K", "512K", "1M"]);
@@ -46,6 +46,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: "Acme" }).first().click();
// Fallback is under Advanced
{ const adv = page.locator(".editor details.advanced"); await adv.waitFor({ state: "attached" }); if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click(); }
const box = page.locator(".editor .fallback");
await box.locator("input").focus();
const chips = box.locator(".mchips .mchip");
+6
View File
@@ -116,6 +116,11 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.ok(!text.includes(pkg), "names the npm package in the sentence");
assert.ok(text.includes(w.own), "doesn't say Zed stays signed in");
// the reader opened Advanced (so the editor runs on past the field)
// and scrolled to the field: nothing the move does moves it, and the
// fold stays as they left it though the move starts a new draft
await ed.locator("details.advanced > summary").click();
assert.equal(await ed.locator("details.advanced").evaluate((d) => d.open), true);
// the reader scrolled to the field: nothing the move does moves it.
// A wheel, as a reader's scroll (a script's scrollTop is put back), and
// only so far that the button stays in sight: a click on a button out
@@ -161,6 +166,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.ok((await ed.innerText()).includes(w.own), "the moved Zed no longer says Zed stays signed in");
assert.equal(await why.count() && await why.isVisible(), false, "the failure is still said");
assert.equal(await body.evaluate((e) => e.scrollTop), top, "the move moved the editor");
assert.equal(await ed.locator("details.advanced").evaluate((d) => d.open), true, "the move shut Advanced");
assert.ok((await page.locator("#status").innerText()).startsWith(w.done), "no toast saying what moved");
assert.deepEqual(posts.map((p) => [p.path, p.body.id]), [["/api/provider/move", "zed"], ["/api/provider/move", "zed"]]);
// its plugin:// URLs are magpie's own: no Endpoints, no Test
@@ -0,0 +1,174 @@
// Run with Node's test runner and Playwright on the module path; see README.md.
// The provider editor folds what few need under Advanced (the owner: "Provider
// 表单太复杂了"): headers, proxy, limits, windows and fallback sit in a closed
// fold on a provider with none of them set, beside its key and models in
// view. One set opens it; opened or closed by hand it stays so across the
// editor's redraws; and a Save that refuses a field inside opens it on that
// field. A signed-in account folds the same. It opens and closes growing
// and shrinking, the dialog round it on the same curve (the owner: "整个弹窗
// 高度的改变也应该是丝滑的动画"), its arrow turning, and at once with Reduce
// motion. In
// every language, in a window 420px wide.
const assert = require("node:assert/strict");
const fs = require("node:fs/promises");
const path = require("node:path");
const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
const base = {
icon: "generic", responses: "", anthropic: "", catalog: "",
models: [{ id: "model-a", name: "Model A", on: true }], agents: [], fallback: [], headers: {},
key: { set: true, masked: "sk-…one" }, keyList: [], balanceToken: { takes: false, set: false }, proxy: "", maxConcurrency: null,
};
const plain = { ...base, id: "plain", name: "Plain", chat: "https://plain.example.com/v1" };
const proxied = { ...base, id: "proxied", name: "Proxied", chat: "https://proxied.example.com/v1", proxy: "http://127.0.0.1:7890" };
const codex = {
...base, id: "codex", name: "Codex", icon: "codex-color", chat: "", key: undefined,
models: [{ id: "gpt-6", name: "GPT-6", on: true }],
account: { agent: "codex", agentName: "Codex", user: "me@example.com", plan: "PLUS", logins: [{ user: "me@example.com", plan: "PLUS", active: true, on: true }] },
};
function serve(lang, posts) {
const providers = { providers: [plain, proxied, codex], presets: [], excluded: [], gateway: { running: true, window: true } };
const state = { agents: [], profiles: [], settings: { lang, theme: "light" } };
return async (route) => {
const url = new URL(route.request().url());
const json = (data) => route.fulfill({ json: data });
if (url.pathname === "/boot.js") return route.fulfill({ contentType: "text/javascript", body: `window.bootPrefs = {lang:"${lang}",theme:"light",web:true};` });
if (url.pathname === "/wails/runtime.js") return route.fulfill({ contentType: "text/javascript", body: "export const Window = {};" });
if (url.pathname === "/api/state") return json(state);
if (url.pathname === "/api/providers") return json(providers);
if (url.pathname === "/api/groups") return json({ groups: [] });
if (url.pathname.startsWith("/api/provider/") && route.request().method() === "POST") {
posts.push({ action: url.pathname.slice("/api/provider/".length), body: route.request().postDataJSON() });
return json(providers);
}
if (url.pathname.startsWith("/api/")) return json({});
const file = path.join(assets, url.pathname === "/" ? "index.html" : url.pathname);
const contentType = { ".html": "text/html", ".js": "text/javascript", ".css": "text/css", ".svg": "image/svg+xml", ".png": "image/png" }[path.extname(file)];
await route.fulfill({ body: await fs.readFile(file), contentType });
};
}
for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
const open = async (t, name, motion) => {
const browser = await (engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" }));
t.after(() => browser.close());
const page = await (await browser.newContext({ viewport: { width: 420, height: motion ? 1600 : 760 }, reducedMotion: motion ? "no-preference" : "reduce" })).newPage();
page.setDefaultTimeout(5000);
const errors = [];
page.on("pageerror", (e) => errors.push(e.message));
const posts = [];
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await page.locator(".editor details.advanced").waitFor({ state: "attached" });
await page.waitForTimeout(300);
const words = await page.evaluate((l) => ({ advanced: l === "en" ? "Advanced" : I18N[l]["Advanced"], save: l === "en" ? "Save" : I18N[l]["Save"] }), lang);
assert(words.advanced && words.save, "every string has its translation");
return { page, errors, posts, words };
};
const fold = (page) => page.locator(".editor details.advanced");
const isOpen = (page) => fold(page).evaluate((d) => d.open);
test(`${engine} ${lang}: a provider with nothing advanced set opens with Advanced folded`, async (t) => {
const { page, errors, words } = await open(t, "Plain");
assert.equal(await isOpen(page), false);
assert.equal(await fold(page).locator(":scope > summary").textContent(), words.advanced);
assert(await page.locator(".editor .mchips, .editor .models").first().isVisible(), "the models stay in view");
for (const sel of ["input.price-rate", "input.concurrency", ".proxy-url, .seg", "input.outputs"]) {
assert.equal(await fold(page).locator(sel).count() > 0, true, `${sel} is under Advanced`);
}
assert.equal(await page.locator(".editor input.price-rate").isVisible(), false, "folded away");
assert.equal(await page.evaluate(() => document.documentElement.scrollWidth <= innerWidth), true, "nothing runs off the side");
await fold(page).locator(":scope > summary").click();
assert.equal(await isOpen(page), true);
assert(await page.locator(".editor input.price-rate").isVisible());
// a redraw (a model ticked, the list fetched) keeps it as it was left
await page.evaluate(() => renderProviders());
assert.equal(await isOpen(page), true, "opened by hand stays open");
await fold(page).locator(":scope > summary").click();
await page.evaluate(() => renderProviders());
assert.equal(await isOpen(page), false, "closed by hand stays closed");
assert.deepEqual(errors, []);
});
test(`${engine} ${lang}: a provider with a proxy set opens with Advanced open`, async (t) => {
const { page, errors } = await open(t, "Proxied");
assert.equal(await isOpen(page), true);
assert.equal(await page.locator(".editor .proxy-url").first().inputValue(), "http://127.0.0.1:7890");
assert.deepEqual(errors, []);
});
test(`${engine} ${lang}: a Save refused on a folded field opens Advanced on it`, async (t) => {
const { page, errors, posts, words } = await open(t, "Plain");
await fold(page).locator(":scope > summary").click();
await page.locator(".editor input.price-rate").fill("1001");
await fold(page).locator(":scope > summary").click();
assert.equal(await isOpen(page), false);
await page.locator(".editor .bar").getByRole("button", { name: words.save, exact: true }).click();
await page.locator(".editor .editor-error").waitFor();
assert.equal(await isOpen(page), true, "opened on the field it names");
assert.equal(await page.evaluate(() => document.activeElement?.matches("input.price-rate")), true, "and the field has the focus");
assert.equal(posts.length, 0);
// the context window, which no helper of its own focused before
await page.locator(".editor input.price-rate").fill("");
await page.locator(".editor input.contexts").fill("lots");
await fold(page).locator(":scope > summary").click();
await page.locator(".editor .bar").getByRole("button", { name: words.save, exact: true }).click();
await page.waitForFunction(() => document.querySelector(".editor details.advanced").open);
assert.equal(await page.evaluate(() => document.activeElement?.matches("input.contexts")), true);
assert.equal(posts.length, 0);
assert.deepEqual(errors, []);
});
test(`${engine} ${lang}: Advanced grows open and shrinks shut, its arrow turning`, async (t) => {
const { page, errors } = await open(t, "Plain", true);
const inner = fold(page).locator(":scope > .inner");
const arrow = () => fold(page).locator(":scope > summary").evaluate((s) => getComputedStyle(s, "::before").transform);
const y = await page.evaluate(() => scrollY);
await fold(page).locator(":scope > summary").click();
assert.equal(await isOpen(page), true, "open from the click on");
const boxMoves = () => page.evaluate(() => document.querySelector(".modal .dialog").getAnimations().length > 0);
// a window tall enough that the dialog isn't already as tall as it goes
assert(await boxMoves(), "the dialog grows with it");
assert(await inner.evaluate((x) => [...x.children].some((r) => r.getAnimations().length)), "its rows come in");
const mid = await inner.evaluate((x) => x.getBoundingClientRect().height);
await page.waitForFunction(() => !document.querySelector(".editor details.advanced > .inner").getAnimations().length);
const full = await inner.evaluate((x) => x.getBoundingClientRect().height);
assert(mid < full, `it grows (${mid} then ${full})`);
await page.waitForFunction(() => !document.getAnimations().length);
assert.equal(await arrow(), "matrix(0, 1, -1, 0, 0, 0)", "the arrow turned");
assert.equal(await page.evaluate(() => scrollY), y, "the click moves no page");
await fold(page).locator(":scope > summary").click();
assert.equal(await isOpen(page), true, "shown while it shrinks");
assert(await inner.evaluate((x) => x.getAnimations().length) > 0, "it shrinks");
assert(await boxMoves(), "and the dialog with it");
await page.waitForFunction(() => !document.querySelector(".editor details.advanced").open);
await page.waitForFunction(() => !document.getAnimations().length);
assert.equal(await arrow(), "none", "the arrow turned back");
// clicked again while it shrinks, it turns back and stays open
await fold(page).locator(":scope > summary").click();
await page.waitForTimeout(80);
await fold(page).locator(":scope > summary").click();
await fold(page).locator(":scope > summary").click();
await page.waitForFunction(() => !document.querySelector(".editor details.advanced > .inner").getAnimations().length);
assert.equal(await isOpen(page), true);
assert.equal(await page.evaluate(() => advanced.open), true, "kept as it ends");
assert.deepEqual(errors, []);
});
test(`${engine} ${lang}: a signed-in account folds the same`, async (t) => {
const { page, errors } = await open(t, "Codex");
assert.equal(await isOpen(page), false);
assert.equal(await fold(page).locator("input.price-rate").count(), 1);
assert.equal(await fold(page).locator("input.contexts").count(), 1);
assert.deepEqual(errors, []);
});
}
}
@@ -13,6 +13,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const relay = {
id: "relay", name: "Relay", icon: "generic", chat: "", responses: "", anthropic: "https://relay.example.com", catalog: "",
models: [{ id: "claude-haiku-4-5", name: "Claude Haiku 4.5", on: true }], agents: [], fallback: [], headers: {},
@@ -80,6 +87,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).first().click();
await unfold(page);
await page.locator(".editor .bar").waitFor();
return { page, errors, posts };
};
@@ -143,6 +151,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal("authHeader" in saved.body, false);
await page.locator(".editor .bar").getByRole("button", { name: lang === "zh" ? "取消" : "Cancel", exact: true }).click().catch(() => {});
await page.locator(".row.provider", { hasText: "Codex" }).first().click();
await unfold(page);
await page.locator(".editor .bar").waitFor();
assert.equal(await seg(page).count(), 0);
assert.deepEqual(errors, []);
@@ -12,6 +12,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const relay = {
id: "relay", name: "Relay", icon: "generic", chat: "https://relay.example.com/v1", responses: "", anthropic: "", catalog: "",
models: [{ id: "model-a", name: "Model A", on: true }], agents: [], fallback: [], headers: {},
@@ -77,6 +84,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor input.concurrency").waitFor();
await page.waitForTimeout(300); // the editor drawn again as what it asked for comes in
return { page, errors, posts };
@@ -123,6 +131,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// emptied again: none set
await page.locator(".row.provider", { hasText: "Relay" }).click();
await unfold(page);
await box(page).fill("");
saved = await save(page, posts);
assert(Object.hasOwn(saved.body, "maxConcurrency"), "an empty field is saved as none, not left out");
@@ -180,6 +189,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
let saved = await save(page, posts);
assert.equal(saved.body.maxConcurrency, null, "empty follows the plugin");
await page.locator(".row.provider", { hasText: "Lemon" }).click();
await unfold(page);
await box(page).fill("8");
saved = await save(page, posts);
assert.equal(saved.body.maxConcurrency, 8);
@@ -99,7 +99,10 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
const y = await page.evaluate(() => [scrollY, ...[...document.querySelectorAll("*")].filter((e) => e.scrollTop).map((e) => e.scrollTop)].join());
await loc.click();
await page.waitForTimeout(250);
assert.equal(await loc.evaluate((e) => e.getBoundingClientRect().top), before, what + " moved");
// to half a pixel: a dialog that starts to scroll under a hint
// lays its rows out again, WebKit's to a fraction of a pixel
const after = await loc.evaluate((e) => e.getBoundingClientRect().top);
assert(Math.abs(after - before) < 0.5, `${what} moved ${before} to ${after}`);
assert.equal(await page.evaluate(() => [scrollY, ...[...document.querySelectorAll("*")].filter((e) => e.scrollTop).map((e) => e.scrollTop)].join()), y, what + " scrolled the page");
};
const inPlace = async (kind, text, what) => {
+3 -3
View File
@@ -118,14 +118,14 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(await on(), S.gemini);
assert.equal(await ed.locator(".base-url").inputValue(), "", "the saved chat URL stays chat's");
assert.equal(await detect.isVisible(), true);
await ed.locator("details.more > summary").click();
const labels = await ed.locator("details.more label").allTextContents();
await ed.locator("details.more:not(.advanced) > summary").click();
const labels = await ed.locator("details.more:not(.advanced) label").allTextContents();
assert(!labels.includes(S.more), "the Base URL's API is not under More endpoints: " + labels);
await ed.locator(".base-url").fill(G);
// back on OpenAI compatible, the Gemini URL is one of More endpoints
await ed.locator('.segs .opt[data-api="openai"]').click();
assert((await ed.locator("details.more label").allTextContents()).includes(S.more));
assert((await ed.locator("details.more:not(.advanced) label").allTextContents()).includes(S.more));
await ed.locator('.segs .opt[data-api="gemini"]').click();
assert.equal(await ed.locator(".base-url").inputValue(), G);
@@ -12,6 +12,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const base = {
icon: "generic", chat: "", responses: "", anthropic: "", catalog: "",
models: [{ id: "m1", name: "M1", on: true }], agents: [], fallback: [], headers: {},
@@ -83,6 +90,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor .bar").waitFor();
return { page, errors, posts };
};
@@ -12,6 +12,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
function serve(lang, posts) {
const state = { agents: [], profiles: [], settings: { lang, theme: "light" } };
@@ -49,6 +56,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.goto("http://magpie.test/?view=providers");
const zh = lang === "zh";
await page.locator(".row.provider").click();
await unfold(page);
const box = page.locator("input.outputs");
await box.waitFor();
const picks = box.locator("xpath=following-sibling::div[contains(@class,'cxpicks')]").locator(".cxpick");
@@ -66,7 +74,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await picks.nth(4).click();
// More endpoints: each label on one line
await page.locator(".editor .more summary").click();
await page.locator(".editor .more:not(.advanced) > summary").click();
for (const name of zh ? ["Anthropic 地址", "Responses 地址"] : ["Anthropic URL", "Responses URL"]) {
const l = page.locator(".editor .more .inner label", { hasText: name });
await l.waitFor();
@@ -11,6 +11,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const relay = {
id: "relay", name: "Relay", icon: "generic", chat: "https://relay.example.com/v1", responses: "", anthropic: "", catalog: "",
models: [{ id: "model-a", name: "Model A", on: true }], agents: [], fallback: [], headers: {},
@@ -64,6 +71,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor input.price-rate").waitFor();
await page.waitForTimeout(300);
return { page, errors, posts };
@@ -104,6 +112,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(saved.body.priceRate, 0.85);
await page.locator(".row.provider", { hasText: "Relay" }).click();
await unfold(page);
await box(page).fill("");
saved = await save(page, posts);
assert(Object.hasOwn(saved.body, "priceRate"), "an empty field is saved as none, not left out");
@@ -12,6 +12,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const relay = {
id: "relay", name: "Relay", icon: "generic", chat: "https://relay.example.com/v1", responses: "", anthropic: "", catalog: "",
models: [{ id: "model-a", name: "Model A", on: true }], agents: [], fallback: [], headers: {},
@@ -71,6 +78,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor .proxy-mode").waitFor();
return { page, errors, posts };
};
@@ -116,11 +124,13 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// Direct, then the global one again
await page.locator(".row.provider", { hasText: "Relay" }).click();
await unfold(page);
await pick(page, w.direct);
assert(await addr(page).isHidden());
saved = await save(page, posts);
assert.equal(saved.body.proxy, "direct");
await page.locator(".row.provider", { hasText: "Relay" }).click();
await unfold(page);
await pick(page, w.direct);
await pick(page, w.global);
saved = await save(page, posts);
+9
View File
@@ -14,6 +14,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const openrouter = {
id: "openrouter", name: "OpenRouter", icon: "generic", chat: "https://openrouter.ai/api/v1", responses: "", anthropic: "", catalog: "",
models: [{ id: "x/free", name: "Free", on: true }], agents: [], fallback: [], headers: {},
@@ -75,6 +82,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor input.rpm").waitFor();
await page.waitForTimeout(300); // the editor drawn again as what it asked for comes in
return { page, errors, posts };
@@ -118,6 +126,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
assert.equal(saved.body.queueLimit, 0, "the queue goes with it as before");
await page.locator(".row.provider", { hasText: "OpenRouter" }).click();
await unfold(page);
await box(page).fill("");
saved = await save(page, posts);
assert(Object.hasOwn(saved.body, "maxRPM"), "an empty field is saved as no limit, not left out");
@@ -13,6 +13,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const relay = {
id: "relay", name: "Relay", icon: "generic", chat: "", responses: "", anthropic: "https://relay.example.com", catalog: "",
models: [{ id: "claude-haiku-4-5", name: "Claude Haiku 4.5", on: true }], agents: [], fallback: [], headers: {},
@@ -74,6 +81,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor .bar").waitFor();
return { page, errors, posts };
};
@@ -12,6 +12,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const base = {
icon: "generic", chat: "", responses: "", anthropic: "", catalog: "",
models: [{ id: "qwen3", name: "Qwen3", on: true }], agents: [], fallback: [], headers: {},
@@ -75,6 +82,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor .bar").waitFor();
return { page, errors, posts };
};
@@ -12,6 +12,13 @@ const { test } = require("node:test");
const { chromium, webkit } = require("playwright");
const assets = path.resolve(__dirname, "../assets");
// the editor folds what few need under Advanced, this field among them:
// opened as a reader would, unless something set in it opened it already
const unfold = async (page) => {
const adv = page.locator(".editor details.advanced");
await adv.waitFor({ state: "attached" });
if (!(await adv.evaluate((d) => d.open))) await adv.locator(":scope > summary").click();
};
const base = {
icon: "generic", chat: "", responses: "", anthropic: "", catalog: "",
models: [{ id: "m1", name: "M1", on: true }], agents: [], fallback: [], headers: {},
@@ -82,6 +89,7 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await page.route("**/*", serve(lang, posts));
await page.goto("http://magpie.test/?view=providers");
await page.locator(".row.provider", { hasText: name }).click();
await unfold(page);
await page.locator(".editor .bar").waitFor();
return { page, errors, posts };
};
@@ -93,7 +93,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
};
const edit = async (page, name) => {
await page.locator(".row.provider", { hasText: name }).click();
await page.locator(".editor .proxy-mode").waitFor();
// drawn: the proxy is under Advanced, folded
await page.locator(".editor .proxy-mode").waitFor({ state: "attached" });
};
const ak = (page) => page.locator(".editor .volc-ak");
const sk = (page) => page.locator(".editor .volc-sk");
+5 -1
View File
@@ -191,6 +191,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
// none typed: said, nothing sent, the project focused and the
// editor left where it was scrolled to
await click(page, ed.locator("input.vertex-location"));
// Advanced open, so the editor is taller than the window and scrolls
await ed.locator("details.advanced > summary").click();
const scroller = page.locator(".modal .editor > .ebody");
await scroller.evaluate((e) => { e.scrollTop = e.scrollHeight; });
await page.waitForTimeout(100);
@@ -268,7 +270,9 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
await ed.locator(".eps .ep .res.ok").waitFor();
assert.equal(await ed.locator(".eps .ep .res.ok").textContent(), w.ms);
// a header hint adds its header, its value typed next
// a header hint adds its header, its value typed next; the headers
// are under Advanced
await ed.locator("details.advanced > summary").click();
await ed.locator(".headers .hadds button", { hasText: "+ X-Vertex-AI-LLM-Request-Type" }).click();
await page.waitForFunction(() => !!document.activeElement?.closest(".headers"));
await page.keyboard.type("shared");
+2 -1
View File
@@ -88,7 +88,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
};
const edit = async (page, name) => {
await page.locator(".row.provider", { hasText: name }).click();
await page.locator(".editor .proxy-mode").waitFor();
// drawn: the proxy is under Advanced, folded
await page.locator(".editor .proxy-mode").waitFor({ state: "attached" });
};
const ak = (page) => page.locator(".editor .volc-ak");
const sk = (page) => page.locator(".editor .volc-sk");
+2 -1
View File
@@ -81,7 +81,8 @@ for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium",
};
const edit = async (page, name) => {
await page.locator(".row.provider", { hasText: name }).click();
await page.locator(".editor .proxy-mode").waitFor();
// drawn: the proxy is under Advanced, folded
await page.locator(".editor .proxy-mode").waitFor({ state: "attached" });
};
const org = (page) => page.locator(".editor .team-org");
const proj = (page) => page.locator(".editor .team-project");