Skip to content

Every agent's model. One place. Codex on DeepSeek, Claude Code on Kimi, from the menu bar.

gui: a status line longer than its place floats wrapped, whole (littleHong)

yetoned4c05ca11480
diff --git a/internal/gui/assets/app.css b/internal/gui/assets/app.css
index 464f52750..0818108ea 100644
--- a/internal/gui/assets/app.css
+++ b/internal/gui/assets/app.css
@@ -2122,7 +2122,11 @@ body.window .foot { padding-left: 18px; }
it fits the footer's 22px, so its coming doesn't make the page above
it shorter and move it */
.status.ok, .status.err, .status.warn { font-size: 12.5px; line-height: 16px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, var(--bg)); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent); }
-.status.lift { position: fixed; z-index: 21; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: color-mix(in srgb, currentColor 16%, var(--card)); left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100vw - 32px); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent), 0 6px 20px rgba(0, 0, 0, .28); animation: fade-in .2s var(--ease); }
+.status.lift { position: fixed; z-index: 21; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 11px; background: color-mix(in srgb, currentColor 16%, var(--card)); left: 50%; bottom: 18px; transform: translateX(-50%); max-width: calc(100vw - 32px); box-shadow: inset 0 0 0 1px color-mix(in srgb, currentColor 30%, transparent), 0 6px 20px rgba(0, 0, 0, .28); animation: fade-in .2s var(--ease); }
+/* a line longer than its place floats too (status), and is read whole
+ (littleHong): wrapped, up to ten lines, the rest scrolled to; one line
+ is still a pill (22px tall, 11px corners) */
+body .foot .status.lift { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; width: max-content; max-width: min(560px, calc(100vw - 32px)); max-height: min(166px, 40vh); overflow-y: auto; overscroll-behavior: contain; }
/* ---- picker popover ------------------------------------------------------- */
.pop {
diff --git a/internal/gui/assets/app.js b/internal/gui/assets/app.js
index 5fe65eab6..9f7864dfa 100644
--- a/internal/gui/assets/app.js
+++ b/internal/gui/assets/app.js
@@ -380,11 +380,17 @@ function status(msg, kind = "", ms = kind === "err" ? 8000 : 3500) {
s.title = msg;
s.className = "status " + kind;
s.setAttribute("role", kind === "err" ? "alert" : "status");
- // with a dialog open the footer is under its scrim: the pill floats over both
+ // with a dialog open the footer is under its scrim, and a line longer than
+ // the footer is cut there (littleHong): the pill floats over both, wrapped
const m = $("#modal");
- s.classList.toggle("lift", !!msg && !m.hidden && !m.classList.contains("out"));
+ s.classList.toggle("lift", !!msg && (!m.hidden && !m.classList.contains("out") || s.scrollWidth > s.clientWidth));
clearTimeout(status.t);
- if (msg) status.t = setTimeout(() => { s.textContent = ""; s.className = "status"; }, ms);
+ if (!msg) return;
+ // as long as a long one takes to read, and while the pointer is on it
+ const end = (w) => status.t = setTimeout(() => { s.textContent = ""; s.className = "status"; }, w);
+ s.onmouseenter = () => clearTimeout(status.t);
+ s.onmouseleave = () => end(2000);
+ end(Math.max(ms, msg.length * 80));
}
// ---------- agents view ----------
diff --git a/internal/gui/tests/status-long.test.cjs b/internal/gui/tests/status-long.test.cjs
new file mode 100644
index 000000000..413f0b1c3
--- /dev/null
+++ b/internal/gui/tests/status-long.test.cjs
@@ -0,0 +1,166 @@
+// Run with Node's test runner and Playwright on the module path; see README.md.
+// The status pill says a long outcome whole (littleHong on Discord): Test
+// models in OfficeAce's editor failed on every model, and the red pill was
+// one line ending in "…", so the part saying what to do was lost. A line
+// longer than its place floats over the window wrapped, up to ten lines,
+// the rest scrolled to; it stays while the pointer is on it and as long as
+// it takes to read; its text can be selected; a short one stays in the
+// footer as it was. In every language, light and dark, wide and narrow.
+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");
+// the reporter's error, as the OfficeAce plugin words it
+const said = "OfficeAce 账号已登录,但还没有接入华为云 MaaS(凭据里没有 modelAppKey)。请在 OfficeAce 客户端完成「接入华为云 MaaS 模型」后重试;额度与签到不受影响,已经可以正常使用。";
+const models = ["glm-5.3", "glm-5.3-flash", "deepseek-v4", "deepseek-v4-flash", "kimi-k3", "qwen4-coder", "qwen4-max", "minimax-m3", "glm-5.2", "deepseek-r3"];
+const provider = {
+ id: "officeace", name: "OfficeAce", icon: "generic", chat: "https://officeace.example/v2", responses: "", anthropic: "", catalog: "",
+ agents: [], fallback: [], headers: {}, keyList: [], proxy: "", key: { set: true, masked: "sk-…one" },
+ models: models.map((id) => ({ id, name: "", on: true })),
+};
+
+function serve(lang, theme) {
+ const list = { providers: [provider], presets: [], excluded: [], gateway: { running: true, window: true } };
+ const state = { agents: [], profiles: [], settings: { lang, theme } };
+ 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:"${theme}",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(list);
+ if (url.pathname === "/api/groups") return json({ groups: [] });
+ if (url.pathname === "/api/plugins") return json({ plugins: [] });
+ if (url.pathname === "/api/provider/test") {
+ const body = route.request().postDataJSON();
+ return json({ results: (body.test || []).map((model) => ({ ok: false, model, status: 400, error: said })) });
+ }
+ 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 });
+ };
+}
+
+// how the pill is drawn: whether it is cut, and where it is
+const look = (page) => page.locator("#status").evaluate((e) => {
+ const cs = getComputedStyle(e), r = e.getBoundingClientRect();
+ return {
+ text: e.textContent, lift: e.classList.contains("lift"),
+ cutAcross: e.scrollWidth > e.clientWidth + 1, cutDown: e.scrollHeight > e.clientHeight + 1,
+ height: r.height, left: r.left, right: r.right, top: r.top, bottom: r.bottom, vw: innerWidth, vh: innerHeight,
+ overflowY: cs.overflowY, select: cs.userSelect || cs.webkitUserSelect, borderLeft: parseFloat(cs.borderLeftWidth) || 0,
+ lineHeight: parseFloat(cs.lineHeight),
+ };
+});
+
+for (const engine of (process.env.BROWSER ? [process.env.BROWSER] : ["chromium", "webkit"])) {
+ const launch = () => engine === "webkit" ? webkit.launch() : chromium.launch({ channel: "chromium" });
+ const open = async (t, lang, theme, width, name) => {
+ const browser = await launch();
+ const page = await (await browser.newContext({ viewport: { width, height: 760 }, reducedMotion: "reduce" })).newPage();
+ t.after(async () => {
+ if (process.env.ARTIFACT_DIR) {
+ await fs.mkdir(process.env.ARTIFACT_DIR, { recursive: true });
+ await page.screenshot({ path: path.join(process.env.ARTIFACT_DIR, `${engine}-${lang}-${theme}-${width}-${name}-status-long.png`) });
+ }
+ await browser.close();
+ });
+ page.setDefaultTimeout(5000);
+ const errors = [];
+ page.on("pageerror", (e) => errors.push(e.message));
+ await page.route("**/*", serve(lang, theme));
+ await page.goto("http://magpie.test/?view=providers");
+ return { page, errors };
+ };
+
+ for (const lang of ["en", "zh", "zh-TW", "ja", "de"]) {
+ for (const [theme, width] of [["light", 900], ["dark", 390]]) {
+ test(`${engine} ${lang} ${theme} ${width}: Test models' failure is said whole over the editor`, async (t) => {
+ const { page, errors } = await open(t, lang, theme, width, "editor");
+ await page.locator(".row.provider", { hasText: "OfficeAce" }).first().click();
+ await page.locator(".editor .mchips .mchip").first().waitFor();
+ const name = await page.evaluate(() => t("Test models"));
+ await page.locator(".editor .mfoot").getByRole("button", { name, exact: true }).click();
+ await page.waitForFunction((s) => document.querySelector("#status").textContent.includes(s), said);
+ const want = await page.evaluate(([s, m]) => t("{n} of {all} models didn't answer; {model}: {error}", { n: 10, all: 10, model: m, error: "400 · " + s }), [said, models[0]]);
+ const got = await look(page);
+ assert.equal(got.text, want);
+ assert(got.lift, "the pill floats over the dialog");
+ assert(!got.cutAcross && !got.cutDown, `the whole message shows, nothing cut: ${JSON.stringify(got)}`);
+ assert(got.height > 2 * got.lineHeight, `it wraps to several lines: ${JSON.stringify(got)}`);
+ assert(got.left >= 0 && got.right <= got.vw && got.top >= 0 && got.bottom <= got.vh, `it fits the window: ${JSON.stringify(got)}`);
+ assert.equal(got.select, "text", "its text can be selected");
+ assert.equal(got.borderLeft, 0, "no left-border accent");
+ // the words it ends with can be read where they are drawn
+ const end = await page.locator("#status").evaluate((e) => {
+ const r = document.createRange();
+ r.setStart(e.firstChild, e.firstChild.length - 1);
+ r.setEnd(e.firstChild, e.firstChild.length);
+ const b = r.getBoundingClientRect(), box = e.getBoundingClientRect();
+ return b.bottom <= box.bottom + 0.5 && b.right <= box.right + 0.5 && b.width > 0;
+ });
+ assert(end, "its last character is inside the pill");
+ assert.deepEqual(errors, []);
+ });
+ }
+ }
+
+ for (const lang of ["en", "zh"]) {
+ test(`${engine} ${lang}: a long line from a page floats wrapped, a short one stays in the footer`, async (t) => {
+ const { page, errors } = await open(t, lang, "light", 900, "footer");
+ await page.locator(".row.provider", { hasText: "OfficeAce" }).first().waitFor();
+ await page.evaluate(() => status(t("Saved"), "ok"));
+ let got = await look(page);
+ assert(!got.lift && !got.cutAcross, `a short line stays in the footer: ${JSON.stringify(got)}`);
+ for (const kind of ["err", "warn", "ok"]) {
+ await page.evaluate(([s, k]) => status(s, k), [said, kind]);
+ got = await look(page);
+ assert(got.lift, `${kind}: a line longer than the footer floats`);
+ assert(!got.cutAcross && !got.cutDown, `${kind}: shown whole: ${JSON.stringify(got)}`);
+ assert(got.left >= 0 && got.right <= got.vw && got.bottom <= got.vh, `${kind}: fits the window: ${JSON.stringify(got)}`);
+ }
+ assert.deepEqual(errors, []);
+ });
+
+ test(`${engine} ${lang}: a very long line is held to ten lines and scrolled to its end`, async (t) => {
+ const { page, errors } = await open(t, lang, "dark", 390, "scroll");
+ await page.locator(".row.provider", { hasText: "OfficeAce" }).first().waitFor();
+ await page.evaluate((s) => status(Array(12).fill(s).join(" "), "err"), said);
+ const got = await look(page);
+ assert(got.lift && !got.cutAcross, `wrapped: ${JSON.stringify(got)}`);
+ assert(got.height <= 10 * got.lineHeight + 8, `held to ten lines: ${JSON.stringify(got)}`);
+ assert(got.bottom <= got.vh && got.top >= 0, `fits the window: ${JSON.stringify(got)}`);
+ assert.equal(got.overflowY, "auto");
+ assert(got.cutDown, "the rest is under it, to scroll to");
+ const s = page.locator("#status");
+ await s.hover();
+ await page.mouse.wheel(0, 4000);
+ await page.waitForFunction(() => { const e = document.querySelector("#status"); return e.scrollTop + e.clientHeight >= e.scrollHeight - 1; });
+ assert.equal(await page.evaluate(() => scrollY), 0, "the page under it didn't scroll");
+ assert.deepEqual(errors, []);
+ });
+
+ test(`${engine} ${lang}: the pill stays while the pointer is on it, and goes after`, async (t) => {
+ const { page, errors } = await open(t, lang, "light", 900, "hover");
+ await page.locator(".row.provider", { hasText: "OfficeAce" }).first().waitFor();
+ // a short one goes at the time it was given
+ await page.evaluate(() => status("Saved", "ok", 200));
+ await page.waitForFunction(() => document.querySelector("#status").textContent === "", null, { timeout: 3000 });
+ // a long one is given the time its words take
+ await page.evaluate((s) => status(s, "err", 200), said);
+ await page.waitForTimeout(600);
+ assert.equal(await page.locator("#status").textContent(), said, "a long line stays long enough to read");
+ await page.locator("#status").hover();
+ // past its reading time, held by the pointer
+ await page.waitForTimeout(said.length * 80 + 300);
+ assert.equal(await page.locator("#status").textContent(), said, "held while the pointer is on it");
+ await page.mouse.move(5, 5);
+ await page.waitForFunction(() => document.querySelector("#status").textContent === "", null, { timeout: 5000 });
+ assert.deepEqual(errors, []);
+ });
+ }
+}