DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.
Python ai-agentsai-tutorclawbotcli-tooldeepresearchinteractive-learninglearningmulti-agent-systemsrag
feat(settings): Models/Chat/Agents categories scroll in one page
Bingxi Zhao (Frank)a2f124a60d3c
diff --git a/web/app/(utility)/settings/agents/page.tsx b/web/app/(utility)/settings/agents/page.tsxindex ba2788062..b54f8646f 100644--- a/web/app/(utility)/settings/agents/page.tsx+++ b/web/app/(utility)/settings/agents/page.tsx@@ -1,18 +1,32 @@"use client";-import { useEffect } from "react";-import { useRouter } from "next/navigation";+import { CategoryScroll } from "@/components/settings/CategoryScroll";++import ClaudeCodeAgentSettingsPage from "./claude-code/page";+import CodexAgentSettingsPage from "./codex/page";+import GeminiAgentSettingsPage from "./gemini/page";+import AntigravityAgentSettingsPage from "./antigravity/page";+import KimiAgentSettingsPage from "./kimi/page";+import OpencodeAgentSettingsPage from "./opencode/page";+import MimoAgentSettingsPage from "./mimo/page";/**- * Former sub-hub. The settings navigator lists these pages directly now, so a- * grid that only repeated those links was a click with nothing behind it.- * Kept as a redirect because the route is bookmarkable and was linked from- * the old breadcrumb.+ * The Partners & Agents category, in full — see `ModelsSettingsPage` for the+ * pattern. All seven leaves persist to the same `subagent.json`, so this was+ * already one shared draft behind nine separate routes.*/-export default function RedirectToFirstLeaf() {- const router = useRouter();- useEffect(() => {- router.replace("/settings/agents/claude-code");- }, [router]);- return null;+export default function AgentsSettingsPage() {+ return (+ <CategoryScroll+ sections={[+ { key: "agent-claude-code", Component: ClaudeCodeAgentSettingsPage },+ { key: "agent-codex", Component: CodexAgentSettingsPage },+ { key: "agent-gemini", Component: GeminiAgentSettingsPage },+ { key: "agent-antigravity", Component: AntigravityAgentSettingsPage },+ { key: "agent-kimi", Component: KimiAgentSettingsPage },+ { key: "agent-opencode", Component: OpencodeAgentSettingsPage },+ { key: "agent-mimo", Component: MimoAgentSettingsPage },+ ]}+ />+ );}diff --git a/web/app/(utility)/settings/chat/page.tsx b/web/app/(utility)/settings/chat/page.tsxindex 98270be04..922b3615f 100644--- a/web/app/(utility)/settings/chat/page.tsx+++ b/web/app/(utility)/settings/chat/page.tsx@@ -1,18 +1,24 @@"use client";-import { useEffect } from "react";-import { useRouter } from "next/navigation";+import { CategoryScroll } from "@/components/settings/CategoryScroll";++import ToolsSettingsPage from "../tools/page";+import CapabilitiesSettingsPage from "../capabilities/page";+import StarterSettingsPage from "../starters/page";+import AttachmentSettingsPage from "../attachments/page";/**- * Former sub-hub. The settings navigator lists these pages directly now, so a- * grid that only repeated those links was a click with nothing behind it.- * Kept as a redirect because the route is bookmarkable and was linked from- * the old breadcrumb.+ * The Chat category, in full — see `ModelsSettingsPage` for the pattern.*/-export default function RedirectToFirstLeaf() {- const router = useRouter();- useEffect(() => {- router.replace("/settings/tools");- }, [router]);- return null;+export default function ChatSettingsPage() {+ return (+ <CategoryScroll+ sections={[+ { key: "tools", Component: ToolsSettingsPage },+ { key: "capabilities", Component: CapabilitiesSettingsPage },+ { key: "starters", Component: StarterSettingsPage },+ { key: "attachments", Component: AttachmentSettingsPage },+ ]}+ />+ );}diff --git a/web/app/(utility)/settings/models/page.tsx b/web/app/(utility)/settings/models/page.tsxindex 25e4ace7d..e420bf6be 100644--- a/web/app/(utility)/settings/models/page.tsx+++ b/web/app/(utility)/settings/models/page.tsx@@ -1,18 +1,37 @@"use client";-import { useEffect } from "react";-import { useRouter } from "next/navigation";+import { CategoryScroll } from "@/components/settings/CategoryScroll";++import ConnectionsSettingsPage from "../connections/page";+import LlmSettingsPage from "../llm/page";+import TaskModelsSettingsPage from "../task-models/page";+import EmbeddingSettingsPage from "../embedding/page";+import SearchSettingsPage from "../search/page";+import TtsSettingsPage from "../tts/page";+import SttSettingsPage from "../stt/page";+import ImageGenSettingsPage from "../image/page";+import VideoGenSettingsPage from "../video/page";/**- * Former sub-hub. The settings navigator lists these pages directly now, so a- * grid that only repeated those links was a click with nothing behind it.- * Kept as a redirect because the route is bookmarkable and was linked from- * the old breadcrumb.+ * The Models category, in full: every service profile page stacked into one+ * scroll instead of nine routes. `SettingsNav` links each leaf here as+ * `#anchor` rather than a route change, so switching services never remounts+ * this page — see `CategoryScroll`.*/-export default function RedirectToFirstLeaf() {- const router = useRouter();- useEffect(() => {- router.replace("/settings/connections");- }, [router]);- return null;+export default function ModelsSettingsPage() {+ return (+ <CategoryScroll+ sections={[+ { key: "connections", Component: ConnectionsSettingsPage },+ { key: "llm", Component: LlmSettingsPage },+ { key: "task-models", Component: TaskModelsSettingsPage },+ { key: "embedding", Component: EmbeddingSettingsPage },+ { key: "search", Component: SearchSettingsPage },+ { key: "tts", Component: TtsSettingsPage },+ { key: "stt", Component: SttSettingsPage },+ { key: "imagegen", Component: ImageGenSettingsPage },+ { key: "videogen", Component: VideoGenSettingsPage },+ ]}+ />+ );}diff --git a/web/app/(utility)/settings/starters/page.tsx b/web/app/(utility)/settings/starters/page.tsxindex 817a2c983..8b385f6f6 100644--- a/web/app/(utility)/settings/starters/page.tsx+++ b/web/app/(utility)/settings/starters/page.tsx@@ -180,7 +180,7 @@ export default function StarterSettingsPage() {<p className="mt-5 text-[11.5px] leading-relaxed text-[var(--muted-foreground)]">{t("These lines are written by the active model unless you pin one.")}{" "}<Link- href="/settings/task-models"+ href="/settings/models#task-models"className="inline-flex items-center gap-1 text-[var(--foreground)] underline-offset-2 hover:underline">{t("Task models")}diff --git a/web/components/settings/CategoryScroll.tsx b/web/components/settings/CategoryScroll.tsxnew file mode 100644index 000000000..5283ba51c--- /dev/null+++ b/web/components/settings/CategoryScroll.tsx@@ -0,0 +1,100 @@+"use client";++import { useEffect, useRef } from "react";++import { useSettings } from "./SettingsContext";++export type CategorySection = {+ key: string;+ Component: React.ComponentType;+};++/**+ * The content side of a merged settings category (Models, Chat, Partners &+ * Agents): every leaf's page component stacked in one scrollable document+ * instead of one route per leaf, so browsing the whole category is a scroll+ * instead of N page loads.+ *+ * Scroll position is the source of truth for "which leaf is active" — not+ * `IntersectionObserver`, which does not reliably fire in every render+ * surface this app runs in (see the immersive-reading capability). A rect+ * check on the ancestor scroll container (`[data-settings-scroll]`, from+ * `SettingsMain`) is cheap enough to run on every scroll tick.+ */+export function CategoryScroll({ sections }: { sections: CategorySection[] }) {+ const { setActiveSection } = useSettings();+ const rootRef = useRef<HTMLDivElement>(null);++ // One-time: jump to the hash anchor (if any) once the section list has+ // painted, and tell the nav which leaf is on screen.+ useEffect(() => {+ const requested = window.location.hash.replace(/^#/, "");+ const initial =+ sections.find((s) => s.key === requested)?.key ??+ sections[0]?.key ??+ null;+ setActiveSection(initial);+ if (requested && requested !== sections[0]?.key) {+ requestAnimationFrame(() => {+ document+ .getElementById(requested)+ ?.scrollIntoView({ behavior: "auto", block: "start" });+ });+ }+ return () => setActiveSection(null);+ // Anchor handling only matters on mount — re-running it on every+ // `sections` identity change would re-jump the scroll position.+ // eslint-disable-next-line react-hooks/exhaustive-deps+ }, []);++ useEffect(() => {+ const root = rootRef.current?.closest<HTMLElement>(+ "[data-settings-scroll]",+ );+ if (!root) return;++ let ticking = false;+ const measure = () => {+ ticking = false;+ const threshold = root.getBoundingClientRect().top + 96;+ let current = sections[0]?.key ?? null;+ for (const { key } of sections) {+ const el = document.getElementById(key);+ if (el && el.getBoundingClientRect().top <= threshold) current = key;+ }+ setActiveSection(current);+ if (current && window.location.hash !== `#${current}`) {+ window.history.replaceState(+ null,+ "",+ `${window.location.pathname}#${current}`,+ );+ }+ };+ const onScroll = () => {+ if (ticking) return;+ ticking = true;+ requestAnimationFrame(measure);+ };+ root.addEventListener("scroll", onScroll, { passive: true });+ return () => root.removeEventListener("scroll", onScroll);+ }, [sections, setActiveSection]);++ return (+ <div ref={rootRef}>+ {sections.map(({ key, Component }, index) => (+ <section+ key={key}+ id={key}+ className={+ index === 0+ ? "scroll-mt-16"+ : "mt-12 scroll-mt-16 border-t border-[var(--border)]/60 pt-12"+ }+ >+ <Component />+ </section>+ ))}+ </div>+ );+}diff --git a/web/components/settings/ConnectionsEditor.tsx b/web/components/settings/ConnectionsEditor.tsxindex 3958aa8ed..3a4e2cef7 100644--- a/web/components/settings/ConnectionsEditor.tsx+++ b/web/components/settings/ConnectionsEditor.tsx@@ -52,14 +52,14 @@ const SERVICE_LABEL: Record<ServiceName, { en: string; zh: string }> = {};const SERVICE_HREF: Record<ServiceName, string> = {- llm: "/settings/llm",- task: "/settings/task-models",- embedding: "/settings/embedding",- search: "/settings/search",- tts: "/settings/tts",- stt: "/settings/stt",- imagegen: "/settings/image",- videogen: "/settings/video",+ llm: "/settings/models#llm",+ task: "/settings/models#task-models",+ embedding: "/settings/models#embedding",+ search: "/settings/models#search",+ tts: "/settings/models#tts",+ stt: "/settings/models#stt",+ imagegen: "/settings/models#imagegen",+ videogen: "/settings/models#videogen",};type ServiceLink = { service: ServiceName; profileId: string };diff --git a/web/components/settings/ServiceConfigEditor.tsx b/web/components/settings/ServiceConfigEditor.tsxindex ee8cd6924..e121209ea 100644--- a/web/components/settings/ServiceConfigEditor.tsx+++ b/web/components/settings/ServiceConfigEditor.tsx@@ -1354,7 +1354,7 @@ function ProfileFields({</span><span className="flex items-center gap-3"><Link- href="/settings/connections"+ href="/settings/models#connections"className="inline-flex items-center gap-1 text-[11.5px] text-[var(--muted-foreground)] transition-colors hover:text-[var(--foreground)]">{t("Edit connection")}diff --git a/web/components/settings/SettingsContext.tsx b/web/components/settings/SettingsContext.tsxindex 31e2bdbbc..fdf41d63b 100644--- a/web/components/settings/SettingsContext.tsx+++ b/web/components/settings/SettingsContext.tsx@@ -654,6 +654,12 @@ type SettingsContextValue = {advanceTour: () => void;goBackTour: () => void;skipTour: () => void;++ // Which leaf is on screen inside a merged category page (models / chat /+ // agents). Null outside of one — the nav falls back to plain pathname+ // matching for every other route.+ activeSection: string | null;+ setActiveSection: (key: string | null) => void;};const SettingsContext = createContext<SettingsContextValue | null>(null);@@ -726,6 +732,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) {const [embeddingCapabilities, setEmbeddingCapabilities] =useState<EmbeddingCapabilities | null>(null);const [tourStepIndex, setTourStepIndex] = useState(-1);+ const [activeSection, setActiveSection] = useState<string | null>(null);const eventSourceRef = useRef<EventSource | null>(null);// Extensions register their latest dirty/save on each render. Keep the// derived dirty state explicit instead of using an indirect version counter.@@ -1890,8 +1897,11 @@ export function SettingsProvider({ children }: { children: ReactNode }) {advanceTour,goBackTour,skipTour,+ activeSection,+ setActiveSection,}),[+ activeSection,addModel,addProfile,applyDetectedContextWindow,@@ -1931,6 +1941,7 @@ export function SettingsProvider({ children }: { children: ReactNode }) {runDetailedTest,saveDraft,saving,+ setActiveSection,settingsError,loadSettings,settingsLoading,diff --git a/web/components/settings/SettingsMain.tsx b/web/components/settings/SettingsMain.tsxindex 77a1507d7..3c9f4b23f 100644--- a/web/components/settings/SettingsMain.tsx+++ b/web/components/settings/SettingsMain.tsx@@ -43,7 +43,10 @@ export default function SettingsMain({outer flex column, so the left column stays put while the right sidescrolls. ``min-h-0`` is required for the flex child to constrain toremaining space — without it, ``overflow-y-auto`` would never clip. */}- <div className="min-h-0 flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]">+ <div+ data-settings-scroll+ className="min-h-0 flex-1 overflow-y-auto overflow-x-hidden [scrollbar-gutter:stable]"+ ><div className="w-full max-w-3xl px-8 pb-16 pt-2">{children}</div></div></div>diff --git a/web/components/settings/SettingsNav.tsx b/web/components/settings/SettingsNav.tsxindex efc32f061..393cafbc0 100644--- a/web/components/settings/SettingsNav.tsx+++ b/web/components/settings/SettingsNav.tsx@@ -5,6 +5,7 @@ import Link from "next/link";import { usePathname, useRouter } from "next/navigation";import {ChevronDown,+ ChevronRight,LayoutGrid,Search,X,@@ -21,6 +22,41 @@ import {} from "@/lib/settings-nav";import { serviceReadiness, useSettings } from "./SettingsContext";+/**+ * Same-page anchor vs. a real route change. A merged category's children+ * point at `${categoryHref}#${key}` — if we are already on that category+ * page, clicking one is a scroll, not a navigation; History's own+ * `pushState` is enough and `router.push` would be a same-URL no-op anyway.+ * Coming from anywhere else, it is a normal route change, and the category+ * page's own mount effect (`CategoryScroll`) scrolls to the hash once it+ * lands.+ */+function goToLeaf(+ href: string,+ pathname: string,+ router: ReturnType<typeof useRouter>,+ setActiveSection: (key: string | null) => void,+): boolean {+ const hashIndex = href.indexOf("#");+ if (hashIndex === -1) {+ router.push(href);+ return false;+ }+ const base = href.slice(0, hashIndex);+ const key = href.slice(hashIndex + 1);+ if (base !== pathname) {+ router.push(href);+ return false;+ }+ document.getElementById(key)?.scrollIntoView({+ behavior: "smooth",+ block: "start",+ });+ window.history.replaceState(null, "", href);+ setActiveSection(key);+ return true;+}+/*** The settings navigator — one persistent column, every page one click away.*@@ -41,6 +77,8 @@ type Row = { leaf: SettingsLeaf; category: Lang };type Group = {key: string;label: Lang;+ href: string;+ icon: LucideIcon;rows: Row[];standalone: boolean;};@@ -56,6 +94,8 @@ function useGroups(hideAdminOnly: boolean): Group[] {SETTINGS_CATEGORIES.map((category) => ({key: category.key,label: category.label,+ href: category.href,+ icon: category.icon,rows: (category.children ?? [{@@ -106,13 +146,17 @@ export function SettingsNavCompact() {const zh = i18n.language?.toLowerCase().startsWith("zh");const tr = (value: Lang) => (zh ? value.zh : value.en);const groups = useGroups(useHideAdminOnly());+ const { activeSection, setActiveSection } = useSettings();+ const currentValue = activeSection ? `${pathname}#${activeSection}` : pathname;return (<div className="relative md:hidden"><select- value={pathname}+ value={currentValue}aria-label={t("Settings sections")}- onChange={(event) => router.push(event.target.value)}+ onChange={(event) =>+ goToLeaf(event.target.value, pathname, router, setActiveSection)+ }className="w-full appearance-none rounded-lg border border-[var(--border)] bg-[var(--background)] py-2 pl-3 pr-8 text-[13px] font-medium text-[var(--foreground)] outline-none"><option value={SETTINGS_HUB_HREF}>{t("Overview")}</option>@@ -139,10 +183,12 @@ export function SettingsNavCompact() {export default function SettingsNav() {const pathname = usePathname() ?? "";+ const router = useRouter();const { t, i18n } = useTranslation();const zh = i18n.language?.toLowerCase().startsWith("zh");const tr = useCallback((value: Lang) => (zh ? value.zh : value.en), [zh]);- const { catalog, catalogEditable, diagnosticsResults } = useSettings();+ const { catalog, catalogEditable, diagnosticsResults, activeSection, setActiveSection } =+ useSettings();const [query, setQuery] = useState("");const groups = useGroups(useHideAdminOnly());@@ -172,6 +218,19 @@ export default function SettingsNav() {[catalog, catalogEditable, diagnosticsResults],);+ // A category page opens with its own children already visible, and a+ // search match forces every matching group open regardless of state —+ // otherwise the row you searched for could be hidden behind a collapse.+ const [manualExpanded, setManualExpanded] = useState<Record<string, boolean>>(+ {},+ );+ const isExpanded = useCallback(+ (group: Group) =>+ manualExpanded[group.key] ??+ (pathname === group.href || (needle !== "" && group.rows.length > 0)),+ [manualExpanded, pathname, needle],+ );+return (<navaria-label={t("Settings sections")}@@ -212,33 +271,123 @@ export default function SettingsNav() {</p>)}- {visible.map((group) => (- <div key={group.key} className="mt-3.5 first:mt-3">- {!group.standalone && (- <div className="px-2.5 pb-1 text-[11.5px] font-normal text-[var(--muted-foreground)]/60">- {tr(group.label)}- </div>- )}- <div className="space-y-px">- {group.rows.map(({ leaf }, index) => (- <Row- key={leaf.key}- href={leaf.href}- label={tr(leaf.label)}- icon={leaf.icon}- active={pathname === leaf.href}- failing={failing(leaf)}- hint={tr(leaf.blurb)}- tourId={index === 0 ? `tour-nav-${group.key}` : undefined}- />- ))}+ {visible.map((group) =>+ group.standalone ? (+ <div key={group.key} className="mt-3.5 first:mt-3">+ <Row+ href={group.rows[0]!.leaf.href}+ label={tr(group.rows[0]!.leaf.label)}+ icon={group.rows[0]!.leaf.icon}+ active={pathname === group.rows[0]!.leaf.href}+ failing={failing(group.rows[0]!.leaf)}+ hint={tr(group.rows[0]!.leaf.blurb)}+ tourId={`tour-nav-${group.key}`}+ />+ </div>+ ) : (+ <div key={group.key} className="mt-3.5 first:mt-3">+ <CategoryHeaderRow+ href={group.href}+ label={tr(group.label)}+ icon={group.icon}+ active={pathname === group.href}+ expanded={isExpanded(group)}+ onToggle={() =>+ setManualExpanded((prev) => ({+ ...prev,+ [group.key]: !isExpanded(group),+ }))+ }+ tourId={`tour-nav-${group.key}`}+ />+ {isExpanded(group) && (+ <div className="mt-0.5 space-y-px pl-4">+ {group.rows.map(({ leaf }) => (+ <Row+ key={leaf.key}+ href={leaf.href}+ label={tr(leaf.label)}+ icon={leaf.icon}+ active={pathname === group.href && activeSection === leaf.key}+ failing={failing(leaf)}+ hint={tr(leaf.blurb)}+ onClick={(event) => {+ if (+ goToLeaf(leaf.href, pathname, router, setActiveSection)+ ) {+ event.preventDefault();+ }+ }}+ />+ ))}+ </div>+ )}</div>- </div>- ))}+ ),+ )}</nav>);}+/**+ * A category with children, promoted to the same tier as a single-leaf+ * category (Appearance, Network, …) rather than a smaller, unclickable label+ * above them — it links to the merged page, and a separate chevron button+ * (a sibling, not nested in the link, since a button cannot nest inside an+ * anchor) collapses the list of leaves under it.+ */+function CategoryHeaderRow({+ href,+ label,+ icon: Icon,+ active,+ expanded,+ onToggle,+ tourId,+}: {+ href: string;+ label: string;+ icon: LucideIcon;+ active: boolean;+ expanded: boolean;+ onToggle: () => void;+ tourId?: string;+}) {+ const { t } = useTranslation();+ return (+ <div className="flex items-center gap-0.5">+ <Link+ href={href}+ data-tour={tourId}+ aria-current={active ? "page" : undefined}+ className={`flex min-w-0 flex-1 items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] leading-tight transition-colors ${+ active+ ? "bg-[var(--accent)] font-medium text-[var(--foreground)]"+ : "text-[var(--foreground)]/70 hover:bg-[var(--accent)]/50 hover:text-[var(--foreground)]"+ }`}+ >+ <Icon size={15} className={`shrink-0 ${active ? "" : "opacity-70"}`} />+ <span className="min-w-0 flex-1 truncate">{label}</span>+ </Link>+ <button+ type="button"+ onClick={(event) => {+ event.preventDefault();+ event.stopPropagation();+ onToggle();+ }}+ aria-label={expanded ? t("Collapse") : t("Expand")}+ aria-expanded={expanded}+ className="shrink-0 rounded-lg p-1.5 text-[var(--muted-foreground)]/60 transition-colors hover:bg-[var(--accent)]/50 hover:text-[var(--foreground)]"+ >+ <ChevronRight+ className={`h-3.5 w-3.5 transition-transform ${expanded ? "rotate-90" : ""}`}+ />+ </button>+ </div>+ );+}+/*** One row, in the app sidebar's language rather than an invented one: the same* icon + label pairing, radius, padding and accent-tinted active state that@@ -254,6 +403,7 @@ function Row({failing,hint,tourId,+ onClick,}: {href: string;label: string;@@ -264,12 +414,16 @@ function Row({hint?: string;/** Only the first row of a group carries it, so the tour lands on the group. */tourId?: string;+ /** A merged-category leaf intercepts the click to scroll in place instead+ * of navigating, when it is already the page on screen. */+ onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;}) {return (<Linkhref={href}data-tour={tourId}title={hint}+ onClick={onClick}aria-current={active ? "page" : undefined}className={`flex items-center gap-2.5 rounded-lg px-2.5 py-1.5 text-[13px] leading-tight transition-colors ${activediff --git a/web/components/settings/SettingsOverview.tsx b/web/components/settings/SettingsOverview.tsxindex 7818ce272..5a0314e73 100644--- a/web/components/settings/SettingsOverview.tsx+++ b/web/components/settings/SettingsOverview.tsx@@ -82,7 +82,7 @@ export default function SettingsOverview() {draftState === "saved"? t("A saved draft is waiting to be applied."): t("There are changes you have not saved anywhere yet."),- href: "/settings/llm",+ href: "/settings/models#llm",label: t("Review"),});}diff --git a/web/components/settings/SettingsToolbar.tsx b/web/components/settings/SettingsToolbar.tsxindex ad0af7dcf..f213cad3f 100644--- a/web/components/settings/SettingsToolbar.tsx+++ b/web/components/settings/SettingsToolbar.tsx@@ -25,7 +25,6 @@ import { useSettings } from "./SettingsContext";export function SettingsToolbar() {const { t } = useTranslation();const pathname = usePathname() ?? "";- const storagePath = storagePathFor(pathname);const {catalogEditable,draftState,@@ -36,7 +35,9 @@ export function SettingsToolbar() {discardDraft,startTour,toast,+ activeSection,} = useSettings();+ const storagePath = storagePathFor(pathname, activeSection);const busy = saving || applying;const canApply = draftState !== "clean";diff --git a/web/components/settings/TaskModelsEditor.tsx b/web/components/settings/TaskModelsEditor.tsxindex d61b1a23e..93ab534ed 100644--- a/web/components/settings/TaskModelsEditor.tsx+++ b/web/components/settings/TaskModelsEditor.tsx@@ -116,7 +116,7 @@ export function TaskModelsEditor() {<span>{t("No language model is configured yet.")}</span>)}<Link- href="/settings/llm"+ href="/settings/models#llm"className="inline-flex items-center gap-0.5 underline-offset-2 hover:text-[var(--foreground)] hover:underline">{t("LLM")}diff --git a/web/lib/knowledge-helpers.ts b/web/lib/knowledge-helpers.tsindex b1d15cf7d..9c6915e0a 100644--- a/web/lib/knowledge-helpers.ts+++ b/web/lib/knowledge-helpers.ts@@ -311,7 +311,7 @@ export const resolveKnowledgeIndexFailure = (retryable: progress?.retryable ?? storedProgress?.retryable,requiresModelChange: requiresEmbeddingChange || requiresCompletionChange,settingsHref: requiresEmbeddingChange- ? "/settings/embedding"+ ? "/settings/models#embedding": requiresCompletionChange? "/settings/models": undefined,diff --git a/web/lib/settings-nav.ts b/web/lib/settings-nav.tsindex b2538f098..8dd18c307 100644--- a/web/lib/settings-nav.ts+++ b/web/lib/settings-nav.ts@@ -80,7 +80,7 @@ export interface SettingsCategory {const MODEL_CHILDREN: SettingsLeaf[] = [{key: "connections",- href: "/settings/connections",+ href: "/settings/models#connections",label: { zh: "连接", en: "Connections" },blurb: {zh: "一份凭据供给多个服务。",@@ -91,7 +91,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "llm",- href: "/settings/llm",+ href: "/settings/models#llm",label: { zh: "LLM", en: "LLM" },blurb: {zh: "语言模型供应商与当前档位。",@@ -103,7 +103,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "task-models",- href: "/settings/task-models",+ href: "/settings/models#task-models",label: { zh: "任务模型", en: "Task models" },blurb: {zh: "DeepTutor 自己发起的调用使用的模型。",@@ -114,7 +114,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "embedding",- href: "/settings/embedding",+ href: "/settings/models#embedding",label: { zh: "嵌入模型", en: "Embedding" },blurb: {zh: "向量模型供应商与维度。",@@ -126,7 +126,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "search",- href: "/settings/search",+ href: "/settings/models#search",label: { zh: "搜索", en: "Search" },blurb: { zh: "联网搜索供应商。", en: "Web search providers." },icon: Search,@@ -135,7 +135,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "tts",- href: "/settings/tts",+ href: "/settings/models#tts",label: { zh: "语音合成", en: "Text-to-Speech" },blurb: {zh: "朗读助手回复的 TTS 供应商。",@@ -147,7 +147,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "stt",- href: "/settings/stt",+ href: "/settings/models#stt",label: { zh: "语音识别", en: "Speech-to-Text" },blurb: {zh: "转写麦克风录音的 STT 供应商。",@@ -159,7 +159,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "imagegen",- href: "/settings/image",+ href: "/settings/models#imagegen",label: { zh: "文生图", en: "Image Generation" },blurb: {zh: "chat imagegen 工具使用的文生图模型。",@@ -171,7 +171,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [},{key: "videogen",- href: "/settings/video",+ href: "/settings/models#videogen",label: { zh: "文生视频", en: "Video Generation" },blurb: {zh: "chat videogen 工具使用的文生视频模型。",@@ -186,7 +186,7 @@ const MODEL_CHILDREN: SettingsLeaf[] = [const CHAT_CHILDREN: SettingsLeaf[] = [{key: "tools",- href: "/settings/tools",+ href: "/settings/chat#tools",label: { zh: "工具", en: "Tools" },blurb: {zh: "对话智能体可调用的内置工具。",@@ -197,7 +197,7 @@ const CHAT_CHILDREN: SettingsLeaf[] = [},{key: "capabilities",- href: "/settings/capabilities",+ href: "/settings/chat#capabilities",label: { zh: "能力", en: "Capabilities" },blurb: {zh: "各能力的 LLM 参数与运行时旋钮。",@@ -208,7 +208,7 @@ const CHAT_CHILDREN: SettingsLeaf[] = [},{key: "starters",- href: "/settings/starters",+ href: "/settings/chat#starters",label: { zh: "起始建议", en: "Starting points" },blurb: {zh: "主页输入框下方那三行引导的素材范围。",@@ -219,7 +219,7 @@ const CHAT_CHILDREN: SettingsLeaf[] = [},{key: "attachments",- href: "/settings/attachments",+ href: "/settings/chat#attachments",label: { zh: "附件", en: "Attachments" },blurb: {zh: "聊天附件的大小上限与文本提取预算。",@@ -234,7 +234,7 @@ const CHAT_CHILDREN: SettingsLeaf[] = [const AGENT_CHILDREN: SettingsLeaf[] = [{key: "agent-claude-code",- href: "/settings/agents/claude-code",+ href: "/settings/agents#agent-claude-code",label: { zh: "Claude Code", en: "Claude Code" },blurb: {zh: "DeepTutor 调用本机 Claude Code 时的模型、推理强度与运行参数。",@@ -247,7 +247,7 @@ const AGENT_CHILDREN: SettingsLeaf[] = [},{key: "agent-codex",- href: "/settings/agents/codex",+ href: "/settings/agents#agent-codex",label: { zh: "Codex", en: "Codex" },blurb: {zh: "DeepTutor 调用本机 Codex 时的模型、推理强度与运行参数。",@@ -259,7 +259,7 @@ const AGENT_CHILDREN: SettingsLeaf[] = [},{key: "agent-gemini",- href: "/settings/agents/gemini",+ href: "/settings/agents#agent-gemini",label: { zh: "Gemini CLI", en: "Gemini CLI" },blurb: {zh: "DeepTutor 调用本机 Gemini CLI 时的模型与运行参数。",@@ -274,7 +274,7 @@ const AGENT_CHILDREN: SettingsLeaf[] = [// page — but missing from this list, so the page was reachable only by// typing the URL. Gemini CLI is retired and this is what replaced it.key: "agent-antigravity",- href: "/settings/agents/antigravity",+ href: "/settings/agents#agent-antigravity",label: { zh: "Antigravity CLI", en: "Antigravity CLI" },blurb: {zh: "DeepTutor 调用本机 Antigravity CLI 时的模型与运行参数。",@@ -286,7 +286,7 @@ const AGENT_CHILDREN: SettingsLeaf[] = [},{key: "agent-kimi",- href: "/settings/agents/kimi",+ href: "/settings/agents#agent-kimi",label: { zh: "Kimi CLI", en: "Kimi CLI" },blurb: {zh: "DeepTutor 调用本机 Kimi CLI 时的模型与运行参数。",@@ -298,7 +298,7 @@ const AGENT_CHILDREN: SettingsLeaf[] = [},{key: "agent-opencode",- href: "/settings/agents/opencode",+ href: "/settings/agents#agent-opencode",label: { zh: "opencode", en: "opencode" },blurb: {zh: "DeepTutor 调用本机 opencode 时的模型、推理强度与运行参数。",@@ -310,7 +310,7 @@ const AGENT_CHILDREN: SettingsLeaf[] = [},{key: "agent-mimo",- href: "/settings/agents/mimo",+ href: "/settings/agents#agent-mimo",label: { zh: "MiMo Code", en: "MiMo Code" },blurb: {zh: "DeepTutor 调用本机 MiMo Code 时的模型、推理强度与运行参数。",@@ -395,43 +395,60 @@ export const SETTINGS_CATEGORIES: SettingsCategory[] = [export const SETTINGS_HUB_HREF = "/settings";const HUB_LABEL: Lang = { zh: "设置", en: "Settings" };-/** Routes that are pure navigation (hub + sub-hubs) — no Save/Apply toolbar. */-const NAV_ONLY_ROUTES = new Set<string>([- SETTINGS_HUB_HREF,- ...SETTINGS_CATEGORIES.filter((c) => c.children).map((c) => c.href),-]);+/** Routes that are pure navigation (the hub) — no Save/Apply toolbar. */+const NAV_ONLY_ROUTES = new Set<string>([SETTINGS_HUB_HREF]);export function isNavOnlyRoute(pathname: string): boolean {return NAV_ONLY_ROUTES.has(pathname);}+/**+ * Categories rendered as one continuously-scrolling page (Models, Chat,+ * Partners & Agents) rather than a route per leaf. Their children's `href`+ * points at `${category.href}#${leaf.key}` — a same-page anchor, not a route+ * change — so switching between them never remounts the page.+ */+export const MERGED_CATEGORY_HREFS = new Set(+ SETTINGS_CATEGORIES.filter((c) => c.children).map((c) => c.href),+);+// The on-disk file (under data/user/settings/) each leaf module persists to.// Surfaced in the toolbar status line so every page says where its parameters-// live, without duplicating the string on each page.+// live, without duplicating the string on each page. Singleton pages (no+// merged category) are keyed by pathname; leaves inside a merged category+// page share one pathname, so those are keyed by `leaf.key` instead and+// looked up via the currently scrolled-to section (see `storagePathFor`).const STORAGE_PATHS: Record<string, string> = {"/settings/appearance": "data/user/settings/interface.json","/settings/network": "data/user/settings/system.json",- "/settings/llm": "data/user/settings/model_catalog.json",- "/settings/embedding": "data/user/settings/model_catalog.json",- "/settings/search": "data/user/settings/model_catalog.json",- "/settings/tts": "data/user/settings/model_catalog.json",- "/settings/stt": "data/user/settings/model_catalog.json",- "/settings/image": "data/user/settings/model_catalog.json",- "/settings/video": "data/user/settings/model_catalog.json","/settings/document-parsing": "data/user/settings/document_parsing.json",- "/settings/tools": "data/user/settings/interface.json",- "/settings/attachments": "data/user/settings/system.json",- "/settings/capabilities": "data/user/settings/main.yaml · agents.yaml","/settings/memory": "data/user/settings/main.yaml",- "/settings/agents/claude-code": "data/user/settings/subagent.json",- "/settings/agents/codex": "data/user/settings/subagent.json",- "/settings/agents/gemini": "data/user/settings/subagent.json",- "/settings/agents/kimi": "data/user/settings/subagent.json",- "/settings/agents/opencode": "data/user/settings/subagent.json",- "/settings/agents/mimo": "data/user/settings/subagent.json",+ llm: "data/user/settings/model_catalog.json",+ embedding: "data/user/settings/model_catalog.json",+ search: "data/user/settings/model_catalog.json",+ tts: "data/user/settings/model_catalog.json",+ stt: "data/user/settings/model_catalog.json",+ imagegen: "data/user/settings/model_catalog.json",+ videogen: "data/user/settings/model_catalog.json",+ tools: "data/user/settings/interface.json",+ attachments: "data/user/settings/system.json",+ capabilities: "data/user/settings/main.yaml · agents.yaml",+ "agent-claude-code": "data/user/settings/subagent.json",+ "agent-codex": "data/user/settings/subagent.json",+ "agent-gemini": "data/user/settings/subagent.json",+ "agent-antigravity": "data/user/settings/subagent.json",+ "agent-kimi": "data/user/settings/subagent.json",+ "agent-opencode": "data/user/settings/subagent.json",+ "agent-mimo": "data/user/settings/subagent.json",};-export function storagePathFor(pathname: string): string | null {+export function storagePathFor(+ pathname: string,+ activeSection?: string | null,+): string | null {+ if (MERGED_CATEGORY_HREFS.has(pathname)) {+ return activeSection ? (STORAGE_PATHS[activeSection] ?? null) : null;+ }return STORAGE_PATHS[pathname] ?? null;}diff --git a/web/tests/knowledge-helpers.test.ts b/web/tests/knowledge-helpers.test.tsindex b71d9ded0..f3941ca94 100644--- a/web/tests/knowledge-helpers.test.ts+++ b/web/tests/knowledge-helpers.test.ts@@ -148,7 +148,7 @@ test("resolveKnowledgeIndexFailure routes embedding configuration failures to em);assert.equal(endpointFailure?.requiresModelChange, true);- assert.equal(endpointFailure?.settingsHref, "/settings/embedding");+ assert.equal(endpointFailure?.settingsHref, "/settings/models#embedding");});test("taskFailureMessage keeps trace details out of the primary error", () => {