From 35c72bcd101fbcdf2eab8e9c27d6726ed5b310ec Mon Sep 17 00:00:00 2001 From: Niko1221 Date: Fri, 16 Oct 2026 14:24:42 +0200 Subject: [PATCH] Models tab in one view with the family switch, one result card for every tune outcome, the tuned values in Expert mode, glow instead of a spinning ring - Models: the family switch (Qwen3.8-Flash-Next, Qwen3.6-35B-A3B) is back in the navbar without the word Model; version, context and computer use, the tuning line and Load/Tune sit in one card beside This computer, so the tab fits the first view; image generation moves into Expert mode - Tune: one result card for faster, already the fastest, couldn't measure (busy PC, with plain copy and Try again), failed and stopped, driven by the host's code, reason_code and values; the same Tune dialog frame for all of them - Tune running: the step icon glows and a small dot beeps instead of a ring spinning around a square tile; reduced motion respected - Expert mode: Context memory and Low-RAM mode show the active tuning's values, the engine settings list what the tuning sets, and loading does not re-prepare the model because of them - the tuning line (Using your tuning / Switch off) is a calm line with an icon - strings in 8 languages; tests in tune-outcome.test.mjs --- apps/host/src/components/FamilySwitch.tsx | 12 ++++ apps/host/src/components/NativeModels.tsx | 50 ++++++++++------ apps/host/src/components/NativeSettings.tsx | 6 +- apps/host/src/components/NativeTune.tsx | 26 ++++---- apps/host/src/components/NativeTuneBadge.tsx | 6 +- apps/host/src/components/TuneRunView.tsx | 49 +++++++++++---- apps/host/src/lib/tune-outcome.ts | 62 +++++++++++++++++++ apps/host/src/lib/tune-values.ts | 19 ++++++ apps/host/src/styles/app.css | 56 ++++++++++++++++- apps/host/tests/tune-outcome.test.mjs | 63 ++++++++++++++++++++ 10 files changed, 300 insertions(+), 49 deletions(-) create mode 100644 apps/host/src/components/FamilySwitch.tsx create mode 100644 apps/host/src/lib/tune-outcome.ts create mode 100644 apps/host/src/lib/tune-values.ts create mode 100644 apps/host/tests/tune-outcome.test.mjs diff --git a/apps/host/src/components/FamilySwitch.tsx b/apps/host/src/components/FamilySwitch.tsx new file mode 100644 index 00000000..27d55f59 --- /dev/null +++ b/apps/host/src/components/FamilySwitch.tsx @@ -0,0 +1,12 @@ +import { tr } from '../lib/i18n'; +import type { CatalogModel } from '../lib/native-catalog'; + +/** The model families of the catalog as a switch in the navbar (Qwen3.8-Flash-Next, Qwen3.6-35B-A3B). A single family is just its name. */ +export function FamilySwitch({ families, selected, onPick }: { families: CatalogModel[]; selected?: string; onPick: (family: CatalogModel) => void }) { + const shown = families.filter(f => f.sizes.length); + if (shown.length < 2) return shown[0] ? {tr(shown[0].title)} : null; + return
+ {shown.map(f => )} +
; +} diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsx index c0835099..daddadb0 100644 --- a/apps/host/src/components/NativeModels.tsx +++ b/apps/host/src/components/NativeModels.tsx @@ -2,6 +2,7 @@ import { tr } from '../lib/i18n'; import { useEffect, useMemo, useRef, useState } from 'react'; import { Screen } from './layout'; import { VersionPicker } from './VersionPicker'; +import { FamilySwitch } from './FamilySwitch'; import { PcFitCard } from './PcFitCard'; import { fitOn } from '../lib/native-fit'; import { Btn, Dialog, ErrorNotice, Icon, Select } from './ui'; @@ -12,6 +13,8 @@ import { plainFailureText } from '../lib/plain-errors'; import { api } from '../lib/client'; import { go, setSettingsSection, selectRemoteModel, pushToast } from '../lib/store'; import { nativeAction, useNative, type NativeJob } from '../lib/native'; +import { tuneEffective } from '../lib/native-tune'; +import { tunedFields } from '../lib/tune-values'; import { NativeSettings } from './NativeSettings'; import { RunImageModel } from './RunImageModel'; import { useStore } from '../lib/store'; @@ -57,6 +60,15 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine // What the running model was really started with is what the page shows: after Load the highlight must still be the profile that was applied. useEffect(() => { if (loadedSelected?.resourceProfile) setResourceProfile(loadedSelected.resourceProfile); }, [loadedSelected?.id, loadedSelected?.resourceProfile]); + // After a tuning, Expert mode shows the values the tuning set (the active preset's), not the ones the model was prepared with. + const [tunedNow, setTunedNow] = useState<{ name: string; fields: ReturnType } | null>(null); + useEffect(() => { + if (!selectedSize || !installed?.ready) { setTunedNow(null); return; } + let alive = true; + tuneEffective(selectedSize.id, resourceProfile, selectedSize.images ? vision : 'no').then(t => { if (alive) setTunedNow(t.applied && t.preset ? { name: t.preset.name, fields: tunedFields(t.changed) } : null); }).catch(() => { if (alive) setTunedNow(null); }); + return () => { alive = false; }; + }, [selectedSize?.id, installed?.ready, resourceProfile, vision, native?.jobs.filter(j => j.state === 'done').length]); + useEffect(() => { if (tunedNow?.fields.kv) setKv(tunedNow.fields.kv as typeof kv); if (tunedNow?.fields.lowRam) setLowRam(tunedNow.fields.lowRam as typeof lowRam); }, [tunedNow]); const active = native?.jobs.find(j => j.state === 'running'); const job = native?.jobs.find(j => j.id === jobId) ?? (!jobId ? native?.jobs.filter(j => ['load', 'install'].includes(j.kind)).at(-1) : undefined); const noFit = selectedSize?.on_this_pc === 'does not fit'; @@ -94,38 +106,42 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine setPending(false); } } async function load() { if (!selectedSize) - return; await perform(async () => { if (installed?.ready && context === installed.context && (!selectedSize?.images || installed.images && installed.images !== 'off') && (!installed.kv || kv === installed.kv) && lowRam === (installed.lowRamMode ?? 'auto')) { + return; await perform(async () => { if (installed?.ready && context === installed.context && (!selectedSize?.images || installed.images && installed.images !== 'off') && (!installed.kv || kv === installed.kv || kv === tunedNow?.fields.kv) && (lowRam === (installed.lowRamMode ?? 'auto') || lowRam === tunedNow?.fields.lowRam)) { const result = await nativeAction('operations', { kind: 'load', args: { model: selectedSize.id, resourceProfile, vision: selectedSize?.images ? vision : 'no', multiple: expert && multiple, ...(expert && gpus.length ? { gpus, layerSplit: split } : {}), values: {} } }); setJobId(result.id); } else setPlan(await api.post('/api/native/plan', downloadValues)); }); } async function download() { await perform(async () => { const result = await nativeAction('operations', { kind: 'install', args: downloadValues }); setJobId(result.id); setPlan(null); }); } - return { setExpert(v => !v); setMultiple(false); setGpus([]); setDeviceChoice('auto'); }}>{tr(expert ? 'Close expert mode' : 'Expert mode')}}> - {tr(selectedFamily ?
{tr(selectedFamily.title)}{tr(selectedSize ? catalogVersionLabel(selectedSize) : '')} · {tr(context / 1024)}{tr("K")}{tr(vision !== 'no' ? ' · Reads pictures' : '')}{tr(native?.instances.some(i => i.model === selectedSize?.id && i.status === 'ready') ? {tr("Ready")} : null)}
{ const f = families.find(f => f.family === v.family || f.sizes.some(s => s.sourceFamily === v.family)); if (!f) - return; presetPending.current = true; setFamily(f.family); setSize(f.sizes.find(s => s.model === v.model && (s.sourceFamily === v.family || f.family === v.family))?.id ?? ''); setContext(v.context ?? 32768); setVision(v.vision ?? 'no'); setKv(v.kv ?? 'int8'); setLowRam(v.low_ram ?? 'auto'); }}/> setManage(true)}>{tr("Manage models")}
: null)} -
-
+ return {tr("Models")}} titleDetail={ { setFamily(f.family); setSize((f.sizes.find(s => native?.installed?.models.some(m => m.model === s.id && m.ready)) ?? f.sizes[0])?.id ?? ''); setVision('no'); setError(''); }}/>} actions={ { setExpert(v => !v); setMultiple(false); setGpus([]); setDeviceChoice('auto'); }}>{tr(expert ? 'Close expert mode' : 'Expert mode')}}> +
+
{tr(native?.instances.length && expert ?

{tr(native.instances.length === 1 ? 'Loaded model' : 'Loaded models')}

{tr(native.instances.map(i =>
{tr(i.label)}{tr(i.gpus.length ? i.gpus.map(g => `GPU ${g + 1}`).join(' + ') : 'Automatic GPU')} · {tr(i.status === 'ready' ? i.phase : i.status)}{tr(native.defaultId === i.id ? ' · Chat default' : '')}{tr(i.error ? {tr(plainFailureText(i.error).message)} : null)}{tr(expert && multiple && native.defaultId !== i.id ? void perform(() => nativeAction(`instances/${i.id}/default`))}>{tr("Use in chat")} : null)} void perform(() => nativeAction(`instances/${i.id}/unload`))}>{tr("Unload")}
))}
: null)}
{tr(selectedFamily && !selectedSize ? <>

{tr("This model needs a newer engine.")}

{tr("Update your engine or import a local GGUF for this model.")}

{ setSettingsSection('Engine'); go('settings'); }}>{tr("Update engine")}{tr("Use a local GGUF\u2026")} : null)}{tr(!selectedFamily ? <>

{tr("Set up Strata")}

{tr("Connect your local installation to choose an optimized model.")}

{ setSettingsSection('Engine'); go('settings'); })}>{tr("Connect engine")}{tr(native?.error ?

{tr(native.error)}

: null)}{tr("Other local models")} : null)} - {tr(selectedSize ? <>
{tr("Version")} { const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/>

{tr(selectedSize.about)}

+ {tr(selectedSize ? <> +
{tr("Version")} { const f = families.find(f => f.family === v.family || f.sizes.some(s => s.sourceFamily === v.family)); if (!f) + return; presetPending.current = true; setFamily(f.family); setSize(f.sizes.find(s => s.model === v.model && (s.sourceFamily === v.family || f.family === v.family))?.id ?? ''); setContext(v.context ?? 32768); setVision(v.vision ?? 'no'); setKv(v.kv ?? 'int8'); setLowRam(v.low_ram ?? 'auto'); }}/> setManage(true)}>{tr("Manage models")}
+
{ const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/>
{tr(noFit ?

{tr("May run slower \u00B7 Model data can be read from SSD.")}

: null)} +
+
{tr("Conversation context")} setVision(e.target.checked ? 'yes' : 'no')}/>{tr("Read pictures ")}{tr("Optional")}{tr("Understand photos, screenshots and charts. Vision files download automatically. Enable them when loading this model.")}{tr(expert && vision !== 'no' ? ({ value: String(n), label: `${n / 1024}K` }))} onChange={n => setContext(Number(n))}/>
: null)} -

{tr("Computer use")}

-
{tr("Image generation ")}{tr("Optional")} { }}/>
- {tr(expert ?

{tr("Expert settings")}

: null)}{tr(gpus.length > 1 ? : null)}
{tr(installed ? :

{tr("More engine parameters become available after preparing this version.")}

)} : null)} - {tr(active ? : null)} - {tr(job?.state === 'error' ? void load()}/> : null)} - {tr(error ? : null)} - {selectedSize && installed?.ready ? : null} -
{tr(loadedSelected ? <> void perform(() => nativeAction(`instances/${loadedSelected.id}/unload`))}>{tr("Unload")}{tr(onReady ? {tr("Start chatting")} : {tr("Ready")})} : onReady && native?.instances.some(i => i.status === 'ready') ? {tr("Start chatting")} : <> setTuneOpen(true)}>{tr("Tune model")} void load()}>{tr(pending ? 'Checking…' : installed?.ready ? 'Load model' : 'Download & load')})}
+ {tr(expert ? <>
{tr("Image generation ")}{tr("Optional")} { }}/>
: null)} + {tr(expert ?

{tr("Expert settings")}

{tr(tunedNow ?

{tr("Showing the values of your tuning '{0}'.", [tunedNow.name])}

: null)}
: null)}{tr(gpus.length > 1 ? : null)}
{tr(installed ? :

{tr("More engine parameters become available after preparing this version.")}

)} : null)}
- !pending && setPlan(null)} actions={<> setPlan(null)}>{tr("Cancel")} void download()}>{tr(installed?.ready ? "Apply & load" : "Download & load")}}>

