diff --git a/tests/api-profile-usage.test.ts b/tests/api-profile-usage.test.ts index b5885e2..661a0ff 100644 --- a/tests/api-profile-usage.test.ts +++ b/tests/api-profile-usage.test.ts @@ -45,3 +45,13 @@ describe("forgetApiProfileUsage", () => { expect(forgetApiProfileUsage("missing")).toBe(false); }); }); + +describe("groups with no used model", () => { + it("shows nothing, so the settings page hides the whole group", () => { + recordApiProfileUsage("used"); + const members = [{ id: "unused-a" }, { id: "unused-b" }]; + expect(filterUsedApiProfiles(members, loadApiProfileUsage(), null)).toEqual( + [], + ); + }); +}); diff --git a/web/app.js b/web/app.js index faea6d5..192d434 100644 --- a/web/app.js +++ b/web/app.js @@ -23,17 +23,7 @@ import { isModuleOpeningWaiting, renderQuestionsCard, } from "./questions-ui.js"; -import { - applyColorTheme, - bumpUiFontScale, - getStoredColorTheme, - getStoredUiFontScale, - initColorTheme, - initUiFontScale, - themeById, - UI_FONT_SCALE_MAX, - UI_FONT_SCALE_MIN, -} from "./theme.js"; +import { initColorTheme, initUiFontScale } from "./theme.js"; import { applyMarkdownRender, initMarkdownRender, @@ -1366,29 +1356,6 @@ function syncMarkdownMenuUi() { }); } -function syncThemeMenuUi() { - const colorId = document.documentElement.getAttribute("data-color-theme") || getStoredColorTheme(); - const percent = getStoredUiFontScale(); - const colorMeta = themeById(colorId); - const sum = $("theme-menu-sum"); - if (sum) { - sum.title = `${colorMeta.name} · 字号 ${percent}`; - if (!sum.querySelector(".hamburger-icon")) { - sum.innerHTML = ``; - } - } - document.querySelectorAll("[data-color-theme].more-theme-item").forEach((btn) => { - btn.classList.toggle("is-active", btn.getAttribute("data-color-theme") === colorMeta.id); - }); - const valueEl = $("theme-font-scale-value"); - if (valueEl) valueEl.textContent = String(percent); - const minus = document.querySelector("[data-font-scale-bump='-1']"); - const plus = document.querySelector("[data-font-scale-bump='1']"); - if (minus) minus.disabled = percent <= UI_FONT_SCALE_MIN; - if (plus) plus.disabled = percent >= UI_FONT_SCALE_MAX; - syncMarkdownMenuUi(); -} - function stashComposerDraftFromDom() { if (skipComposerStash) { skipComposerStash = false; @@ -4598,26 +4565,6 @@ $("btn-save-instance")?.addEventListener("click", () => { void saveCurrentInstance(); }); -$("theme-menu")?.addEventListener("click", (e) => { - const menu = $("theme-menu"); - if (!menu) return; - const colorBtn = e.target.closest("[data-color-theme]"); - if (colorBtn && menu.contains(colorBtn)) { - e.preventDefault(); - applyColorTheme(colorBtn.getAttribute("data-color-theme")); - syncThemeMenuUi(); - menu.removeAttribute("open"); - return; - } - const bumpBtn = e.target.closest("[data-font-scale-bump]"); - if (bumpBtn && menu.contains(bumpBtn)) { - e.preventDefault(); - e.stopPropagation(); - bumpUiFontScale(bumpBtn.getAttribute("data-font-scale-bump")); - syncThemeMenuUi(); - } -}); - $("composer")?.addEventListener("click", (e) => { const menu = e.target.closest("#composer-more-menu"); if (!menu) return; @@ -4764,7 +4711,7 @@ async function init() { initUiFontScale(); initMarkdownRender(); initPlayAuxLlmBubbles(); - syncThemeMenuUi(); + syncMarkdownMenuUi(); try { await Promise.all([loadBooks(), loadPersonas(), loadApiProfiles()]); if (books.length) { diff --git a/web/index.html b/web/index.html index e335ef2..9b7fba5 100644 --- a/web/index.html +++ b/web/index.html @@ -42,6 +42,7 @@ 技能 库 Token + 预设 设置