From 31668771bd4bf49ec54b3b0bc25a91c68066200a Mon Sep 17 00:00:00 2001 From: ci-check Date: Tue, 3 Nov 2026 00:27:25 +0800 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20unified=20announcement=20surface=20?= =?UTF-8?q?=E2=80=94=20built-in=20registry=20+=20single=20renderer=20(lane?= =?UTF-8?q?=20A,=20#5548=20P1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Part of #5548 (approved unified announcement panel design, phase 1 of 4). Converge the hand-copied panel banners (pck-default-off #5079, wm-fastpath-intro #5469) into one registry (src/notices.ts) with a shared record schema, kind-priority/tone/dismiss-mode pure functions, and one client render loop (textContent only, max 5 header banners + overflow list card). Overview payload now carries a unified notices array; new GET /__bili/notices endpoint. Dismissal store, endpoint and allowlist semantics preserved (allowlist widened to registered dynamic ids for lanes B/C). No config surface change. --- src/notices.ts | 170 ++++++++++++++++++++++ src/pck-notice.ts | 13 +- src/server/admin.ts | 36 +++-- src/web/client.ts | 165 ++++++++++----------- src/web/i18n.ts | 28 ++-- src/web/page.ts | 4 +- tests/notices-registry.test.ts | 114 +++++++++++++++ tests/web-notices-banner.test.ts | 236 +++++++++++++++++++++++++++++++ 8 files changed, 646 insertions(+), 120 deletions(-) create mode 100644 src/notices.ts create mode 100644 tests/notices-registry.test.ts create mode 100644 tests/web-notices-banner.test.ts diff --git a/src/notices.ts b/src/notices.ts new file mode 100644 index 0000000000..b7d210ebce --- /dev/null +++ b/src/notices.ts @@ -0,0 +1,170 @@ +// #5548 unified announcement surface (design v2, owner-approved): three sources +// (A built-in declarations / B local JSON / C remote GitHub raw) feed ONE +// renderer through shared pure filter/sort functions and one dismissal store. +// P1 lands lane A only — the built-in table converging the two hand-copied +// banners (#5079 pck-default-off, #5469 wm-fastpath-intro); lanes B/C register +// their loaded ids via registerDynamicNoticeIds() when they land (P2/P3). +// Pure module: no fs, no io — the dismissal store stays in pck-notice.ts. + +export type NoticeKind = "new-feature" | "upgrade-advisory" | "warning" | "suggestion" | "incident" | "deprecation" | "other"; +export type NoticeTone = "ok" | "warn" | "info"; +export type NoticeDismiss = "persistent" | "instance" | "always"; +/** Multilang copy: locale object (keys like "zh-CN"/"en") or a plain string. */ +export type NoticeText = string | Record; + +export interface NoticeRecord { + id: string; + kind: NoticeKind; + title: NoticeText; + desc?: NoticeText; + hint?: NoticeText; + ctaLabel?: NoticeText; + ctaUrl?: string; + /** Explicit tone overrides the kind-derived one (toneOf). */ + tone?: NoticeTone; + /** persistent (default) | instance (process-only) | always (never hidden, no close button). */ + dismiss?: NoticeDismiss; + /** 0–100; absent/null falls back to the kind default in KIND_PRIORITY. */ + priority?: number | null; + /** ISO8601 UTC; sort tiebreak after priority (newer first). */ + publishedAt?: string; + // P2 targeting dimensions (declared now so wire types stay stable across + // phases; their filters land with lane B in P2): + versions?: string[]; + percent?: number | null; + since?: string; + until?: string; +} + +/** Server-side state a built-in declaration's active predicate may read. */ +export interface BuiltInContext { + /** effectivePromptCacheRouting() result ("disabled"/"auto"/"enabled"). */ + promptCacheRouting: string; + /** True when the user wrote an explicit pluginFullResendWatermark rollout override. */ + wmOverridePresent: boolean; +} + +export interface BuiltinNotice extends NoticeRecord { + active: (ctx: BuiltInContext) => boolean; +} + +export const KIND_PRIORITY: Record = { + incident: 90, + "upgrade-advisory": 80, + warning: 70, + deprecation: 60, + suggestion: 50, + "new-feature": 40, + other: 30, +}; + +export function priorityOf(rec: Pick): number { + return typeof rec.priority === "number" ? rec.priority : KIND_PRIORITY[rec.kind]; +} + +/** Kind-derived tone: new-feature→ok, warning/incident/deprecation→warn, rest→info. */ +export function toneOf(rec: Pick): NoticeTone { + if (rec.tone) return rec.tone; + if (rec.kind === "new-feature") return "ok"; + if (rec.kind === "warning" || rec.kind === "incident" || rec.kind === "deprecation") return "warn"; + return "info"; +} + +export function dismissModeOf(rec: Pick): NoticeDismiss { + return rec.dismiss ?? "persistent"; +} + +/** Visible under the record's dismiss mode (P2 upgrades store keys to id@hash16). */ +export function noticeVisible( + rec: Pick, + dismissedPersistent: ReadonlySet, + dismissedInstance: ReadonlySet = new Set(), +): boolean { + const mode = dismissModeOf(rec); + if (mode === "always") return true; + if (mode === "instance") return !dismissedInstance.has(rec.id); + return !dismissedPersistent.has(rec.id); +} + +/** Stable sort: priority desc, then publishedAt desc (missing timestamps last). */ +export function sortNotices(list: readonly T[]): T[] { + const ts = (r: NoticeRecord): number => { + const t = r.publishedAt ? Date.parse(r.publishedAt) : NaN; + return Number.isNaN(t) ? -Infinity : t; + }; + return [...list].sort((a, b) => { + const pa = priorityOf(a), pb = priorityOf(b); + if (pa !== pb) return pb - pa; + const ta = ts(a), tb = ts(b); + if (ta !== tb) return tb - ta; + return 0; + }); +} + +export const PCK_NOTICE_ID = "pck-default-off"; +export const WM_FASTPATH_INTRO_ID = "wm-fastpath-intro"; + +/** Lane A: built-in declarations (bound to code behavior, review-gated here). */ +export const BUILTIN_NOTICES: readonly BuiltinNotice[] = [ + { + // #5079: prompt_cache.routing default flip (auto → disabled) upgrade notice. + // Explicit tone "warn": the derived tone for upgrade-advisory is info, but + // this banner has rendered as .banner.warn since #5079 (byte-stable). + id: PCK_NOTICE_ID, + kind: "upgrade-advisory", + tone: "warn", + title: { "zh-CN": "prompt_cache_key 自注入已默认关闭(升级提示)", en: "prompt_cache_key self-stamping is now off by default (upgrade notice)" }, + desc: { + "zh-CN": "本版本起 bili 不再自行向请求添加 OpenAI 的 prompt_cache_key 字段(此前默认开启)。如果你的上游是按该字段路由前缀缓存的中转站或号池(如 workbuddy panel/hub 等),请打开开关恢复注入,否则流量可能被随机路由、频繁未命中缓存。", + en: "Since this version bili no longer adds OpenAI's prompt_cache_key field to requests on its own (previously on by default). If your upstream routes prefix cache by this key (relays such as workbuddy panel/hub, account pools), turn the switch back on — otherwise traffic may route randomly and miss the prefix cache.", + }, + hint: { + "zh-CN": "开关在「配置」页快速配置里(promptCache.routing:disabled/auto/enabled),也可直接改 billion-context.json;直连官方 API 的用户可忽略此提示。", + en: "Switch: Configuration page → quick config (promptCache.routing: disabled/auto/enabled), or edit billion-context.json directly; direct official-API users can ignore this notice.", + }, + active: (ctx) => ctx.promptCacheRouting === "disabled", + }, + { + // #5403/#5469: watermark fastpath experimental-grey intro — every install + // sees it on first upgrade until closed or an explicit rollout override. + id: WM_FASTPATH_INTRO_ID, + kind: "new-feature", + tone: "ok", + title: { "zh-CN": "新功能提示:大上下文增量解析(增量压缩过渡功能 · 实验性)", en: "New: incremental parsing for large contexts (incremental-compression bridge feature, experimental)" }, + desc: { + "zh-CN": "长会话每轮都要把整个历史重新发给代理解析一遍,现在改为增量解析:只解析本轮新增的那部分,优化长会话的解析性能(发给模型的内容不变;有任何疑点,当轮自动回退老路径并重新对齐)。当前版本对约 5% 的安装灰度开启,属实验性功能。", + en: "Long conversations used to re-send their entire history for parsing on every turn. Now only the new part of each turn is parsed — faster parsing on long sessions (the request sent to the model is unchanged; any doubt falls back to the old path for that turn and re-aligns). This release rolls it out to roughly 5% of installs; it is marked experimental.", + }, + hint: { + "zh-CN": "开关在「配置」页快速配置(大上下文增量解析),也可在 billion-context.json 写 rollout.features.pluginFullResendWatermark: true/false,或设环境变量 BILI_ROLLOUT_PLUGIN_FULL_RESEND_WATERMARK=1/0。", + en: "Switch: Configuration page → quick config (incremental parsing for large contexts), or write rollout.features.pluginFullResendWatermark: true/false in billion-context.json, or set BILI_ROLLOUT_PLUGIN_FULL_RESEND_WATERMARK=1/0.", + }, + active: (ctx) => !ctx.wmOverridePresent, + }, +]; + +const dynamicIds = new Set(); + +/** Lanes B/C register their loaded ids so dismissal stays validated (#5548 §4.5). */ +export function registerDynamicNoticeIds(ids: Iterable): void { + for (const id of ids) dynamicIds.add(id); +} + +/** Every notice id a dismissal POST may name: built-ins + registered lanes B/C. */ +export function knownNoticeIds(): ReadonlySet { + const all = new Set(BUILTIN_NOTICES.map((b) => b.id)); + for (const id of dynamicIds) all.add(id); + return all; +} + +export interface VisibleNoticesOptions { + dismissed: ReadonlySet; + instanceDismissed?: ReadonlySet; +} + +/** Lane-A visible set: active predicates AND dismiss mode, priority-sorted. + * Wire shape strips the active function — plain records only. */ +export function visibleBuiltInNotices(ctx: BuiltInContext, opts: VisibleNoticesOptions): NoticeRecord[] { + const live = BUILTIN_NOTICES.filter((b) => b.active(ctx) && noticeVisible(b, opts.dismissed, opts.instanceDismissed)); + return sortNotices(live).map(({ active: _active, ...wire }) => wire); +} diff --git a/src/pck-notice.ts b/src/pck-notice.ts index 55b5041e59..c2e4d6ab57 100644 --- a/src/pck-notice.ts +++ b/src/pck-notice.ts @@ -9,17 +9,16 @@ // never fails a request or a page load). It is only active while the EFFECTIVE // routing is "disabled": users who already chose auto/enabled made the call // themselves and are not nagged. +// #5548: this module is now just the shared dismissal store of the unified +// announcement surface — known ids and the built-in declarations live in +// notices.ts (registry), so lanes B/C register ids without touching this file. import fs from "node:fs"; import path from "node:path"; import { stateDir } from "./paths.js"; +import { PCK_NOTICE_ID, knownNoticeIds } from "./notices.js"; -export const PCK_NOTICE_ID = "pck-default-off"; -// #5403 watermark fastpath experimental-grey intro (owner ruling 2026-11-02): -// same one-time-per-instance store, its own id so dismissal stays independent. -export const WM_FASTPATH_INTRO_ID = "wm-fastpath-intro"; - -const UPGRADE_NOTICE_IDS: ReadonlySet = new Set([PCK_NOTICE_ID, WM_FASTPATH_INTRO_ID]); +export { PCK_NOTICE_ID, WM_FASTPATH_INTRO_ID } from "./notices.js"; const DISMISS_FILE = "upgrade-notices.json"; @@ -43,7 +42,7 @@ export function dismissedUpgradeNotices(env: NodeJS.ProcessEnv = process.env): R /** Idempotent. Returns false only for unknown notice ids. */ export function dismissUpgradeNotice(id: string, env: NodeJS.ProcessEnv = process.env): boolean { - if (!UPGRADE_NOTICE_IDS.has(id)) return false; + if (!knownNoticeIds().has(id)) return false; const set = new Set(dismissedUpgradeNotices(env)); set.add(id); try { diff --git a/src/server/admin.ts b/src/server/admin.ts index da947bc792..64e126e0d3 100644 --- a/src/server/admin.ts +++ b/src/server/admin.ts @@ -23,7 +23,8 @@ import { getUnrecognizedPathStats } from "./observability.js"; import { getStore } from "../persist.js"; import { BodyTooLargeError, headerValue, readBody } from "../server.js"; import { dismissHostPlugin, visibleHostPluginNotices } from "../host-plugin-notice.js"; -import { dismissedUpgradeNotices, dismissUpgradeNotice, PCK_NOTICE_ID, pckNoticeActive, WM_FASTPATH_INTRO_ID } from "../pck-notice.js"; +import { dismissedUpgradeNotices, dismissUpgradeNotice } from "../pck-notice.js"; +import { visibleBuiltInNotices, type NoticeRecord } from "../notices.js"; import { featureOverrideAbsent } from "../rollout.js"; import { listSessions, memoryReport, peekSession, splitSessionWarnings, totalInFlight } from "../session.js"; import { BILI_TUNNEL_HEADER } from "../tunnel-guard.js"; @@ -438,8 +439,14 @@ export async function handleAdminRoute(req: http.IncomingMessage, res: http.Serv if (req.method === "POST" && req.url?.startsWith("/__bili/conflicts/clear")) return handleConflictsClear(req.url, res, log); // #2861: silence a known host-side plugin notice for this environment. if (req.method === "POST" && req.url === "/__bili/host-plugins/dismiss") return handleHostPluginDismiss(req, res, log); - // #5079: silence the prompt_cache.routing default-off upgrade notice. + // #5079: silence a known notice of the unified announcement surface. if (req.method === "POST" && req.url === "/__bili/notices/dismiss") return handleNoticeDismiss(req, res, log); + // #5548: unified announcement payload for non-overview consumers. + if (req.method === "GET" && req.url === "/__bili/notices") { + res.writeHead(200, { "content-type": "application/json" }); + res.end(JSON.stringify({ notices: visibleNoticesPayload(opts) }, null, 2)); + return; + } // #3923/#3959: dismiss the surfaced split-brain notice (body {"sessionId": string}). if (req.method === "POST" && req.url === "/__bili/storage/split-brain/ack") return handleSplitBrainAck(req, res, log); if (req.method === "GET" && req.url === "/__bili/upstream") { @@ -1302,6 +1309,20 @@ function sendResignStatus(res: http.ServerResponse): void { }, null, 2)); } +// #5548: unified announcement payload — every visible record (lane A built-ins +// in P1; lanes B/C merge into this same list in later phases), priority-sorted +// server-side. The wm intro stays visible to EVERY install on its first +// upgrade until closed unless an explicit rollout override exists. +function visibleNoticesPayload(opts: ProxyOptions): NoticeRecord[] { + return visibleBuiltInNotices( + { + promptCacheRouting: effectivePromptCacheRouting(opts.promptCache), + wmOverridePresent: !featureOverrideAbsent("pluginFullResendWatermark", loadConfigFile().rollout), + }, + { dismissed: dismissedUpgradeNotices(process.env) }, + ); +} + async function sendOverview(res: http.ServerResponse, opts: ProxyOptions, laneHost?: string): Promise { let diskVersion: string | undefined; let stale = false; @@ -1338,16 +1359,7 @@ async function sendOverview(res: http.ServerResponse, opts: ProxyOptions, laneHo updatePolicy: updatePolicyPayload(), pluginAdvisories: detectCostAdvisories(process.env), hostPluginNotices: visibleHostPluginNotices(process.env), - pckNotice: { id: PCK_NOTICE_ID, active: pckNoticeActive(effectivePromptCacheRouting(opts.promptCache)) }, - wmNotice: { - id: WM_FASTPATH_INTRO_ID, - // #5403 experimental-grey intro: visible to EVERY install on its - // first upgrade to this build until closed — unless the user - // already wrote an explicit rollout override (they made the call). - active: - !dismissedUpgradeNotices(process.env).has(WM_FASTPATH_INTRO_ID) && - featureOverrideAbsent("pluginFullResendWatermark", loadConfigFile().rollout), - }, + notices: visibleNoticesPayload(opts), inFlight: totalInFlight(), blindTunnels: getBlindTunnelStats(), conflicts: summarizeConflicts(listSessions()), diff --git a/src/web/client.ts b/src/web/client.ts index e3bc1d4f70..1868c497b2 100644 --- a/src/web/client.ts +++ b/src/web/client.ts @@ -419,28 +419,87 @@ export const WEB_CLIENT = `(function () { return html; } window.bili_hostPluginBanner = bili_hostPluginBanner; - // #5079: one-time-per-instance upgrade notice — prompt_cache_key - // self-stamping is off by default now. Server decides active (effective - // routing "disabled" && not dismissed); pure builder, same test-seam - // convention as the banners above. - function bili_pckNoticeBanner(s) { - let html = '"; - html += '
' + escapeHtml(s.desc) + '
"; - html += '
' + escapeHtml(s.hint) + "
"; - return html; + // #5548: unified announcement surface (design v2 lane A). The server ships + // priority-sorted visible records whose copy rides the record (string or + // locale object, fallback locale → zh-CN → en → any); elements are built + // with textContent only — zero innerHTML with external data (design §4.2). + function bili_noticeText(v, lang) { + if (typeof v === "string") return v; + if (v && typeof v === "object") { + for (const k of [lang, "zh-CN", "en"]) if (typeof v[k] === "string" && v[k]) return v[k]; + for (const k of Object.keys(v)) if (typeof v[k] === "string" && v[k]) return v[k]; + } + return ""; } - window.bili_pckNoticeBanner = bili_pckNoticeBanner; - // #5403: one-time-per-instance intro for the watermark fastpath - // experimental grey rollout — same server-side dismissal convention as - // above (own notice id, visible on every install until closed or an - // explicit rollout override exists); pure builder + same test seam. - function bili_wmNoticeBanner(s) { - let html = '"; - html += '
' + escapeHtml(s.desc) + '
"; - html += '
' + escapeHtml(s.hint) + "
"; - return html; + window.bili_noticeText = bili_noticeText; + const NOTICE_MAX_HEADER_BANNERS = 5; + function bili_buildNoticeEl(n) { + const el = document.createElement("div"); + el.className = "banner show " + String(n.tone || "info"); + const title = document.createElement("div"); + title.className = "banner-title"; + title.textContent = bili_noticeText(n.title, locale); + el.appendChild(title); + const row = document.createElement("div"); + row.className = "alert-row"; + const span = document.createElement("span"); + span.textContent = bili_noticeText(n.desc, locale); + row.appendChild(span); + if (n.ctaUrl && n.ctaLabel) { + const link = document.createElement("a"); + link.className = "mono"; + link.href = String(n.ctaUrl); + link.target = "_blank"; + link.rel = "noopener"; + link.textContent = bili_noticeText(n.ctaLabel, locale); + row.appendChild(link); + } + if (n.dismiss !== "always") { + const btn = document.createElement("button"); + btn.className = "btn sm notice-dismiss"; + btn.textContent = t("notices.dismiss_btn"); + btn.addEventListener("click", async () => { + busy(btn, true); + try { + await json(API_ROOT + "/notices/dismiss", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ id: typeof n.id === "string" ? n.id : "" }) }); + toast(t("notices.dismissed"), "ok"); + await loadOverview(true); + } catch (e) { + toast(e.message, "err"); + } finally { + busy(btn, false); + } + }); + row.appendChild(btn); + } + el.appendChild(row); + if (n.hint !== undefined) { + const hint = document.createElement("div"); + hint.className = "dim small"; + hint.style.marginTop = "6px"; + hint.textContent = bili_noticeText(n.hint, locale); + el.appendChild(hint); + } + return el; + } + window.bili_buildNoticeEl = bili_buildNoticeEl; + function renderAnnouncementBanners(list) { + const host = $("notices-banners"); + if (!host) return; + while (host.firstChild) host.removeChild(host.firstChild); + const card = $("notice-list-card"); + const ovf = $("notice-list"); + if (ovf) while (ovf.firstChild) ovf.removeChild(ovf.firstChild); + if (card) card.hidden = true; + if (!Array.isArray(list) || !list.length) return; + const head = list.slice(0, NOTICE_MAX_HEADER_BANNERS); + for (const n of head) host.appendChild(bili_buildNoticeEl(n)); + const rest = list.slice(NOTICE_MAX_HEADER_BANNERS); + if (rest.length && card && ovf) { + card.hidden = false; + for (const n of rest) ovf.appendChild(bili_buildNoticeEl(n)); + } } - window.bili_wmNoticeBanner = bili_wmNoticeBanner; function $(id) { return document.getElementById(id); } function toast(message, kind) { const host = $("toast-host"); @@ -1583,65 +1642,13 @@ function changelogCatOf(rawLine) { hb.innerHTML = ""; } } - // #5079: prompt_cache_key default-off upgrade notice — dismissal is - // server-side (POST /__bili/notices/dismiss) so one close silences - // every browser; the banner re-renders from the refetched overview. - const nb = $("pck-notice-banner"); - if (nb) { - const pn = d.pckNotice && typeof d.pckNotice === "object" ? d.pckNotice : null; - if (pn && pn.active === true) { - nb.hidden = false; - nb.classList.add("show"); - nb.innerHTML = bili_pckNoticeBanner({ on: t("pckoff.on"), desc: t("pckoff.desc"), hint: t("pckoff.hint"), dismiss: t("pckoff.dismiss_btn") }); - for (const btn of Array.from(nb.querySelectorAll(".pck-notice-dismiss"))) { - btn.addEventListener("click", async () => { - busy(btn, true); - try { - await json(API_ROOT + "/notices/dismiss", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ id: typeof pn.id === "string" ? pn.id : "" }) }); - toast(t("pckoff.dismissed"), "ok"); - await loadOverview(true); - } catch (e) { - toast(e.message, "err"); - } finally { - busy(btn, false); - } - }); - } - } else { - nb.hidden = true; - nb.classList.remove("show"); - nb.innerHTML = ""; - } - } - // #5403: watermark fastpath experimental-grey intro — all installs see - // it on first upgrade until closed (server-side, like #5079 above). - const wnb = $("wm-notice-banner"); - if (wnb) { - const wn = d.wmNotice && typeof d.wmNotice === "object" ? d.wmNotice : null; - if (wn && wn.active === true) { - wnb.hidden = false; - wnb.classList.add("show"); - wnb.innerHTML = bili_wmNoticeBanner({ on: t("wmfast.on"), desc: t("wmfast.desc"), hint: t("wmfast.hint"), dismiss: t("wmfast.dismiss_btn") }); - for (const btn of Array.from(wnb.querySelectorAll(".wm-notice-dismiss"))) { - btn.addEventListener("click", async () => { - busy(btn, true); - try { - await json(API_ROOT + "/notices/dismiss", { method: "POST", headers: { "content-type": "application/json" }, body: JSON.stringify({ id: typeof wn.id === "string" ? wn.id : "" }) }); - toast(t("wmfast.dismissed"), "ok"); - await loadOverview(true); - } catch (e) { - toast(e.message, "err"); - } finally { - busy(btn, false); - } - }); - } - } else { - wnb.hidden = true; - wnb.classList.remove("show"); - wnb.innerHTML = ""; - } - } + // #5548: unified announcement surface — one loop over the server's + // visible records (lane A built-ins today; B/C merge in later phases). + // Dismissal stays server-side (POST /__bili/notices/dismiss) so one + // close silences every browser; banners re-render from the refetched + // overview. More than NOTICE_MAX_HEADER_BANNERS overflow into the + // overview's 公告列表 card. + renderAnnouncementBanners(Array.isArray(d.notices) ? d.notices : []); // #1682: global upstream-connection alert banner — visible on every view, // one row per active alert (no stacking), dismiss per alert instance. latestAlerts = Array.isArray(d.alerts) ? d.alerts : []; diff --git a/src/web/i18n.ts b/src/web/i18n.ts index 36cc98dfc2..7e1807eda1 100644 --- a/src/web/i18n.ts +++ b/src/web/i18n.ts @@ -284,16 +284,10 @@ export const MESSAGES: Record> = { "pck.on": "缓存路由键(prompt_cache_key)已停用", "pck.sessions": "受影响会话:{ids}", "pck.hint": "该上游拒绝携带 prompt_cache_key 的请求(带键 400、去键成功,A/B 实证),bili 重启前不再向其发送该键。若这是你的中转/号池,相关会话的前缀缓存亲和可能下降。", - "pckoff.on": "prompt_cache_key 自注入已默认关闭(升级提示)", - "pckoff.desc": "本版本起 bili 不再自行向请求添加 OpenAI 的 prompt_cache_key 字段(此前默认开启)。如果你的上游是按该字段路由前缀缓存的中转站或号池(如 workbuddy panel/hub 等),请打开开关恢复注入,否则流量可能被随机路由、频繁未命中缓存。", - "pckoff.hint": "开关在「配置」页快速配置里(promptCache.routing:disabled/auto/enabled),也可直接改 billion-context.json;直连官方 API 的用户可忽略此提示。", - "pckoff.dismiss_btn": "我知道了", - "pckoff.dismissed": "已关闭该提示", - "wmfast.on": "新功能提示:大上下文增量解析(增量压缩过渡功能 · 实验性)", - "wmfast.desc": "长会话每轮都要把整个历史重新发给代理解析一遍,现在改为增量解析:只解析本轮新增的那部分,优化长会话的解析性能(发给模型的内容不变;有任何疑点,当轮自动回退老路径并重新对齐)。当前版本对约 5% 的安装灰度开启,属实验性功能。", - "wmfast.hint": "开关在「配置」页快速配置(大上下文增量解析),也可在 billion-context.json 写 rollout.features.pluginFullResendWatermark: true/false,或设环境变量 BILI_ROLLOUT_PLUGIN_FULL_RESEND_WATERMARK=1/0。", - "wmfast.dismiss_btn": "我知道了", - "wmfast.dismissed": "已关闭该提示", + // #5548: banner copy now rides the notice records (src/notices.ts); only action words stay here. + "notices.dismiss_btn": "我知道了", + "notices.dismissed": "已关闭该提示", + "notices.list_title": "公告列表", "ses.title": "会话", "ses.sub": "覆盖内存与磁盘的全部会话 · 点击行查看详情、轨迹与交接文档", "ses.search_ph": "搜索标题、标签或 id…", @@ -1018,16 +1012,10 @@ export const MESSAGES: Record> = { "pck.on": "Cache routing key (prompt_cache_key) withheld", "pck.sessions": "Affected session(s): {ids}", "pck.hint": "This upstream rejected requests carrying prompt_cache_key (400 with the key, accepted without it), so bili withholds the key there until restart. If this is your relay/account pool, prefix-cache affinity may degrade for those sessions.", - "pckoff.on": "prompt_cache_key self-stamping is now off by default (upgrade notice)", - "pckoff.desc": "Since this version bili no longer adds OpenAI's prompt_cache_key field to requests on its own (previously on by default). If your upstream routes prefix cache by this key (relays such as workbuddy panel/hub, account pools), turn the switch back on — otherwise traffic may route randomly and miss the prefix cache.", - "pckoff.hint": "Switch: Configuration page → quick config (promptCache.routing: disabled/auto/enabled), or edit billion-context.json directly; direct official-API users can ignore this notice.", - "pckoff.dismiss_btn": "Got it", - "pckoff.dismissed": "Notice dismissed", - "wmfast.on": "New: incremental parsing for large contexts (incremental-compression bridge feature, experimental)", - "wmfast.desc": "Long conversations used to re-send their entire history for parsing on every turn. Now only the new part of each turn is parsed — faster parsing on long sessions (the request sent to the model is unchanged; any doubt falls back to the old path for that turn and re-aligns). This release rolls it out to roughly 5% of installs; it is marked experimental.", - "wmfast.hint": "Switch: Configuration page → quick config (incremental parsing for large contexts), or write rollout.features.pluginFullResendWatermark: true/false in billion-context.json, or set BILI_ROLLOUT_PLUGIN_FULL_RESEND_WATERMARK=1/0.", - "wmfast.dismiss_btn": "Got it", - "wmfast.dismissed": "Notice dismissed", + // #5548: banner copy now rides the notice records (src/notices.ts); only action words stay here. + "notices.dismiss_btn": "Got it", + "notices.dismissed": "Notice dismissed", + "notices.list_title": "Announcements", "ses.title": "Sessions", "ses.sub": "Every session across memory and disk — click a row for details, trajectory & handoff document", "ses.search_ph": "Search title, label or id…", diff --git a/src/web/page.ts b/src/web/page.ts index 52439b4fb6..9f53d671ea 100644 --- a/src/web/page.ts +++ b/src/web/page.ts @@ -40,8 +40,7 @@ export function renderPage(origin: string, version: string, embed = false, theme - - +
@@ -72,6 +71,7 @@ export function renderPage(origin: string, version: string, embed = false, theme
${zh("ov.recent")}${zh("ov.view_all")}
${zh("ses.th_title")}${zh("ses.th_client")}${zh("ses.th_proto")}${zh("ses.th_upstream")}${zh("ses.th_reqs")}${zh("ses.th_ctx")}${zh("ses.th_input")}${zh("ses.th_saved")}${zh("ses.th_hit")}${zh("ses.th_switches")}${zh("ses.th_folds")}${zh("ses.th_blocks")}${zh("ses.th_seen")}
+