Skip to content

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

Merge commit 'refs/pr/1345' into codex/evan-backend-prs-20260923

Bingxi Zhao (Frank)7dd8b2ac44bf
diff --cc web/components/settings/SettingsOverview.tsx
index d51ef6931,f28060952..8eeb5e580
--- a/web/components/settings/SettingsOverview.tsx
+++ b/web/components/settings/SettingsOverview.tsx
@@@ -1,11 -1,27 +1,11 @@@
"use client";
-import { useCallback, useEffect, useState } from "react";
import Link from "next/link";
+import { ArrowRight } from "lucide-react";
import { useTranslation } from "react-i18next";
- import { SettingRow, SettingSection, SettingsPageHeader } from "./shared";
- import { useUiSettings } from "@/features/settings/store";
-
-import { apiFetch, apiUrl } from "@/lib/api";
-import SettingsReadinessPanel from "@/components/settings/SettingsReadinessPanel";
-import SettingsStatusPanel from "@/components/settings/SettingsStatusPanel";
-import {
- selectClass,
- SettingRow,
- SettingSection,
-} from "@/components/settings/shared";
-import { setPendingPrompt } from "@/lib/pending-prompt";
-import {
- settingsAnchorHref,
- type Lang,
-} from "@/features/settings/navigation/settings-nav";
++import { selectClass, SettingRow, SettingSection, SettingsPageHeader } from "./shared";
++import { RESPONSE_LANGUAGE_OPTIONS, useUiSettings } from "@/features/settings/store";
import { useSettings } from "@/features/settings/store/SettingsStore";
-import {
- RESPONSE_LANGUAGE_OPTIONS,
- useUiSettings,
-} from "@/features/settings/store";
/** The en/zh segmented control both language rows use. */
function LanguageToggle({
@@@ -36,96 -51,150 +36,107 @@@
);
}
-/**
- * The settings landing page.
- *
- * It used to be a grid of seven cards whose only job was to link to the seven
- * categories — a directory, now that the navigator lists every page anyway.
- * What it could not answer, and what a landing page is for, is "what state am
- * I actually in".
- *
- * That question now has exactly one answer on the page: `Readiness`. Two
- * earlier lists — "needs attention" and "model services" — reported slices of
- * it from the client's own view of the catalog, which meant the same service
- * could be counted twice with two different totals. They were folded into the
- * readiness rows, which carry the model name, the last test result, and what
- * depends on the service on one line.
- *
- * Above it sits only what needs no diagnosis: the runtime strip, and the two
- * language toggles that decide what the rest of the page reads like.
- */
export default function SettingsOverview() {
- const { t, i18n } = useTranslation();
- const zh = i18n.language?.toLowerCase().startsWith("zh");
- const tr = useCallback((value: Lang) => (zh ? value.zh : value.en), [zh]);
+ const { t } = useTranslation();
const { language, responseLanguage, updateLanguage, updateResponseLanguage } =
useUiSettings();
- const { catalogEditable, storedDraft, startTour } = useSettings();
-
- // The effective browser API base. The old hub previewed it on its Network
- // card, and it is the first thing to check on a Docker or LAN install, so it
- // did not deserve to disappear with that card.
- const [apiBase, setApiBase] = useState("");
- useEffect(() => {
- let cancelled = false;
- (async () => {
- try {
- const res = await apiFetch(apiUrl("/api/settings/network"));
- if (!res.ok) return;
- const data = (await res.json()) as {
- effective?: { browser_api_base?: string };
- };
- if (!cancelled) setApiBase(data.effective?.browser_api_base || "");
- } catch {
- /* non-admins get 403; the row simply does not render */
- }
- })();
- return () => {
- cancelled = true;
- };
- }, []);
-
+ const { catalogEditable } = useSettings();
return (
<div>
- <header className="mb-6 flex items-start justify-between gap-4">
- <div className="min-w-0">
- <h1 className="font-serif text-[22px] font-semibold tracking-tight text-[var(--foreground)]">
- {t("Settings")}
- </h1>
- <p className="mt-1.5 text-[13px] leading-relaxed text-[var(--muted-foreground)]">
- {t("Appearance, models, knowledge, chat, and memory.")}
- </p>
- </div>
- <button
- type="button"
- onClick={() => {
- setPendingPrompt(
- tr({
- zh: "帮我配置一下 DeepTutor,先看看现在缺什么。",
- en: "Help me configure DeepTutor — start by checking what's missing.",
- }),
- );
- }}
- className="hidden shrink-0 items-center gap-1.5 rounded-lg border border-[var(--border)] px-3 py-1.5 text-[12px] font-medium text-[var(--muted-foreground)] transition-colors hover:text-[var(--foreground)] sm:inline-flex"
- >
- {t("Set up with DeepTutor")}
- </button>
- </header>
-
- <SettingsStatusPanel />
-
- <div className="mt-8">
- <SettingSection
- title={t("Language")}
- description={t("Choose the interface language.")}
- >
- <SettingRow
- title={t("Interface language")}
- description={t(
- "Controls navigation, settings, and status text only.",
- )}
- control={
- <LanguageToggle value={language} onChange={updateLanguage} />
- }
- />
- <SettingRow
- title={t("Model output language")}
- description={t(
- "Sets the default language for chat and capability responses.",
- )}
- control={
- <select
- value={responseLanguage}
- onChange={(event) =>
- void updateResponseLanguage(
- event.target.value as typeof responseLanguage,
- )
- }
- className={`${selectClass} min-w-[160px] pr-8`}
- >
- {RESPONSE_LANGUAGE_OPTIONS.map((option) => (
- <option key={option.value} value={option.value}>
- {option.label}
- </option>
- ))}
- </select>
- }
- />
- </SettingSection>
- </div>
-
- <SettingsReadinessPanel enabled={catalogEditable === true} />
-
- {apiBase && (
- <p className="mt-5 text-[11.5px] text-[var(--muted-foreground)]">
- {t("Browser API base")}{" "}
+ <SettingsPageHeader
+ title={t("General")}
+ description={t(
+ "Make DeepTutor feel at home. Apply your preferences using the bar below.",
+ )}
+ />
+ <SettingSection title={t("Language")}>
+ <SettingRow
+ title={t("Interface language")}
+ description={t(
+ "Controls navigation, settings, and status text only.",
+ )}
+ control={
+ <LanguageToggle value={language} onChange={updateLanguage} />
+ }
+ />
+ <SettingRow
+ title={t("Model output language")}
+ description={t(
+ "Sets the default language for chat and capability responses.",
+ )}
+ control={
- <LanguageToggle
++ <select
+ value={responseLanguage}
- onChange={updateResponseLanguage}
- />
++ onChange={(event) =>
++ void updateResponseLanguage(
++ event.target.value as typeof responseLanguage,
++ )
++ }
++ className={`${selectClass} min-w-[160px] pr-8`}
++ >
++ {RESPONSE_LANGUAGE_OPTIONS.map((option) => (
++ <option key={option.value} value={option.value}>
++ {option.label}
++ </option>
++ ))}
++ </select>
+ }
+ />
+ </SettingSection>
+ {catalogEditable && <SettingSection
+ title={t("Set up chat first")}
+ description={t("Connect a provider and choose a language model. Other services are optional.")}
+ >
+ {[
+ {
+ href: "/settings/connections",
+ title: t("1. Connect a provider"),
+ description: t("Add your provider and credentials, then test the connection."),
+ },
+ {
+ href: "/settings/llm",
+ title: t("2. Choose a chat model"),
+ description: t("Add a language model, test it, and select it as the default for conversations."),
+ },
+ {
+ href: "/settings/status",
+ title: t("3. Apply and check"),
+ description: t("Apply your changes using the bottom bar, then check service status before starting a conversation."),
+ },
+ ].map((item) => (
<Link
- href={settingsAnchorHref("network")}
- className="font-mono text-[var(--foreground)]/70 underline-offset-2 hover:underline"
+ key={item.href}
+ href={item.href}
+ className="group flex items-center justify-between gap-5 border-b border-[var(--border)]/50 py-4 last:border-0 rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ring)]"
>
- {apiBase}
+ <div>
+ <div className="text-[14px] font-medium">{item.title}</div>
+ <p className="mt-1 text-[13px] leading-relaxed text-[var(--muted-foreground)]">
+ {item.description}
+ </p>
+ </div>
+ <ArrowRight size={17} className="shrink-0 text-[var(--muted-foreground)]" />
</Link>
- </p>
- )}
-
- <button
- type="button"
- onClick={startTour}
- className="mt-6 text-[11.5px] text-[var(--muted-foreground)] underline-offset-2 transition-colors hover:text-[var(--foreground)] hover:underline"
+ ))}
+ </SettingSection>}
+ {catalogEditable && <SettingSection
+ title={t("Add more when you need it")}
+ description={t("These services are not required for basic chat.")}
>
- {t("Take the tour")}
- </button>
- {storedDraft?.updated_at && (
- <p className="mt-2 text-[11px] text-[var(--muted-foreground)]/70">
- {t("Draft saved {{when}}", { when: storedDraft.updated_at })}
- </p>
- )}
+ {[
+ { href: "/settings/embedding", title: t("Knowledge search"), description: t("Configure an embedding model before indexing a knowledge base.") },
+ { href: "/settings/search", title: t("Web search"), description: t("Connect a search service to find information on the web.") },
+ { href: "/settings/task-models", title: t("Background task models"), description: t("Choose models for automatic tasks such as titles and suggestions.") },
+ ].map(item => (
+ <Link key={item.href} href={item.href} className="flex items-center justify-between gap-5 border-b border-[var(--border)]/50 py-4 last:border-0 rounded-sm focus-visible:outline focus-visible:outline-2 focus-visible:outline-[var(--ring)]">
+ <div>
+ <div className="text-[14px] font-medium">{item.title}</div>
+ <p className="mt-1 text-[13px] text-[var(--muted-foreground)]">{item.description}</p>
+ </div>
+ <ArrowRight size={17} className="shrink-0 text-[var(--muted-foreground)]" />
+ </Link>
+ ))}
+ </SettingSection>}
</div>
);
}
diff --cc web/features/settings/store/SettingsStore.tsx
index d6ec925d5,1065ad700..9ca8333e3
--- a/web/features/settings/store/SettingsStore.tsx
+++ b/web/features/settings/store/SettingsStore.tsx
@@@ -19,8 -19,10 +19,9 @@@ import
writeStoredCodeBlockShowLineNumbers,
writeStoredCodeBlockTheme,
writeStoredCodeBlockWrapLongLines,
- hasStoredResponseLanguage,
writeStoredLanguage,
writeStoredResponseLanguage,
+ type ResponseLanguage,
} from "@/context/app-shell-storage";
import { useAppShell } from "@/context/AppShellContext";
import { apiFetch, apiUrl } from "@/lib/api";