Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

Merge pull request #1084 from contributor

Bingxi Zhao (Frank)b7abfae652ee
diff --cc deeptutor/services/config/model_catalog.py
index 1d47dc3ca,d00c34e3a..fa751e8b4
--- a/deeptutor/services/config/model_catalog.py
+++ b/deeptutor/services/config/model_catalog.py
@@@ -11,11 -11,9 +11,12 @@@ from typing import An
from uuid import uuid4
from deeptutor.services.path_service import get_path_service
+ from deeptutor.services.provider_registry import wire_api_for_provider
-from .embedding_endpoint import normalize_embedding_endpoint_for_display
+from .embedding_endpoint import (
+ is_gemini_native_embedding_endpoint,
+ normalize_embedding_endpoint_for_display,
+)
# Fallback only — frozen at admin scope at import time. Production code should
# enter through ``get_model_catalog_service()`` so the path is resolved from the
diff --cc web/components/settings/SettingsContext.tsx
index 75d9ec88b,293bed0df..ab9db5520
--- a/web/components/settings/SettingsContext.tsx
+++ b/web/components/settings/SettingsContext.tsx
@@@ -93,10 -84,9 +93,11 @@@ export type CatalogProfile =
api_key: string;
api_version: string;
extra_headers?: Record<string, string> | string;
+ wire_api?: "auto" | "responses" | "chat_completions";
proxy?: string;
max_results?: number;
+ /** Set when this profile's credentials come from a catalog connection. */
+ connection_id?: string;
models: CatalogModel[];
};
diff --cc web/components/settings/SettingsMain.tsx
index 3c9f4b23f,a5acdb3f3..e3bb4b144
--- a/web/components/settings/SettingsMain.tsx
+++ b/web/components/settings/SettingsMain.tsx
@@@ -24,30 -20,36 +24,32 @@@ export default function SettingsMain(
const showToolbar = !isNavOnlyRoute(pathname);
return (
- <div className="flex h-full min-w-0 flex-col overflow-hidden bg-[var(--background)]">
- <div className="mx-auto w-full max-w-5xl px-5 pt-5 sm:px-10">
- <SettingsBreadcrumb />
- {showToolbar && (
- <div className="mt-2">
- <SettingsToolbar />
- </div>
- )}
- <SettingsLoadStatusBanner />
+ <div className="flex h-full min-w-0 bg-[var(--background)]">
+ <div className="hidden h-full shrink-0 border-r border-[var(--border)]/60 py-5 pl-6 pr-3 md:block">
+ <SettingsNav />
</div>
- {/* Inner scroll container. Sticky elements inside (e.g. the profile-list
- aside in ServiceConfigEditor) anchor to this ancestor instead of the
- outer flex column, so the left column stays put while the right side
- scrolls. ``min-h-0`` is required for the flex child to constrain to
- remaining 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 className="mx-auto w-full max-w-5xl px-5 pb-16 sm:px-10">
- <div className="mt-4">{children}</div>
+ <div className="flex h-full min-w-0 flex-1 flex-col overflow-hidden">
- <div className="w-full px-8 pt-5">
++ <div className="w-full px-5 pt-5 sm:px-8">
+ {/* Below `md` the column is hidden, so this is the only way out of
+ the page you landed on. */}
+ <div className="mb-2">
+ <SettingsNavCompact />
+ </div>
+ {showToolbar && <SettingsToolbar />}
+ <SettingsLoadStatusBanner />
+ </div>
+ {/* Inner scroll container. Sticky elements inside (e.g. the profile-list
+ aside in ServiceConfigEditor) anchor to this ancestor instead of the
+ outer flex column, so the left column stays put while the right side
+ scrolls. ``min-h-0`` is required for the flex child to constrain to
+ remaining space — without it, ``overflow-y-auto`` would never clip. */}
+ <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 className="w-full max-w-3xl px-5 pb-16 pt-2 sm:px-8">
++ {children}
++ </div>
</div>
</div>
</div>
diff --cc web/components/settings/SettingsToolbar.tsx
index f213cad3f,f147c7b03..b967a4df6
--- a/web/components/settings/SettingsToolbar.tsx
+++ b/web/components/settings/SettingsToolbar.tsx
@@@ -53,32 -36,33 +53,32 @@@ export function SettingsToolbar()
);
}
+ const status = toast
+ ? { text: toast, tone: "text-[var(--primary)] animate-fade-in" }
+ : draftState === "unsaved"
+ ? {
+ text: t("Unsaved changes"),
+ tone: "text-amber-600 dark:text-amber-400",
+ }
+ : draftState === "saved"
+ ? {
+ text: t("Draft not applied yet"),
+ tone: "text-amber-600 dark:text-amber-400",
+ }
+ : {
+ text: t("All changes saved"),
+ tone: "text-[var(--muted-foreground)]",
+ };
+
return (
- <div className="flex items-center justify-between gap-3 px-1 py-2">
+ <div className="flex flex-col items-stretch gap-2 px-1 py-2 sm:flex-row sm:items-center sm:justify-between sm:gap-3">
<p
- className={`min-w-0 truncate text-[12px] ${
- toast
- ? "text-[var(--primary)] animate-fade-in"
- : hasUnsavedChanges
- ? "text-amber-600 dark:text-amber-400"
- : "text-[var(--muted-foreground)]"
- }`}
+ className={`min-w-0 truncate text-[12px] ${status.tone}`}
+ title={storagePath || undefined}
>
- {toast ? (
- toast
- ) : hasUnsavedChanges ? (
- t("Draft has unsaved changes")
- ) : storagePath ? (
- <>
- {t("Saved to")}{" "}
- <span className="font-mono text-[var(--foreground)]/65">
- {storagePath}
- </span>
- </>
- ) : (
- t("All changes saved")
- )}
+ {status.text}
</p>
- <div className="flex items-center gap-2">
+ <div className="flex shrink-0 items-center justify-end gap-2">
<button
onClick={startTour}
className="inline-flex items-center gap-1.5 rounded-lg border border-[var(--border)]/50 px-3 py-1.5 text-[12px] font-medium text-[var(--muted-foreground)] transition-colors hover:border-[var(--border)] hover:text-[var(--foreground)]"
diff --cc web/tests/wire-api-settings-contract.test.ts
index 000000000,82bf38a05..3799c665b
mode 000000,100644..100644
--- a/web/tests/wire-api-settings-contract.test.ts
+++ b/web/tests/wire-api-settings-contract.test.ts
@@@ -1,0 -1,65 +1,67 @@@
+ import assert from "node:assert/strict";
+ import { readFileSync } from "node:fs";
+ import path from "node:path";
+ import test from "node:test";
+
+ const EDITOR = path.resolve(
+ process.cwd(),
+ "components/settings/ServiceConfigEditor.tsx",
+ );
+ const CONTEXT = path.resolve(
+ process.cwd(),
+ "components/settings/SettingsContext.tsx",
+ );
+ const MAIN = path.resolve(
+ process.cwd(),
+ "components/settings/SettingsMain.tsx",
+ );
+ const TOOLBAR = path.resolve(
+ process.cwd(),
+ "components/settings/SettingsToolbar.tsx",
+ );
+ const EN = path.resolve(process.cwd(), "locales/en/app.json");
+ const ZH = path.resolve(process.cwd(), "locales/zh/app.json");
+
+ test("LLM profiles expose wire API selection only when provider metadata supports it", () => {
+ const editor = readFileSync(EDITOR, "utf8");
+ const context = readFileSync(CONTEXT, "utf8");
+
+ assert.match(context, /supports_wire_api_selection\?: boolean/);
+ assert.match(editor, /providerOption\?\.supports_wire_api_selection/);
+ assert.match(editor, /updateProfileField\(service, "wire_api"/);
+ assert.match(editor, /t\("API protocol"\)/);
+ assert.match(editor, /value="responses"/);
+ assert.match(editor, /value="chat_completions"/);
+ });
+
+ test("wire API settings copy stays in sync across locales", () => {
+ const en = JSON.parse(readFileSync(EN, "utf8")) as Record<string, unknown>;
+ const zh = JSON.parse(readFileSync(ZH, "utf8")) as Record<string, unknown>;
+ const keys = [
+ "API protocol",
+ "Auto (recommended)",
+ "Responses API",
+ "Chat Completions",
+ "Automatically select the protocol and fall back when supported.",
+ "Require the Responses API. Endpoint errors are returned without falling back.",
+ "Require the Chat Completions API.",
+ ];
+
+ for (const key of keys) {
+ assert.equal(typeof en[key], "string", `missing English copy: ${key}`);
+ assert.equal(typeof zh[key], "string", `missing Chinese copy: ${key}`);
+ }
+ });
+
+ test("wire API settings remain usable on narrow viewports", () => {
+ const editor = readFileSync(EDITOR, "utf8");
+ const main = readFileSync(MAIN, "utf8");
+ const toolbar = readFileSync(TOOLBAR, "utf8");
+
- assert.match(editor, /sm:grid-cols-\[200px_minmax\(0,1fr\)\]/);
- assert.match(editor, /sm:sticky sm:top-4/);
- assert.match(main, /px-5[^\"]*sm:px-10/);
++ // The 1.6 settings UI uses provider cards and a modal instead of the old
++ // sticky profile list. Profile fields stay one-column until the `sm`
++ // breakpoint, and the shell keeps compact horizontal padding on phones.
++ assert.match(editor, /grid gap-4 sm:grid-cols-2/);
++ assert.match(main, /px-5[^\"]*sm:px-8/);
+ assert.match(toolbar, /flex-col[^\"]*sm:flex-row/);
+ });