{tr(plan?.plan?.title ?? selectedFamily?.title)}{tr(installed?.ready ? null : <>{tr(" \u00B7 approximately ")}{tr(plan?.plan?.download_gb ?? selectedSize?.download_gb)}{tr(" GB")})}

{tr(installed?.ready ?

{tr("The model files are already on this computer. Nothing will be downloaded; only the settings you chose are applied.")}

: null)}{tr(plan?.plan?.disk_short ? : null)}{tr(installed?.ready ?

{tr("Any currently loaded native models will be unloaded first.")}

: <>

{tr("Existing files are checked and reused. Any currently loaded native models will be unloaded before preparing files.")}

{tr("Your computer may feel slower while weights load. You can stop the download and resume later.")}

)}{tr(selectedSize?.images ?

{tr("Vision encoder files are included. Picture reading loads only when enabled.")}

: null)}
+ + !pending && setPlan(null)} actions={<> setPlan(null)}>{tr("Cancel")} void download()}>{tr(installed?.ready ? "Apply & load" : "Download & load")}}>

{tr(plan?.plan?.title ?? selectedFamily?.title)}{tr(installed?.ready ? null : <>{tr(" \u00B7 approximately ")}{tr(plan?.plan?.download_gb ?? selectedSize?.download_gb)}{tr(" GB")})}

