gui: the core scripts back under their budget after ecc16fe97
ecc16fe97ran TestCoreScriptBudget at fc9ce34d8;3b550a99c, rebased in under it, left 19 bytes, and the panel's unpriced wording (249 bytes) took the core to 1,534,032, 230 over. Four of the quick panel's comments cut, no raise. Run on mote at this head: go test -run TestCoreScriptBudget ./internal/gui ok; panel-usage and i18n-keys 8/8; gofmt clean. Reported-by: tenacious_eagle on Discord
This commit is contained in:
@@ -17403,18 +17403,15 @@ function renderPanelUse() {
|
||||
if (full) b.title = full;
|
||||
// a value in parts (an array) keeps each whole, wrapping between them
|
||||
const v = el("span", "v" + (cls ? " " + cls : "") + (Array.isArray(value) ? " parts" : ""), Array.isArray(value) ? undefined : value);
|
||||
// (a space between two stays out of them: one leading a part is dropped)
|
||||
if (Array.isArray(value)) value.forEach((x, i) => v.append(...(i && /^\s/.test(x) ? [" "] : []), el("span", "", x.trim())));
|
||||
b.append(el("span", "k", t(label)), v);
|
||||
if (sub) b.append(el("span", "sub" + (subCls ? " " + subCls : ""), sub));
|
||||
tot.append(b);
|
||||
};
|
||||
// the total counts the cache's tokens too, so they're named beside in and out
|
||||
const cached = l.cache_read + l.cache_write;
|
||||
blk("Tokens", fmtN(allTokens(l)), t("{a} in · {b} out", { a: fmtN(l.input), b: fmtN(l.output) }) + (cached ? " · " + t("{n} cached", { n: fmtN(cached) }) : ""), "", "", ledNum(allTokens(l)));
|
||||
blk("Requests", fmtN(l.calls), [l.errors ? t("{n} failed", { n: fmtN(l.errors) }) : t("none failed"), l.retried ? t("{n} answered on a retry", { n: fmtN(l.retried) }) : ""].filter(Boolean).join(" · "), "", l.errors ? "bad" : "", ledNum(l.calls));
|
||||
const c = fmtCost(l);
|
||||
// as the Usage page words it, the sentence on hover
|
||||
const u = l.unpriced, one = u === 1;
|
||||
blk("Cost", c ? "≈" + c : "—", u ? t(one ? "{n} call unpriced" : "{n} calls unpriced", { n: u }) : t("effective prices"), c ? "cost" : "", "", u ? t(one ? "{n} call had no known price and is not counted" : "{n} calls had no known price and are not counted", { n: u }) : "");
|
||||
blk("Cache hit rate", hitRate === null ? "—" : Math.round(100 * hitRate) + "%", cacheLeftOut(l) || t("of the prompt"));
|
||||
@@ -17432,7 +17429,6 @@ function renderPanelUse() {
|
||||
met.append(b);
|
||||
}
|
||||
head.append(met);
|
||||
// one provider's chart tells its models apart; all of them, the providers
|
||||
const split = panelUseProvider ? "model" : "provider";
|
||||
const chart = el("div", "led-chart"), rank = el("div", "led-rank");
|
||||
card.append(head, chart, rank);
|
||||
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user