feat: no baked-in default model — the new-session controls ARE the default settings page

Owner reframe (2026-09-18): the model + thinking + context controls on
the home graph view and /chat/new are not a draft overlay on a baked-in
default — they ARE the settings page for the default model, and the
user's last choice IS the default. BYOK first boot has no keys and
possibly no OpenRouter, so there is NO default to show: the controls
render 'no model' ('—') until the first pick.

The flash was the deeper symptom: the surfaces rendered from client
state that started empty and fetched truth afterward, so every visit
flashed the config pin (GLM/low — a dev artifact) for a few frames.
Fix at the root: both pages are now force-dynamic server components
that read the record (readDefaultSettings → initialSettings) and hand
it to the client — the first frame shows truth. Dynamic routes aren't
cached client-side (staleTimes.dynamic = 0), so every navigation
re-reads the record; the useDefaultSettings hook keeps only save-side
state (optimistic set + PUT). The GET-on-mount and its touch-guard are
gone.

ModelControl gains noDefaultModel (the default surfaces only): unset
settings render no model/level, never the catalog pin; the thinking
menu no-ops until a model exists. Chat surfaces keep the catalog
fallback — the engine runs the config pin when a session record has no
override, so the control keeps showing what will actually run.

Renamed draft→default throughout: data/default-settings.json,
GET/PUT /api/settings/defaults, useDefaultSettings. New sessions
still inherit the default on creation exactly as before.

Live-verified: first-boot 'no model' with zero flash, picker +
Shift+Tab cycle, values held across session→/chat/new→home roundtrips
and a reload (10×100ms samples, never the old default), zero console
errors.
This commit is contained in:
amosblomqvist
2026-09-18 09:37:20 +03:00
parent a94a108e74
commit bd3086194f
16 changed files with 188 additions and 168 deletions
+8 -7
View File
@@ -5,7 +5,7 @@ import { useRouter } from "next/navigation";
import { CornerDownLeftIcon } from "lucide-react";
import { GraphView } from "@/components/graph-view";
import { GraphContextControl, effectiveContextTokens } from "@/components/graph-context-control";
import { useDraftSettings } from "@/components/draft-settings";
import { useDefaultSettings } from "@/components/default-settings";
import { DictationBar, useDictation } from "@/components/dictation";
import { SidebarToggle } from "@/components/sidebar";
import { StatsBar } from "@/components/stats-bar";
@@ -17,7 +17,7 @@ import type { ChatSettings, TurnUsage } from "@/src/core";
* under the header and the new-session dock, both of which float over it
* with no gradient scrims. Sessions live in the toggleable sidebar.
*/
export function Home() {
export function Home({ initialSettings }: { initialSettings: ChatSettings | null }) {
const router = useRouter();
const [topic, setTopic] = useState("");
// Voice dictation (STT wave, 2026-09-17): finals append at the end of the
@@ -26,13 +26,13 @@ export function Home() {
append: (t) => setTopic((v) => (v ? v.replace(/\s+$/, "") + " " + t : t)),
});
const [busy, setBusy] = useState(false);
// The model+thinking+context selection made pre-chat — the SHARED draft
// record (draft-settings wave, 2026-09-18): both new-session surfaces
// (this topic dock and /chat/new) read and write ONE persisted choice,
// so what the learner last left the controls on is what shows on return.
// THE default settings (owner, 2026-09-18): this topic dock IS the
// settings page for the default model — no baked-in default exists; the
// user's last choice (server-rendered in via initialSettings, shared
// with /chat/new through data/default-settings.json) IS the default.
// Still carried to the chat POST then PUT-on-create (the model picker
// defers its save when chatId is empty; see components/model-picker).
const { settings, save: saveDraft } = useDraftSettings();
const { settings, save: saveDraft } = useDefaultSettings(initialSettings);
const start = async () => {
const t = topic.trim();
@@ -143,6 +143,7 @@ export function Home() {
dictationSlot={<DictationBar dictation={dictation} />}
turns={[] as TurnUsage[]}
chatId=""
noDefaultModel
settings={settings}
onSettingsSaved={saveDraft}
leftSlot={