{tr(installed?.ready ?

{tr("The model files are already on this computer. Nothing will be downloaded; only the settings you chose are applied.")}

: null)}{tr(plan?.plan?.disk_short ? : null)}{tr(installed?.ready ?

{tr("Any currently loaded native models will be unloaded first.")}

: <>

{tr("Existing files are checked and reused. Any currently loaded native models will be unloaded before preparing files.")}

{tr("Your computer may feel slower while weights load. You can stop the download and resume later.")}

)}{tr(selectedSize?.images ?

{tr("Vision encoder files are included. Picture reading loads only when enabled.")}

: null)}
setDeleting(null)}/> setManage(false)} actions={ setManage(false)}>{tr("Done")}}>
{tr(downloaded.length ?
{tr(downloaded.map(m => { const v = allSizes.find(x => x.id === m.model), loaded = native?.instances.some(i => i.model === m.model && i.status === 'ready'); return
diff --git a/apps/host/src/components/NativeSettings.tsx b/apps/host/src/components/NativeSettings.tsx index 6eafc087..8b1e39bb 100644 --- a/apps/host/src/components/NativeSettings.tsx +++ b/apps/host/src/components/NativeSettings.tsx @@ -1,5 +1,6 @@ import { tr } from '../lib/i18n'; import {nativeSettingsResponse,nativeSettingsValues} from '../lib/native-settings-response'; +import { describeChange, type TunedChange } from '../lib/tune-values'; import { useEffect, useState } from 'react'; import { api } from '../lib/client'; import { refreshNative, useNative, type NativeField } from '../lib/native'; @@ -10,6 +11,7 @@ export function NativeSettings({ model }: { }) { const native = useNative(); const [revision,setRevision]=useState(0); + const [tuned, setTuned] = useState<{ preset: { name: string } | null; changed: TunedChange[] } | null>(null); const [values, setValues] = useState>({}), [mcp, setMcp] = useState('{}'), [original, setOriginal] = useState(''), [text, setText] = useState(''), [tab, setTab] = useState('fields'), [pending, setPending] = useState(false), [error, setError] = useState(''), [notice, setNotice] = useState(''), [query, setQuery] = useState(''); useEffect(() => { let active = true; @@ -22,9 +24,11 @@ export function NativeSettings({ model }: { void api.get<{ values: Record; mcp: Record; + tuned?: { preset: { name: string } | null; changed: TunedChange[] } | null; }>(`/api/native/models/${model}/settings`).then(input => { if (!active) return; + setTuned(input.tuned ?? null); const value = nativeSettingsResponse(input); setValues(value.values); setText(JSON.stringify(value.values, null, 2)); @@ -87,7 +91,7 @@ export function NativeSettings({ model }: { {error ? <> setRevision(value => value + 1)}/>
{tr('Details')}

{error}

:

{tr('Reading saved settings…')}

} ; const rows = (native?.fields ?? []).filter(f => `${tr(f.label)} ${f.id} ${tr(f.group)}`.toLowerCase().includes(query.toLowerCase())); - return
{tr("Native engine settings")}

{tr(!original ? 'Reading saved settings… ' : '')}{tr("Settings for this model. Blank values use Strata\u2019s defaults.")}

{tr(['fields', 'json', 'tools'].map(t => ))}
+ return
{tr("Native engine settings")}{tr(tuned?.changed?.length ?

{tr("Your tuning '{0}' sets", [tuned.preset?.name ?? ''])}

    {tuned.changed.map(c => { const d = describeChange(c); return
  • {d.name}{d.now || tr('off')}{d.was !== null ? {tr("was {0}", [d.was])} : null}
  • ; })}
: null)}

{tr(!original ? 'Reading saved settings… ' : '')}{tr("Settings for this model. Blank values use Strata\u2019s defaults.")}

{tr(['fields', 'json', 'tools'].map(t => ))}
{tr(tab === 'fields' ? <> setQuery(e.target.value)}/>{tr(['Responses', 'GPU & memory', 'Serving', 'Image reading', 'Tools', 'Recovery'].map(group => rows.some(f => f.group === group) ?

{tr(group)}

{tr(rows.filter(f => f.group === group).map(f => ))}
: null))}

{tr("Sampling")}

{tr([['temperature', 'Temperature'], ['top_p', 'Top-p'], ['top_k', 'Top-k'], ['min_p', 'Min-p'], ['repetition_penalty', 'Repetition penalty'], ['presence_penalty', 'Presence penalty'], ['frequency_penalty', 'Frequency penalty'], ['penalty_last_n', 'Penalty window'], ['seed', 'Seed']].map(([id, label]) =>