From b279015193a5e1b00499d324c3ffe9711109ec1e Mon Sep 17 00:00:00 2001 From: Adeel Ahmad Date: Thu, 15 Oct 2026 10:20:46 +0000 Subject: [PATCH] feat(settings): fold the options most people leave as they are In the busiest sections the tuning numbers and long lists sit under a line that names them: the assistant's tools, defences against outside text, limits and prices; the decision model's server; search by meaning's tuning; the LLM's chat models and vision; the local model's threads and port; upload file types and pieces; document page sizes; video shot, OCR and face thresholds; the job queue and steps; IIIF's provider, layers and tokens; the voice model; and each speech provider, open when its key is set. A fold opens by itself when one of its fields has an error, and on the field Find or Ctrl+K found. The import page's Upload settings and a podcast's voice setup link open on the field they need. The clicks survey no longer counts controls a closed fold hides. The AI assistant no longer opens with 1 unsaved change: an unset Laya server read back as an empty address. Co-Authored-By: Claude Opus 5.5 (1M context) Claude-Session: https://claude.ai/code/session_012QHdEu9xFwnsCUnJn4yB3v --- ci/clicks/survey.mjs | 5 +- docs/configuration.md | 8 +- .../__tests__/settings-admin-models.test.ts | 5 + .../__tests__/settings-save.test.tsx | 36 ++ .../components/import/upload-tab.tsx | 2 +- .../components/podcasts/episode-page.tsx | 2 +- .../components/settings/bodies.tsx | 506 ++++++++++++------ nextjs-frontend/components/settings/model.ts | 1 + 8 files changed, 382 insertions(+), 183 deletions(-) diff --git a/ci/clicks/survey.mjs b/ci/clicks/survey.mjs index c866c8010..4bae8c1bc 100644 --- a/ci/clicks/survey.mjs +++ b/ci/clicks/survey.mjs @@ -82,8 +82,9 @@ async function surveyPages(page, base, phone) { page.evaluate(() => { const main = document.querySelector("main") || document.body; const seen = [...main.querySelectorAll("a[href], button, input, select, textarea, [role=tab], [role=switch], [role=radio]")]; - // the page's own controls: not the settings sections or tabs that lead to other pages - return seen.filter((el) => el.offsetParent !== null && !el.closest("[hidden], nav")).length; + // the page's own controls: not the settings sections or tabs that lead to other pages, nor what a closed fold + // (details) keeps out of sight, which Chromium still lays out + return seen.filter((el) => el.offsetParent !== null && !el.closest("[hidden], nav, details:not([open]) > :not(summary)")).length; }); const settle = () => page.waitForTimeout(1200); await page.goto(base + "/", { waitUntil: "domcontentloaded" }); diff --git a/docs/configuration.md b/docs/configuration.md index bf1a5c62f..0e90944f5 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -118,9 +118,11 @@ The sections are in groups: AI and search, Speech and voices, Media and document access, Files and devices, and System. **Find a setting** at the top of the list (or `/`) finds a section by its name or what it's for, and a single setting by its label, hint or choices: Enter opens the first, and a setting found by its label opens with its field in focus and its value selected, so typing replaces it. ⌘K (Ctrl+K) finds settings -the same way, beside recordings and pages. Agents reach the same settings through the API -(`GET/PUT /api/v1/settings/
`), and the admin assistant through `read_settings` and `change_settings` -([Assistant](assistant.md#setting-up-and-running-the-server-by-chat)). +the same way, beside recordings and pages. In a section, the options most people leave as they are (tuning numbers, +file types, the assistant's tool list, a provider not yet set up) are folded under a line that names them; a fold +opens by itself when one of its fields has an error, and Find opens it on the field it found. Agents reach the same +settings through the API (`GET/PUT /api/v1/settings/
`), and the admin assistant through `read_settings` and +`change_settings` ([Assistant](assistant.md#setting-up-and-running-the-server-by-chat)). ## Word search diff --git a/nextjs-frontend/__tests__/settings-admin-models.test.ts b/nextjs-frontend/__tests__/settings-admin-models.test.ts index 942b753d2..d6838d115 100644 --- a/nextjs-frontend/__tests__/settings-admin-models.test.ts +++ b/nextjs-frontend/__tests__/settings-admin-models.test.ts @@ -41,6 +41,11 @@ jest.mock("next-auth/react", () => ({ const spec = (id: string) => FIELDS.find((f) => fieldId(f) === id)!; describe("settings fields", () => { + it("reads back an unset Laya server as unset, so the AI assistant doesn't open with a change", () => { + const f = spec("decisions.laya_url"); + expect(parse(f, toUi(f, null))).toEqual({ value: null }); + }); + it("shows and parses values like the backend stores them", () => { expect(toUi(spec("server.session_hours"), 168)).toBe("7"); expect(parse(spec("server.session_hours"), "7")).toEqual({ value: 168 }); diff --git a/nextjs-frontend/__tests__/settings-save.test.tsx b/nextjs-frontend/__tests__/settings-save.test.tsx index d1cf35c56..236fca4fe 100644 --- a/nextjs-frontend/__tests__/settings-save.test.tsx +++ b/nextjs-frontend/__tests__/settings-save.test.tsx @@ -81,3 +81,39 @@ describe("opened on one setting", () => { expect(port.closest("[data-setting]")).toHaveClass("setting-found"); }); }); + +describe("options most people leave alone", () => { + const UPLOADS = { + uploads: { values: { max_mb: 2048, chunk_mb: 8, expire_hours: 24, extensions: [".mp3", ".wav"] } }, + } as unknown as SettingsView; + const uploads = (field?: string) => + render( + + + undefined} field={field} /> + + , + ); + + it("are folded under a line saying what's in them, the main one left in view", () => { + uploads(); + expect(screen.getByLabelText("Largest audio or video file (MB)").closest("details")).toBeNull(); + const fold = screen.getByLabelText("Piece size (MB)").closest("details")!; + expect(fold).not.toHaveAttribute("open"); + expect(fold.querySelector("summary")).toHaveTextContent("File types (2 of 20)"); + }); + + it("open by themselves when one has an error", () => { + uploads(); + const piece = screen.getByLabelText("Piece size (MB)"); + fireEvent.change(piece, { target: { value: "0" } }); + expect(piece.closest("details")).toHaveAttribute("open"); + }); + + it("open on the field Find or ⌘K found", async () => { + uploads("uploads.expire_hours"); + const hours = screen.getByLabelText("Keep unfinished uploads for (hours)"); + expect(hours.closest("details")).toHaveAttribute("open"); + await waitFor(() => expect(hours).toHaveFocus()); + }); +}); diff --git a/nextjs-frontend/components/import/upload-tab.tsx b/nextjs-frontend/components/import/upload-tab.tsx index 4063b531d..cedf8dccf 100644 --- a/nextjs-frontend/components/import/upload-tab.tsx +++ b/nextjs-frontend/components/import/upload-tab.tsx @@ -289,7 +289,7 @@ export function ProblemCard({ )} {mediaType && admin && ( )} {onKind && it.kind === "transcript" && canBeTranscript(it.file.name) && ( diff --git a/nextjs-frontend/components/podcasts/episode-page.tsx b/nextjs-frontend/components/podcasts/episode-page.tsx index 57f460b05..d596fa1ab 100644 --- a/nextjs-frontend/components/podcasts/episode-page.tsx +++ b/nextjs-frontend/components/podcasts/episode-page.tsx @@ -161,7 +161,7 @@ export function EpisodePage({ id }: { id: number }) { {ep.status === "script_only" && ( Text to speech isn’t set up, so there’s a script but no audio.{" "} - + Set it up in Settings , then remake it. diff --git a/nextjs-frontend/components/settings/bodies.tsx b/nextjs-frontend/components/settings/bodies.tsx index c0ae155c8..c8788edfc 100644 --- a/nextjs-frontend/components/settings/bodies.tsx +++ b/nextjs-frontend/components/settings/bodies.tsx @@ -33,6 +33,7 @@ import { AI_TOOLS, BACKUP_SCHEDULES, SPEECH_PROVIDERS, + UPLOAD_TYPES, type FieldSpec, type SectionId, type SettingsView, @@ -89,6 +90,31 @@ function F({ ); } +/** Options most people leave as they are, folded under a line that says what's in them. It opens by itself when one of + * `ids` has an error, so a save that fails shows the field; Find and ⌘K open it on the field they found. */ +function More({ + ctx, + ids, + title, + open, + children, +}: { + ctx: BodyCtx; + ids: string[]; + title: ReactNode; + /** Open to begin with (a provider already in use). */ + open?: boolean; + children: ReactNode; +}) { + const failed = ids.some((id) => Boolean(ctx.state(id).error)); + return ( +
+ {title} +
{children}
+
+ ); +} + function Sub({ children }: { children: ReactNode }) { return (

@@ -205,10 +231,12 @@ export function SectionBody({ ctx }: { ctx: BodyCtx }) {
-
- - -
+ +
+ + +
+
); case "analysis": @@ -251,30 +279,44 @@ export function SectionBody({ ctx }: { ctx: BodyCtx }) { return ( <> Shots and keyframes -
- - - - -
+ +
+ + + + +
+
Text on screen -
- - -
+ +
+ + +
+
Faces - -
- - - -
+ + +
+ + + +
+
@@ -318,13 +360,19 @@ export function SectionBody({ ctx }: { ctx: BodyCtx }) { case "workers": return ( <> -
- - - - -
- + + +
+ + + +
+ +

The number of built-in workers and their steps take effect when the server restarts. See which workers are alive in{" "} @@ -460,12 +508,18 @@ export function SectionBody({ ctx }: { ctx: BodyCtx }) { case "uploads": return ( <> -

- - - -
- + + +
+ + +
+ +

Uploads arrive in pieces and carry on where they stopped if the connection drops. Finished files are kept in the server’s data folder, under uploads. Transcript files have their own limit, under Access & @@ -476,13 +530,25 @@ export function SectionBody({ ctx }: { ctx: BodyCtx }) { case "documents": return ( <> -

- - - - -
- + +
+ + + + +
+ +
@@ -539,16 +605,22 @@ function LlmBody({ ctx }: { ctx: BodyCtx }) { hint={here?.key_url ? : undefined} focus={askKey} /> - - -
- - -
+ + +
+ + +
+ +
-
- - -
+
+ + +
+ +
+ + External viewers · “Open in” buttons + + {viewers.length ? ( +
    + {viewers.map((x, i) => ( +
  • + {x.name ?? "Viewer"} + {x.url} +
  • + ))} +
+ ) : ( +

None yet.

+ )} +
+ + Set in the server’s archive.yaml for now. +
+
+
+ + +
+
Access per namespace

@@ -3038,32 +3172,46 @@ function SpeechProvidersBody({ ctx }: { ctx: BodyCtx }) { Nothing is sent to these services until you pick one in Transcription, Speaker separation or the AI assistant’s Voice. Keys are stored encrypted. Change an address to use a proxy, an EU region or a compatible server.

- {SPEECH_PROVIDERS.map((p) => ( -
- {p.label} -

{p.about}

-
- - - {!("readsOnly" in p) && ( - <> - - - - )} + {SPEECH_PROVIDERS.map((p) => { + const keySet = Boolean(((view?.values?.[`${p.id}_api_key`] ?? {}) as { set?: boolean }).set); + return ( +
+ +

{p.label}

+ · {keySet ? "key set" : "not set up"} + + } + > +

{p.about}

+
+ + + {!("readsOnly" in p) && ( + <> + + + + )} +
+ ctx.state(`speech.${p.id}_api_key`).onChange(x)} + /> + +
- ctx.state(`speech.${p.id}_api_key`).onChange(x)} - /> - -
- ))} + ); + })}
@@ -3189,13 +3337,19 @@ function LocalModelBody({ ctx }: { ctx: BodyCtx }) { )} -
- - - - - -
+ +
+ + + + + +
+
{s && s.files.length > 0 && (
Downloaded diff --git a/nextjs-frontend/components/settings/model.ts b/nextjs-frontend/components/settings/model.ts index 1f380a66d..c2b5ab723 100644 --- a/nextjs-frontend/components/settings/model.ts +++ b/nextjs-frontend/components/settings/model.ts @@ -1856,6 +1856,7 @@ export const FIELDS: FieldSpec[] = [ label: "Laya server", kind: "text", mono: true, + nullable: true, placeholder: "http://host.docker.internal:8790/v1", hint: "Only when Lens runs where MLX can't, such as Docker on a Mac", },