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
+15 -3
View File
@@ -86,6 +86,7 @@ export function ModelControl({
settings,
onSaved,
fallbackModelId,
noDefaultModel,
}: {
chatId: string;
/** The record's current settings (undefined = config pin). */
@@ -95,6 +96,11 @@ export function ModelControl({
/** The last turn's actual model (from the turns log) — the label until
* the catalog (with config's defaults) finishes loading. */
fallbackModelId?: string;
/** Default-surfaces only (owner, 2026-09-18): NO baked-in default —
* unset settings render "no model"/"—" (BYOK first boot), never the
* config pin. Chat surfaces keep the catalog-default fallback (the
* engine runs the pin, so the control shows what will run). */
noDefaultModel?: boolean;
}) {
const catalog = useModelCatalog();
const [open, setOpen] = useState<"model" | "thinking" | null>(null);
@@ -109,9 +115,12 @@ export function ModelControl({
const listRef = useRef<HTMLUListElement>(null);
const defaults = catalog?.defaults;
const effectiveId = settings?.model?.id ?? defaults?.model.id ?? fallbackModelId;
const effectiveLevel =
settings?.thinkingLevel ?? defaults?.thinkingLevel;
const effectiveId = noDefaultModel
? settings?.model?.id
: (settings?.model?.id ?? defaults?.model.id ?? fallbackModelId);
const effectiveLevel = noDefaultModel
? settings?.thinkingLevel
: (settings?.thinkingLevel ?? defaults?.thinkingLevel);
const entry = catalog?.models.find((m) => m.id === effectiveId);
const levels = entry?.supportedLevels ?? [];
@@ -250,6 +259,9 @@ export function ModelControl({
type="button"
data-testid="stats-thinking"
onClick={() => {
// No model yet (noDefaultModel first boot) → nothing to set a
// level FOR: the click is a no-op, never an empty menu.
if (entry === undefined) return;
setOpen((o) => (o === "thinking" ? null : "thinking"));
setError(null);
}}