downloads and models: live progress, parts counted, choices kept, clear NVFP4 names, More versions list

- native state: the host's 'native' events are applied at once; the light poll (1 s while a job runs, none while hidden) is no longer
  held by a slow forced read; a read that never answers is dropped after 20 s
- install progress: every file of the model is counted (parts, picture reader beside the model folders, NVFP4 packs by their pinned sizes);
  the bar no longer sits at 99 % while the picture reader downloads; the screen names the part (part 2 of 4) and lists the parts
- a config is 'ready' only when every part of a multi-part GGUF is whole
- Models page keeps version, context, computer use, picture reading and expert choices across tabs; Read pictures is on for a version that
  is not downloaded yet; the running download is named
- version list: smaller rows, a Downloaded tag, NVFP4 / NVFP4-NVIDIA / NVFP4-QAD named by who made them with one line each
- first-run page: the four recommended versions, then a More versions list (the Models page list)
This commit is contained in:
Niko1221 committed 2026-10-18 20:47:43 +02:00
1 parent 83f2a2c73a
commit 1237d9a5fa
28 files changed
+657 -68

No files matched your search

+4 -1
View File
@@ -75,8 +75,11 @@ export function createEngineStep({ control, signal = null, onChange = () => {} }
const modelRemaining = Number.isFinite(model?.remaining_gb) ? model.remaining_gb : null;
const active = !['done', 'current', 'skipped', 'failed'].includes(part.state);
const engineRemaining = active || part.state === 'done' ? Math.max(0, part.total_gb - part.done_gb) : 0;
/* The install knows its files (strata_mcp files_progress): the model's parts and the picture reader, each counted. Without that, one
model part from the combined figures. The engine is added either way. */
const own = Array.isArray(install.parts) && install.parts.some(p => p?.kind === 'model') ? install.parts.filter(p => p?.kind !== 'engine') : null;
const parts = [
{ kind: 'model', name: model?.file ?? install.model ?? 'Model', state: install.running === false ? 'done' : 'downloading', done_gb: modelDone ?? 0, total_gb: round((modelDone ?? 0) + (modelRemaining ?? 0)) },
...(own ?? [{ kind: 'model', name: model?.file ?? install.model ?? 'Model', state: install.running === false ? 'done' : 'downloading', done_gb: modelDone ?? 0, total_gb: round((modelDone ?? 0) + (modelRemaining ?? 0)) }]),
{ ...part },
];
const merged = { ...install, engine: { ...part }, parts };
+1 -1
View File
@@ -355,7 +355,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}
const room=args.resourceProfile==='work';
return autotuner.start(job,job.kind==='recheck'?'recheck':'tune',{configPath:path,presetId:args.presetId,mode:args.mode,use:args.use,goal:room?'room':'speed',leaveRam:room?20:0,allowSmallDifferences:args.allowSmallDifferences===true,name:args.name},{onProgress:p=>{job.summary=p.text??job.summary;emit();}});
}
function operation(kind,args={}){if(!['install','load','benchmark','tune','autotune','recheck','calibrate','update-engine','update-strata','rollback','remove'].includes(kind))throw new Error('Choose a supported native operation.');if(!snapshot.available)throw new Error(snapshot.error??'Connect the native Strata installation first.');if(kind==='install'||kind==='load'){const refusal=engineRefusal(snapshot.catalog,args.model,snapshot.engineInfo);if(refusal)throw new Error(refusal);}return begin(kind,job=>kind==='install'?install(job,args):kind==='load'?loadEngine(job,args):kind==='benchmark'?benchmark(job,args):kind==='tune'?tune(job,args):kind==='autotune'||kind==='recheck'?autotune(job,args):kind==='remove'?removeModel(job,args):program(job,args),{guided:args.guided===true,model:args.model});}
function operation(kind,args={}){if(!['install','load','benchmark','tune','autotune','recheck','calibrate','update-engine','update-strata','rollback','remove'].includes(kind))throw new Error('Choose a supported native operation.');if(!snapshot.available)throw new Error(snapshot.error??'Connect the native Strata installation first.');if(kind==='install'||kind==='load'){const refusal=engineRefusal(snapshot.catalog,args.model,snapshot.engineInfo);if(refusal)throw new Error(refusal);}return begin(kind,job=>kind==='install'?install(job,args):kind==='load'?loadEngine(job,args):kind==='benchmark'?benchmark(job,args):kind==='tune'?tune(job,args):kind==='autotune'||kind==='recheck'?autotune(job,args):kind==='remove'?removeModel(job,args):program(job,args),{guided:args.guided===true,model:args.model,...(args.family?{family:args.family}:{})});}
async function cancel(id){const job=jobs.get(id);if(!job||job.state!=='running')throw new Error('This operation is no longer running.');if(job.kind==='install'){job.engineAbort?.abort();await tool('strata_install',{cancel:true});}else if(job.abort)job.abort.abort();else if(job.process){if(!['tune','calibrate','autotune','recheck'].includes(job.kind))throw new Error('File updates cannot be cancelled safely while files are being replaced.');job.state='cancelled';await stopProcess(job.process);}job.state='cancelled';job.summary=job.kind==='install'?'Stopped. Completed downloads are kept.':'Stopped.';emit();return state();}
async function close(){closing=true;clearInterval(timer);const installing=packaged&&child&&[...jobs.values()].some(j=>j.kind==='install'&&j.state==='running');if(installing)await send('tools/call',{name:'strata_install',arguments:{cancel:true}},15000).catch(()=>{});const operations=[];for(const job of jobs.values()){job.abort?.abort();if(job.process)operations.push(stopProcess(job.process));if(job.state==='running')job.state='cancelled';}await Promise.all(operations);await Promise.all([...instances.keys()].map(id=>unload(id,true).catch(()=>{})));disconnect();}
// Remove nonserializable process references from public jobs.
@@ -0,0 +1,17 @@
import { tr } from '../lib/i18n';
export interface InstallPart { kind?: string; name?: string; state?: string; done_gb?: number; total_gb?: number; files_done?: number; files_total?: number }
/**
* The parts of a download, one line each: the model (with "2/4" when it comes in parts), the picture reader, the engine. A model in several
* parts is only downloaded when every line says Done, so a person can see which part is under way instead of one bar that restarts.
*/
export function DownloadParts({ parts }: { parts: InstallPart[] | undefined }) {
if (!parts || parts.length < 2) return null;
return <ul className="native-parts" aria-label={tr("Download parts")}>
{parts.map(p => <li key={`${p.kind}-${p.name}`} data-state={p.state}>
<span>{tr(p.name)}{(p.files_total ?? 0) > 1 ? ` ${p.files_done ?? 0}/${p.files_total}` : ''}</span>
<small className="muted">{p.state === 'done' || p.state === 'current' ? tr('Done') : p.state === 'waiting' || p.state === 'pending' ? tr('Waiting') : Number.isFinite(p.done_gb) && Number.isFinite(p.total_gb) ? `${p.done_gb!.toFixed(1)} / ${p.total_gb!.toFixed(1)} GB` : ''}</small>
</li>)}
</ul>;
}
+13 -3
View File
@@ -12,7 +12,10 @@ import { nativeAction, useNative, type NativeJob } from '../lib/native';
import { completeSetup, completeSetupStep, go, newSession, openSetup, selectRemoteModel, setSettingsSection, useStore } from '../lib/store';
import type { LocalModelFolder, SetupState } from '../lib/types';
import { downloadCounter, modelFolderLabel, onboardingError } from '../lib/onboarding-download';
import { installProgress, useDownloadEta } from '../lib/download-eta';
import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta';
import { VersionPicker } from './VersionPicker';
import { DownloadParts } from './DownloadParts';
import { recommendedVersions } from '../lib/native-fit';
import { nativeCatalogModels, catalogVersionLabel } from '../lib/native-catalog';
type Choices = NonNullable<NonNullable<SetupState['choices']>['onboarding']>;
function radioKeys(event: KeyboardEvent<HTMLDivElement>) { if (!['ArrowLeft', 'ArrowRight', 'ArrowUp', 'ArrowDown', 'Home', 'End'].includes(event.key))
@@ -161,6 +164,12 @@ export function GuidedSetup() {
} });
return () => { cancelled = true; };
}, [step, plan, preparing, native?.available, version?.id, context, directory]);
const recommendedCards = recommendedVersions(selectedFamily?.sizes ?? []).map(x => x.v);
// The recommended four first, then a list with every other version (the Models page's version list); a family without a recommended set shows them all.
const cards = recommendedCards.length ? recommendedCards : selectedFamily?.sizes ?? [];
const others = recommendedCards.length ? (selectedFamily?.sizes ?? []).filter(v => !recommendedCards.includes(v)) : [];
const readyIds = new Set((native?.installed?.models ?? []).filter(m => m.ready).map(m => m.model));
const versionCard = (v: NonNullable<typeof version>) => <button key={v.id} type="button" role="radio" tabIndex={version?.id === v.id ? 0 : -1} aria-checked={version?.id === v.id} data-selected={version?.id === v.id} onClick={() => { setSize(v.id); setPlan(null); }}><span className="onboard-version-top"><span className="onboard-version-copy"><strong>{tr(catalogVersionLabel(v))}</strong><small>{tr(v.model)}</small></span><span className="onboard-version-radio">{tr(version?.id === v.id ? <Icon name="check" size={12}/> : null)}</span></span><span className="onboard-version-bottom"><span className="onboard-version-size"><Icon name="download" size={15}/>{tr(v.download_gb.toFixed(1))} <small>{tr("GB")}</small></span><span className="onboard-version-fit">{tr(v.on_this_pc === 'does not fit' || v.on_this_pc === 'tight' || v.on_this_pc?.includes('slower') || v.on_this_pc?.startsWith('experimental:') ? <><Icon name="clock" size={13}/>{tr("May run slower")}</> : v.installed ? <><Icon name="check" size={13}/>{tr("On this computer")}</> : <>{tr("Download size")}</>)}</span></span></button>;
const counter = downloadCounter(plan?.plan?.download_gb ?? version?.download_gb, progress, preparing);
const eta = useDownloadEta(preparing ? progress : undefined, installJob?.id);
const title = step === 1 ? 'State of the art. At home.' : step === 2 ? 'Select the model you want to run.' : step === 3 ? 'Downloading the model...' : tuneJob?.state === 'running' ? 'A little tuning. A better fit.' : 'How you would like to work with Strata?';
@@ -179,13 +188,14 @@ export function GuidedSetup() {
<div className="onboard-model-top"><div className="onboard-model-picker"><span className="onboard-control-label">{tr("Model")}</span><div><span className="onboard-model-symbol"><Icon name="models" size={23}/></span><Select ariaLabel={tr("Setup model")} value={selectedFamily.family} options={families.map(f => ({ value: f.family, label: f.title }))} onChange={value => chooseNative(value, '')}/></div></div><div className="onboard-context"><span className="onboard-control-label">{tr("Conversation context")}</span><Select ariaLabel={tr("Setup conversation context")} value={String(context)} options={(native?.catalog?.contexts ?? [32768]).map(n => ({ value: String(n), label: `${n / 1024}K` }))} onChange={value => setContext(Number(value))}/></div></div>
<OnboardingMemory hardware={hardware} native={native?.hardware}/>{tr(!version || version.needsNewerEngine ? <p className="small muted">{tr("This model needs a newer engine. Update your engine or import a local GGUF for this model.")}</p> : null)}
<div className="onboard-version-heading"><strong>{tr("Choose a version")}</strong><span>{tr(version ? `${catalogVersionLabel(version)} selected` : '')}</span></div>
<div className="onboard-versions" role="radiogroup" aria-label={tr("Model version")} onKeyDown={radioKeys}>{tr(selectedFamily.sizes.map(v => <button key={v.id} type="button" role="radio" tabIndex={version?.id === v.id ? 0 : -1} aria-checked={version?.id === v.id} data-selected={version?.id === v.id} onClick={() => { setSize(v.id); setPlan(null); }}><span className="onboard-version-top"><span className="onboard-version-copy"><strong>{tr(catalogVersionLabel(v))}</strong><small>{tr(v.model)}</small></span><span className="onboard-version-radio">{tr(version?.id === v.id ? <Icon name="check" size={12}/> : null)}</span></span><span className="onboard-version-bottom"><span className="onboard-version-size"><Icon name="download" size={15}/>{tr(v.download_gb.toFixed(1))} <small>{tr("GB")}</small></span><span className="onboard-version-fit">{tr(v.on_this_pc === 'does not fit' || v.on_this_pc === 'tight' || v.on_this_pc?.includes('slower') || v.on_this_pc?.startsWith('experimental:') ? <><Icon name="clock" size={13}/>{tr("May run slower")}</> : v.installed ? <><Icon name="check" size={13}/>{tr("On this computer")}</> : <>{tr("Download size")}</>)}</span></span></button>))}</div>
<div className="onboard-versions" role="radiogroup" aria-label={tr("Model version")} onKeyDown={radioKeys}>{tr(cards.map(v => versionCard(v)))}</div>
{tr(others.length ? <div className="onboard-more-versions"><VersionPicker versions={others} selectedId={version?.id ?? ''} hardware={hardware ? { ram_gb: native?.hardware?.ram_gb ?? hardware.memory.totalGb, vram_gb: Math.max(0, ...(native?.hardware?.gpus ?? []).filter(g => g.usable !== false).map(g => g.vram_gb)) } : null} downloaded={readyIds} showRecommended={false} moreLabel="More versions" onSelect={id => { setSize(id); setPlan(null); }} onOwnGguf={() => setFolderOpen(true)}/></div> : null)}
<div className="onboard-folder"><Icon name="folder" size={20}/><div><strong>{tr(directory ? 'Your model folder' : 'Already downloaded the model?')}</strong><small>{tr(directory || "Choose the folder and we'll start your models with Strata.")}</small></div><Btn size="sm" onClick={() => setFolderOpen(v => !v)}>{tr(folderOpen ? 'Close' : directory ? 'Change' : 'Choose folder')}</Btn></div>
{tr(folderOpen ? <OnboardingFolder directory={folder} onChoose={path => void perform(async () => { await nativeAction('directory', { directory: path }); setDirectory(path); setFolderOpen(false); setPlan(null); })}/> : null)}
</> : <div className="onboard-engine-connect"><Icon name="models" size={24}/><strong>{tr("Connect your Strata installation")}</strong><Btn onClick={() => void skip(false, 'Engine')}>{tr("Connect engine")}</Btn></div>)}
</div> : step === 3 ? <div className="onboard-prepare-stage">
<section className="onboard-download"><div className="onboard-download-identity"><Icon name="models" size={19}/><strong>{tr(selectedFamily?.title)}</strong><span>{tr(version ? catalogVersionLabel(version) : '')}</span><small>{tr(version?.model)}</small></div><OnboardingArt kind="download" progress={progress?.percent ?? 0} counter={counter}/><div className="onboard-download-info">
{tr(preparing ? <div><strong className="onboard-download-status">{tr(progress ? 'Downloading model files…' : 'Preparing your model…')}</strong><div className="onboard-progress" data-indeterminate={!progress}>{tr(progress ? <progress max={100} value={progress.percent ?? 0} aria-label={tr("Current file download progress")}/> : <span />)}</div><div className="onboard-progress-meta"><span>{tr(progress ? `${progress.percent ?? 0}%${Number.isFinite(progress.done_gb) && Number.isFinite(progress.total_gb) ? ` · ${progress.done_gb!.toFixed(1)} / ${progress.total_gb!.toFixed(1)} GB` : ''}` : 'Getting files ready…')}</span><div className="onboard-progress-actions">{tr(eta ? <span aria-live="off">{eta}</span> : null)}<button disabled={pending} onClick={() => void perform(async () => { await nativeAction(`operations/${installJob!.id}/cancel`); })}>{tr("Stop")}</button></div></div></div> : <>{tr(stopped ? <OnboardingError message={installJob?.error ?? 'Download stopped. Ready when you are.'} onFolder={changeDownloadFolder}/> : null)}{tr(plan?.plan?.disk_short ? <OnboardingError message={plan.plan.disk_short} onFolder={changeDownloadFolder}/> : null)}</>)}
{tr(preparing ? <div><strong className="onboard-download-status">{tr(progress ? stageText(installStage(installJob?.result?.install)) : 'Preparing your model…')}</strong><div className="onboard-progress" data-indeterminate={!progress}>{tr(progress ? <progress max={100} value={progress.percent ?? 0} aria-label={tr("Current file download progress")}/> : <span />)}</div><DownloadParts parts={installJob?.result?.install?.parts}/><div className="onboard-progress-meta"><span>{tr(progress ? `${progress.percent ?? 0}%${Number.isFinite(progress.done_gb) && Number.isFinite(progress.total_gb) ? ` · ${progress.done_gb!.toFixed(1)} / ${progress.total_gb!.toFixed(1)} GB` : ''}` : 'Getting files ready…')}</span><div className="onboard-progress-actions">{tr(eta ? <span aria-live="off">{eta}</span> : null)}<button disabled={pending} onClick={() => void perform(async () => { await nativeAction(`operations/${installJob!.id}/cancel`); })}>{tr("Stop")}</button></div></div></div> : <>{tr(stopped ? <OnboardingError message={installJob?.error ?? 'Download stopped. Ready when you are.'} onFolder={changeDownloadFolder}/> : null)}{tr(plan?.plan?.disk_short ? <OnboardingError message={plan.plan.disk_short} onFolder={changeDownloadFolder}/> : null)}</>)}
<small className="onboard-download-location" title={tr(folder)}><Icon name="folder" size={16}/><span><span>{tr("Save to")}</span><strong>{tr(modelFolderLabel(folder))}</strong></span>{tr(!preparing ? <button type="button" onClick={changeDownloadFolder}>{tr("Change")}</button> : null)}</small>
</div></section><OnboardingTour page={tour} onChange={setTour}/>
</div> : <div className="onboard-tune-stage">
+50 -32
View File
@@ -6,7 +6,9 @@ import { FamilySwitch } from './FamilySwitch';
import { PcFitCard } from './PcFitCard';
import { fitOn } from '../lib/native-fit';
import { Btn, Dialog, ErrorNotice, Icon, Select } from './ui';
import { installProgress, useDownloadEta } from '../lib/download-eta';
import { installProgress, installStage, stageText, useDownloadEta } from '../lib/download-eta';
import { useKept } from '../lib/kept-state';
import { DownloadParts } from './DownloadParts';
import { sizeGb } from '../lib/format';
import { NativeDeleteDialog } from './NativeDelete';
import { plainFailureText } from '../lib/plain-errors';
@@ -31,12 +33,14 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
onReady?: () => void;
}) {
const native = useNative(), imageLibrary = useStore(s => s.imageModels), hardware = useStore(s => s.hardware);
const [family, setFamily] = useState(''), [size, setSize] = useState(''), [context, setContext] = useState(32768), [vision, setVision] = useState('yes');
// The choices are kept while the page is closed (Models -> Monitor -> Models used to start them over and a person lost track of what was downloading).
const [family, setFamily] = useKept('models.family', ''), [size, setSize] = useKept('models.size', ''), [context, setContext] = useKept('models.context', 32768), [vision, setVision] = useKept('models.vision', 'yes');
const manual = useStore(s => s.setup?.choices?.onboarding?.manual ?? false);
const [expert, setExpert] = useState(manual), [multiple, setMultiple] = useState(false), [gpus, setGpus] = useState<number[]>([]), [kv, setKv] = useState('int8'), [lowRam, setLowRam] = useState('auto'), [split, setSplit] = useState('auto'), [deviceChoice, setDeviceChoice] = useState('auto');
const [cardsKey, setCardsKey] = useState<string | null>(null);
const [resourceProfile, setResourceProfile] = useState<'work' | 'performance'>('work');
const [pending, setPending] = useState(false), [error, setError] = useState(''), [plan, setPlan] = useState<Record<string, any> | null>(null), [loadedError, setLoadedError] = useState(''), [tuneOpen, setTuneOpen] = useState(false), [jobId, setJobId] = useState(''), [manage, setManage] = useState(false);
const [expert, setExpert] = useKept('models.expert', manual), [multiple, setMultiple] = useKept('models.multiple', false), [gpus, setGpus] = useKept<number[]>('models.gpus', []), [kv, setKv] = useKept('models.kv', 'int8'), [lowRam, setLowRam] = useKept('models.lowRam', 'auto'), [split, setSplit] = useKept('models.split', 'auto'), [deviceChoice, setDeviceChoice] = useKept('models.device', 'auto');
const [cardsKey, setCardsKey] = useKept<string | null>('models.cards', null);
const [resourceProfile, setResourceProfile] = useKept<'work' | 'performance'>('models.profile', 'work');
const [pending, setPending] = useState(false), [error, setError] = useState(''), [plan, setPlan] = useState<Record<string, any> | null>(null), [loadedError, setLoadedError] = useState(''), [tuneOpen, setTuneOpen] = useState(false), [jobId, setJobId] = useKept('models.job', ''), [manage, setManage] = useState(false);
const [toastedJob, setToastedJob] = useKept('models.toasted', ''), [appliedSig, setAppliedSig] = useKept('models.applied', '');
const presetPending = useRef(false);
const [deleting, setDeleting] = useState<string | null>(null);
const families = nativeCatalogModels(native?.catalog?.families ?? []);
@@ -56,15 +60,11 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
const keptUse = keptModels.map(i => { const s = sizeOf(i.model); const card = pcGpus.find(g => g.index === i.gpus[0]); const f = s && pcRam ? fitOn(s, { ram_gb: pcRam, vram_gb: card?.vram_gb ?? pcVram }) : null; return { gpus: i.gpus, ram: f?.ramUseGb ?? 0, vram: f?.vramUseGb ?? 0 }; });
const keptRam = keptUse.reduce((n, u) => n + u.ram, 0);
const keptVramOn = (cards: number[]) => keptUse.filter(u => u.gpus.some(g => cards.includes(g))).reduce((n, u) => n + u.vram, 0);
// The versions that are really on this computer: a config whose files are all there (every part of a model in parts).
const readyIds = useMemo(() => new Set(downloaded.filter(m => m.ready).map(m => m.model)), [downloaded]);
// What a running job works on, by its name in the list: "Qwen3.8-Flash-Next · Gyro · Smallest".
const jobLabel = (j: NativeJob) => { const v = allSizes.find(s => s.id === j.model || (s.model === j.model && (!j.family || s.sourceFamily === j.family))); const f = v && families.find(x => x.sizes.includes(v)); return v ? [f?.title, catalogVersionLabel(v)].filter(Boolean).join(' · ') : ''; };
const loadedSelected = native?.instances.find(i => i.model === selectedSize?.id && i.status === 'ready');
// A model that is already on this PC loads as it was prepared: the page shows its settings, so loading it never asks to download.
useEffect(() => { if (installed?.ready) {
if (installed.context)
setContext(installed.context);
if (installed.kv)
setKv(installed.kv as typeof kv);
setLowRam((installed.lowRamMode ?? 'auto') as typeof lowRam);
} }, [installed?.model, installed?.ready, installed?.context, installed?.kv, installed?.lowRamMode]);
// 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]);
@@ -93,7 +93,8 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
const gpuNumbers = (text: string) => text.replace(/\(card (\d+)\)/g, (_m, n) => `(GPU ${Number(n) + 1})`);
// The fit sentence for a card choice, less what the kept models take of RAM and of that card's memory.
const lessKept = (words: string, cards: number[]) => { const gone = Math.round(keptRam + keptVramOn(cards)); return gone > 0 ? words.replace(/of the (\d+) GB available/, (_m, n) => `of the ${Math.max(0, Number(n) - gone)} GB available`) : words; };
useEffect(() => { setCardsKey(null); }, [selectedSize?.id]);
const shownSize = useRef(selectedSize?.id);
useEffect(() => { if (shownSize.current !== selectedSize?.id) { shownSize.current = selectedSize?.id; setCardsKey(null); } }, [selectedSize?.id]);
const values = useMemo(() => ({ family: selectedSize?.sourceFamily, model: selectedSize?.model, context, vision: selectedSize?.images ? vision : 'no', kv, low_ram: lowRam, resourceProfile, ...(expert && gpus.length ? { gpus: gpus.join(',') } : cardsGpus.length > 1 ? { gpus: cardsGpus.join(',') } : cardsGpus.length === 1 ? { gpu: cardsGpus[0] } : {}), loadAfter: true, multiple: expert && multiple }), [selectedSize?.sourceFamily, selectedSize?.model, context, vision, kv, lowRam, resourceProfile, gpus.join(','), cardsGpus.join(','), expert, multiple]);
const downloadValues = { ...values, vision: selectedSize?.images ? 'yes' : 'no', loadVision: selectedSize?.images ? vision : 'no' };
useEffect(() => { if (!native?.catalog || family)
@@ -102,19 +103,35 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
setSize(f.sizes.find(s => s.id === current?.model)?.id ?? f.sizes.find(s => have.has(s.id))?.id ?? f.sizes.find(s => s.model === rec.model)?.id ?? f.sizes[0]?.id ?? '');
setContext(('context' in rec ? rec.context : undefined) ?? 32768);
} }, [native?.catalog]);
useEffect(() => { if (presetPending.current) {
presetPending.current = false;
return;
} if (installed) {
setContext(installed.context ?? 32768);
setVision(installed.visionEnabled === false || installed.images === 'off' ? 'no' : installed.visionDevice ?? installed.images ?? 'yes');
setKv(installed.kv ?? 'int8');
setLowRam(installed.lowRamMode ?? 'auto');
// A model never tuned has no saved choice: keep the page's own (Leave 20%) rather than flipping to Full performance.
if (installed.resourceProfile && !loadedSelected?.resourceProfile)
setResourceProfile(installed.resourceProfile);
} }, [installed?.model, installed?.context, installed?.kv, installed?.images, installed?.visionEnabled, installed?.visionDevice, installed?.lowRamMode, installed?.resourceProfile]);
useEffect(() => { if (jobId && job?.state === 'done' && (job.kind === 'load' || job.kind === 'install')) {
// The version that is selected: a model already on this PC shows the settings it was prepared with (so loading it never asks to download);
// a model that is not yet downloaded starts with Read pictures ON (owner rule: pictures on by default). This runs when the SELECTION or the
// installed settings change, not when the page opens again: coming back from another tab keeps what was chosen.
useEffect(() => {
if (presetPending.current) {
presetPending.current = false;
return;
}
if (!selectedSize)
return;
const sig = installed ? ['have', installed.model, installed.ready, installed.context, installed.kv, installed.images, installed.visionEnabled, installed.visionDevice, installed.lowRamMode, installed.resourceProfile].join('|') : `new|${selectedSize.id}`;
if (sig === appliedSig)
return;
setAppliedSig(sig);
if (installed) {
if (installed.context)
setContext(installed.context);
setVision(installed.visionEnabled === false || installed.images === 'off' ? 'no' : installed.visionDevice ?? installed.images ?? 'yes');
setKv(installed.kv ?? 'int8');
setLowRam(installed.lowRamMode ?? 'auto');
// A model never tuned has no saved choice: keep the page's own (Leave 20%) rather than flipping to Full performance.
if (installed.resourceProfile && !loadedSelected?.resourceProfile)
setResourceProfile(installed.resourceProfile);
}
else
setVision('yes');
}, [selectedSize?.id, installed?.model, installed?.ready, installed?.context, installed?.kv, installed?.images, installed?.visionEnabled, installed?.visionDevice, installed?.lowRamMode, installed?.resourceProfile]);
useEffect(() => { if (jobId && job?.state === 'done' && job.id !== toastedJob && (job.kind === 'load' || job.kind === 'install')) {
setToastedJob(job.id);
selectRemoteModel(null);
pushToast('success', 'Model ready', 'Start a new chat when you’re ready.');
} }, [job?.state]);
@@ -153,7 +170,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
{tr(selectedSize ? <>
<div className="native-choice__head"><span className="native-choice__label">{tr("Version")}</span><span className="native-choice__tools"><NativePresets values={values} onApply={v => { 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'); }}/><Btn icon="models" onClick={() => setManage(true)}>{tr("Manage models")}</Btn></span></div>
<div className="native-version"><VersionPicker versions={allSizes} selectedId={selectedSize.id} hardware={fitHardware} onSelect={id => { const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/></div>
<div className="native-version"><VersionPicker versions={allSizes} selectedId={selectedSize.id} hardware={fitHardware} downloaded={readyIds} onSelect={id => { const f = families.find(f => f.sizes.some(s => s.id === id)); if (f) { setFamily(f.family); setSize(id); setError(''); } }} onOwnGguf={() => (onImport ?? onOtherModels)()}/></div>
{tr(noFit ? <p className="small muted native-spill-note"><Icon name="disk" size={16}/>{tr("May run slower \u00B7 Model data can be read from SSD.")}</p> : null)}
<div className="native-choice__row">
<div className="native-choice__col"><span className="native-choice__label">{tr("Conversation context")}</span><Select ariaLabel={tr("Conversation context")} value={String(context)} options={(native?.catalog?.contexts ?? [8192, 32768, 65536, 131072, 262144]).map(n => ({ value: String(n), label: `${n / 1024}K` }))} onChange={n => setContext(Number(n))}/></div>
@@ -163,7 +180,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine
{tr(selectedSize?.imagesCapable && !selectedSize.images ? <p className="small muted native-spill-note">{tr("This model can read pictures, but the engine installed here does not include the picture reader yet, so Read pictures is off. Update the engine in Settings → About to turn it on.")}</p> : null)}
{tr(selectedSize?.images ? <><div className="native-image-reading"><label><input type="checkbox" checked={vision !== 'no'} disabled={!selectedSize?.images || !!active} onChange={e => setVision(e.target.checked ? 'yes' : 'no')}/><span><strong>{tr("Read pictures ")}<small>{tr("On by default")}</small></strong><small>{tr("Understand photos, screenshots and charts. The picture files download automatically. Turn it off to save memory.")}</small></span></label>{tr(expert && vision !== 'no' ? <Select ariaLabel={tr("Image encoder device")} value={vision === 'yes' ? 'yes' : vision} options={[{ value: 'yes', label: 'Automatic' }, { value: 'gpu', label: 'GPU' }, { value: 'cpu', label: 'CPU' }]} onChange={setVision}/> : null)}</div>{tr(vision !== 'no' && installed?.ready && installed.visionPrepared === false ? <div className="native-vision-missing" role="status"><span>{tr("Picture reading needs a few more files that are not on this computer yet.")}</span><Btn size="sm" disabled={pending || !!active} onClick={() => void download()}>{tr("Download picture-reading files")}</Btn></div> : null)}</> : null)}
</> : null)}
{tr(active ? <NativeProgress job={active}/> : null)}
{tr(active ? <NativeProgress job={active} label={jobLabel(active)}/> : null)}
{tr(job?.state === 'error' ? <ErrorNotice message={job.error ?? job.summary} action={tr("Retry")} onRetry={() => void load()}/> : null)}
{tr(error ? <ErrorNotice message={error}/> : null)}
{selectedSize && installed?.ready ? <NativeTuneBadge model={selectedSize.id} resourceProfile={resourceProfile} vision={selectedSize.images ? vision : 'no'}/> : null}
@@ -195,8 +212,9 @@ function installStepLabel(step?: string): string {
return step ? 'Getting things ready…' : 'Downloading and preparing model files…';
return n <= 2 ? 'Checking your computer…' : n <= 4 ? 'Getting things ready…' : n === 5 ? 'Downloading your model…' : n === 6 ? 'Preparing your model for Strata…' : 'Finishing up…';
}
export function NativeProgress({ job }: {
export function NativeProgress({ job, label }: {
job: NativeJob;
label?: string;
}) { const download = installProgress(job.result?.install); const detailsText = [job.details, job.result?.install?.engine?.details].filter(Boolean).join('\n'); const eta = useDownloadEta(job.kind === 'install' ? download : undefined, job.id); const [stopping, setStopping] = useState(false), [error, setError] = useState(''); async function stop() { setStopping(true); setError(''); try {
await nativeAction(`operations/${job.id}/cancel`);
}
@@ -205,4 +223,4 @@ catch (e) {
}
finally {
setStopping(false);
} } return <section className="st-card native-progress" aria-live="polite"><div className="section-toolbar"><h2 className="h4">{tr(job.kind === 'install' ? 'Preparing your model' : job.kind === 'load' ? 'Loading model' : job.kind === 'autotune' || job.kind === 'recheck' ? 'Tuning your model' : 'Engine operation')}</h2>{tr(job.kind === 'install' || job.kind === 'load' || job.kind === 'autotune' || job.kind === 'recheck' ? <div className="onboard-progress-actions">{tr(eta ? <span className="small muted">{eta}</span> : null)}<Btn size="sm" disabled={stopping} onClick={() => void stop()}>{tr(stopping ? 'Stopping…' : 'Stop')}</Btn></div> : null)}</div><p className="small">{tr(job.kind === 'install' ? installStepLabel(job.result?.install?.step) : job.summary)}</p>{tr(download ? <><progress max={100} value={download.percent ?? 0}/><p className="xs muted">{tr(download.file === 'model files' ? 'Model files' : download.file)} · {tr(download.percent ?? 0)}%{tr(Number.isFinite(download.done_gb) && Number.isFinite(download.total_gb) ? ` · ${download.done_gb!.toFixed(1)} / ${download.total_gb!.toFixed(1)} GB` : '')}</p></> : null)}{tr(detailsText ? <details><summary className="small">{tr("Details")}</summary><pre className="small muted error-detail-text">{detailsText}</pre></details> : null)}{tr(error ? <ErrorNotice message={error}/> : null)}</section>; }
} } return <section className="st-card native-progress" aria-live="polite"><div className="section-toolbar"><h2 className="h4">{tr(job.kind === 'install' ? (label ? tr('Preparing {0}', [label]) : 'Preparing your model') : job.kind === 'load' ? 'Loading model' : job.kind === 'autotune' || job.kind === 'recheck' ? 'Tuning your model' : 'Engine operation')}</h2>{tr(job.kind === 'install' || job.kind === 'load' || job.kind === 'autotune' || job.kind === 'recheck' ? <div className="onboard-progress-actions">{tr(eta ? <span className="small muted">{eta}</span> : null)}<Btn size="sm" disabled={stopping} onClick={() => void stop()}>{tr(stopping ? 'Stopping…' : 'Stop')}</Btn></div> : null)}</div><p className="small">{tr(job.kind === 'install' ? (download && /^5\//.test(job.result?.install?.step ?? '') ? stageText(installStage(job.result?.install)) : installStepLabel(job.result?.install?.step)) : job.summary)}</p>{tr(download ? <><progress max={100} value={download.percent ?? 0}/><p className="xs muted">{tr(download.file === 'model files' ? 'Model files' : download.file === 'picture reader' ? 'Picture reader' : download.file)} · {tr(download.percent ?? 0)}%{tr(Number.isFinite(download.done_gb) && Number.isFinite(download.total_gb) ? ` · ${download.done_gb!.toFixed(1)} / ${download.total_gb!.toFixed(1)} GB` : '')}</p></> : null)}<DownloadParts parts={job.result?.install?.parts}/>{tr(detailsText ? <details><summary className="small">{tr("Details")}</summary><pre className="small muted error-detail-text">{detailsText}</pre></details> : null)}{tr(error ? <ErrorNotice message={error}/> : null)}</section>; }
+22 -11
View File
@@ -3,14 +3,16 @@ import { tr } from '../lib/i18n';
import { Icon } from './ui';
import { FloatingMenu } from './FloatingMenu';
import { cx } from '../lib/format';
import type { CatalogVersion } from '../lib/native-catalog';
import { RECOMMENDED, VERSION_GROUPS, fitOn, groupOpen, type FitHardware } from '../lib/native-fit';
import { versionNote, type CatalogVersion } from '../lib/native-catalog';
import { nvfp4Version } from '../lib/native-names';
import { VERSION_GROUPS, fitOn, groupOpen, recommendedVersions, type FitHardware } from '../lib/native-fit';
/** The name a version goes by in the list: the quantization, with the maker where the quantization alone is ambiguous. */
export function versionName(v: CatalogVersion, withMaker = false): string {
switch (v.sourceFamily) {
case 'swift': return `Swift ${v.model}`;
case 'unsloth': return `Unsloth ${v.model}`;
case 'nvfp4': return tr(nvfp4Version(v.model)?.name ?? v.model);
case 'coder': return `Coder ${v.model}`;
case 'qwen': return withMaker ? `${v.model} (GSQ-RCO)` : v.model;
default: return v.model;
@@ -24,43 +26,52 @@ const gb = (n: number) => `${Number.isInteger(n) ? n : n.toFixed(1)} GB`;
* which stays on the SSD, is not in it); the download size is secondary. "Uses SSD N GB" appears only where this computer would read
* part of the model from its SSD. The first group is a fixed list of four; the rest fold away.
*/
export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnGguf }: {
export function VersionPicker({ versions, selectedId, hardware, onSelect, onOwnGguf, downloaded, showRecommended = true, moreLabel }: {
versions: CatalogVersion[];
selectedId: string;
hardware: FitHardware | null | undefined;
onSelect: (id: string) => void;
onOwnGguf: () => void;
/** The versions already on this computer (ready to load): each gets a small "Downloaded" tag. */
downloaded?: ReadonlySet<string>;
/** False where the recommended four are shown elsewhere (the first-run page): the menu then holds only the groups. */
showRecommended?: boolean;
/** What the button says while the selected version is one of the recommended four shown elsewhere. */
moreLabel?: string;
}) {
const trigger = useRef<HTMLButtonElement>(null);
const [open, setOpen] = useState(false);
// A group is open when the person opened it; until they touch it, only the group that holds the selected version is open.
const [opened, setOpened] = useState<Record<string, boolean>>({});
const selected = versions.find(v => v.id === selectedId);
const recommended = RECOMMENDED.map(r => ({ r, v: versions.find(v => v.sourceFamily === r.family && v.model === r.model) })).filter((x): x is { r: typeof RECOMMENDED[number]; v: CatalogVersion } => !!x.v);
const recommended = recommendedVersions(versions);
// Where the recommended four are shown outside the menu, the menu holds only the others.
const apart = new Set(showRecommended ? [] : recommended.map(x => x.v.id));
const rest = versions.filter(v => !apart.has(v.id));
const groups = [
...VERSION_GROUPS.map(g => ({ id: g.id, title: g.title, items: versions.filter(v => g.families.includes(v.sourceFamily)) })),
{ id: 'other', title: 'Qwen3.6 models', items: versions.filter(v => !VERSION_GROUPS.some(g => g.families.includes(v.sourceFamily))) },
...VERSION_GROUPS.map(g => ({ id: g.id, title: g.title, items: rest.filter(v => g.families.includes(v.sourceFamily)) })),
{ id: 'other', title: 'Qwen3.6 models', items: rest.filter(v => !VERSION_GROUPS.some(g => g.families.includes(v.sourceFamily))) },
].filter(g => g.items.length);
const row = (v: CatalogVersion, label: string, note?: string) => {
const fit = fitOn(v, hardware);
const on = v.id === selectedId;
const line = versionNote(v.model);
return <button key={`${label}-${v.id}`} role="menuitemradio" aria-checked={on} className={cx('version-row', on && 'is-on')} onClick={() => { onSelect(v.id); setOpen(false); }}>
<span className="version-row__name">{tr(on ? <Icon name="check" size={14}/> : null)}<strong>{label}</strong>{tr(note ? <span className="muted"> · {tr(note)}</span> : null)}{tr(fit.known && fit.spillGb >= 1 ? <span className="version-row__ssd">{tr("Uses SSD {0} GB", [Math.round(fit.spillGb)])}</span> : null)}</span>
<span className="version-row__name"><span className="version-row__title">{tr(on ? <Icon name="check" size={14}/> : null)}<strong>{label}</strong>{tr(note ? <span className="muted"> · {tr(note)}</span> : null)}{tr(downloaded?.has(v.id) ? <span className="version-row__have">{tr("Downloaded")}</span> : null)}{tr(fit.known && fit.spillGb >= 1 ? <span className="version-row__ssd">{tr("Uses SSD {0} GB", [Math.round(fit.spillGb)])}</span> : null)}</span>{tr(line ? <small className="version-row__note muted">{line}</small> : null)}</span>
<span className="version-row__ram">{gb(fit.memoryGb)}</span>
<span className="version-row__dl">{gb(v.download_gb)}</span>
</button>;
};
const fit = selected ? fitOn(selected, hardware) : null;
const fit = selected && !apart.has(selected.id) ? fitOn(selected, hardware) : null;
return <>
<button ref={trigger} type="button" className="version-trigger" aria-haspopup="menu" aria-expanded={open} aria-label={tr("Model version")} onClick={() => setOpen(v => !v)}>
<strong>{selected ? versionName(selected, true) : tr("Choose a version")}</strong>
<strong>{selected && !apart.has(selected.id) ? versionName(selected, true) : tr(moreLabel ?? "Choose a version")}</strong>{tr(selected && !apart.has(selected.id) && downloaded?.has(selected.id) ? <span className="version-row__have">{tr("Downloaded")}</span> : null)}
<span className="version-trigger__need muted">{tr(fit ? `${gb(fit.memoryGb)} RAM + VRAM` : '')}</span>
<Icon name="chevron" size={14} className="version-trigger__chev"/>
</button>
{tr(open ? <FloatingMenu anchor={trigger.current} title={tr("Model version")} width={620} onClose={() => setOpen(false)}>
<div className="version-menu">
<div className="version-head"><span>{tr("Recommended")}</span><span>{tr("RAM + VRAM")}</span><span>{tr("Download")}</span></div>
{tr(recommended.map(({ r, v }) => row(v, versionName(v, true), r.note)))}
{tr(showRecommended ? <><div className="version-head"><span>{tr("Recommended")}</span><span>{tr("RAM + VRAM")}</span><span>{tr("Download")}</span></div>{tr(recommended.map(({ r, v }) => row(v, versionName(v, true), r.note)))}</> : <div className="version-head"><span>{tr("All other versions")}</span><span>{tr("RAM + VRAM")}</span><span>{tr("Download")}</span></div>)}
{tr(groups.map(g => {
const closed = !groupOpen(opened, g.id, g.items.some(v => v.id === selectedId));
return <div className="version-group" key={g.id} data-open={!closed || undefined}>
+1 -1
View File
@@ -47,7 +47,7 @@ export interface StreamEvent {
export function onEvent(handler: (e: StreamEvent) => void, onStatus?: (s: 'live' | 'offline') => void) {
let source: EventSource;
let seenAt = Date.now();
const names = ['engine', 'monitor', 'models', 'image-models', 'runtime', 'providers', 'serving', 'download', 'log', 'setup', 'skills', 'task', 'goal', 'timeskip', 'plan', 'queue'];
const names = ['engine', 'monitor', 'models', 'native', 'image-models', 'runtime', 'providers', 'serving', 'download', 'log', 'setup', 'skills', 'task', 'goal', 'timeskip', 'plan', 'queue'];
const connect = () => {
source?.close();
seenAt = Date.now();
+19
View File
@@ -53,3 +53,22 @@ export function installProgress(install: InstallParts | undefined): { done_gb: n
if (d && Number.isFinite(d.done_gb) && Number.isFinite(d.total_gb)) return { done_gb: d.done_gb!, total_gb: d.total_gb!, remaining_gb: Number.isFinite(d.remaining_gb) ? d.remaining_gb! : Math.max(0, d.total_gb! - d.done_gb!), percent: d.percent ?? 0, file: d.file };
return undefined;
}
/** Which part of a multi-part install is being fetched now: the model's parts (with "part 2 of 4"), the picture reader or the engine. */
export interface InstallStage { kind: 'model' | 'vision' | 'engine' | 'other'; index?: number; count?: number }
export function installStage(install: { parts?: { kind?: string; state?: string; files_done?: number; files_total?: number }[]; running?: boolean } | undefined): InstallStage | undefined {
const parts = install?.parts ?? [];
const now = parts.find(p => p.state === 'downloading') ?? parts.find(p => !['done', 'current', 'skipped', 'failed'].includes(p.state ?? ''));
if (!now) return undefined;
const kind = now.kind === 'model' || now.kind === 'vision' || now.kind === 'engine' ? now.kind : 'other';
const count = Number(now.files_total) > 1 ? Number(now.files_total) : undefined;
return { kind, ...(count ? { index: Math.min(count, Number(now.files_done ?? 0) + 1), count } : {}) };
}
/** The sentence for it, in plain words. */
export function stageText(stage: InstallStage | undefined): string {
if (!stage) return tr('Downloading model files…');
if (stage.kind === 'vision') return tr('Downloading the picture reader…');
if (stage.kind === 'engine') return tr('Downloading the engine for this PC…');
if (stage.count && stage.index) return tr('Downloading model files · part {0} of {1}', [stage.index, stage.count]);
return tr('Downloading model files…');
}
+23
View File
@@ -0,0 +1,23 @@
import { useCallback, useEffect, useState, type Dispatch, type SetStateAction } from 'react';
/**
* A piece of screen state that survives leaving the screen. The Models page keeps its choices (version, context, computer use, picture
* reading ...) in useState, so going to Monitor and back reset them and a person lost track of what they were downloading. Kept values
* live in memory for the whole session (not on disk: a new start begins from the installed model again).
*/
const kept = new Map<string, unknown>();
export function useKept<T>(key: string, initial: T): [T, Dispatch<SetStateAction<T>>] {
const [value, setValue] = useState<T>(() => (kept.has(key) ? kept.get(key) as T : initial));
useEffect(() => { kept.set(key, value); }, [key, value]);
const set = useCallback<Dispatch<SetStateAction<T>>>(next => setValue(old => {
const result = typeof next === 'function' ? (next as (o: T) => T)(old) : next;
kept.set(key, result);
return result;
}), [key]);
return [value, set];
}
export const keptValue = <T,>(key: string): T | undefined => kept.get(key) as T | undefined;
/** Forget everything kept (tests, and a changed installation). */
export const forgetKept = () => kept.clear();
+4 -1
View File
@@ -1,9 +1,12 @@
import type {NativeFamily,NativeSize} from './native';
import {tr} from './i18n';
import {nvfp4Version} from './native-names';
export interface CatalogVersion extends NativeSize{sourceFamily:string;edition:string;images:boolean}
export interface CatalogModel extends Omit<NativeFamily,'sizes'>{sizes:CatalogVersion[]}
export function nativeVersionLabel(model:string){return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory'} as Record<string,string>)[model]??model);}
export function nativeVersionLabel(model:string){const nv=nvfp4Version(model);if(nv)return tr(nv.name);return tr(({Q2_0:'Fastest',IQ2_XS:'Compact',IQ3_XXS:'Balanced',IQ3_S:'High quality',IQ1_M:'Coding','Gyro-S':'Smallest','Gyro-M':'Small memory'} as Record<string,string>)[model]??model);}
export const catalogVersionLabel=(version:CatalogVersion)=>{const label=nativeVersionLabel(version.model);return [tr(version.edition),label===version.model&&version.edition?'':label].filter(Boolean).join(' · ');};
/** The one line that says how a version differs from its neighbours (the three NVFP4 versions); empty for the rest. */
export const versionNote=(model:string)=>{const nv=nvfp4Version(model);return nv?tr(nv.note):'';};
/** Display groups are distinct from the engine's installation family IDs. */
export function nativeCatalogModels(families:NativeFamily[]):CatalogModel[]{
if(!families.length)return[];
+5
View File
@@ -61,3 +61,8 @@ export const RECOMMENDED: { family: string; model: string; note: string }[] = [
/** Is a group of the version list open? What the person chose wins; until they touch it, only the group holding the selected version is open
* (the running version's group used to stay open whatever was clicked). */
export const groupOpen = (opened: Record<string, boolean>, id: string, containsSelected: boolean): boolean => opened[id] ?? containsSelected;
/** The recommended four, found in a version list (a version the catalog does not offer is skipped). */
export function recommendedVersions<V extends { sourceFamily: string; model: string }>(versions: V[]): { r: typeof RECOMMENDED[number]; v: V }[] {
return RECOMMENDED.map(r => ({ r, v: versions.find(v => v.sourceFamily === r.family && v.model === r.model) })).filter((x): x is { r: typeof RECOMMENDED[number]; v: V } => !!x.v);
}
+15
View File
@@ -4,12 +4,27 @@
*/
const FAMILIES: [string, string][] = [['swift-', 'Swift'], ['coder-', 'Coder'], ['unsloth-', 'Unsloth'], ['gyro-gyro-', 'Gyro'], ['gyro-', 'Gyro'], ['nvfp4-', 'NVFP4'], ['qwen36-', 'Qwen3.6']];
/**
* The three NVFP4 versions, named by who made the weights (the plain model names NVFP4 / NVFP4-NVIDIA / NVFP4-QAD looked like the same thing):
* - NVFP4: Strata's own GPTQ conversion of Qwen's weights, the best quality of the three;
* - NVFP4-NVIDIA: NVIDIA's own NVFP4 checkpoint (plain rounding), converted for Strata, the same size and speed;
* - NVFP4-QAD: NVIDIA's FP4 checkpoint that was trained for FP4 (quantization-aware distillation), slightly faster on short prompts.
* `note` is the one line that says how they differ.
*/
export const NVFP4_VERSIONS: Record<string, { name: string; note: string }> = {
'NVFP4': { name: 'NVFP4 (Strata’s version)', note: 'Strata’s own conversion. The best quality of the NVFP4 versions.' },
'NVFP4-NVIDIA': { name: 'NVFP4 (NVIDIA’s version)', note: 'NVIDIA’s own NVFP4 checkpoint, converted for Strata. Same size and speed.' },
'NVFP4-QAD': { name: 'NVFP4 (NVIDIA, trained for FP4)', note: 'NVIDIA’s FP4 checkpoint, trained for FP4. Slightly faster on short prompts.' },
};
export const nvfp4Version = (model: string) => NVFP4_VERSIONS[String(model ?? '').toUpperCase()];
export function nativeShortName(id: string): string {
const lower = String(id ?? '').toLowerCase();
for (const [prefix, label] of FAMILIES) {
if (!lower.startsWith(prefix)) continue;
const rest = lower.slice(prefix.length).toUpperCase();
if (!rest) return label;
if (label === 'NVFP4') return nvfp4Version(rest)?.name ?? `${label} ${rest}`;
return label === 'Gyro' ? `Gyro-${rest.replace(/^GYRO-/, '')}` : `${label} ${rest}`;
}
return lower.toUpperCase() || String(id);
+46 -5
View File
@@ -6,17 +6,58 @@ export interface GpuChoice {options:GpuChoiceOption[];recommended:string|null;ig
export interface NativeSize {/** The first engine that reads this size's files (the catalog), and whether the installed engine is older: the screen then says "needs a newer engine" and offers the update. */engine_min?:string|null;needsNewerEngine?:boolean;id:string;model:string;about:string;download_gb:number;ram_needed_gb:number;experts_gb:number;on_this_pc:string|null;installed:boolean;gpu_options?:GpuChoice|null;images?:boolean;imagesCapable?:boolean}
export interface NativeFamily {family:string;title:string;about:string;experimental:boolean;images:boolean;sizes:NativeSize[]}
export interface NativeField {id:string;label:string;group:string;type:'number'|'boolean'|'string'|'enum'|'array';min?:number;max?:number;choices?:string[];hint?:string;supported?:boolean}
export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;state:'running'|'done'|'error'|'cancelled';startedAt:string;summary:string;error:string|null;details?:string;result:Record<string,any>|null;progress?:Record<string,any>|null}
export interface NativeJob {id:string;kind:string;guided?:boolean;model?:string;family?:string;state:'running'|'done'|'error'|'cancelled';startedAt:string;summary:string;error:string|null;details?:string;result:Record<string,any>|null;progress?:Record<string,any>|null}
export interface NativeInstance {id:string;apiModelId:string;model:string;label:string;aliases?:string[];vision?:boolean;resourceProfile?:'work'|'performance'|null;context?:number;port:number;gpus:number[];status:'loading'|'ready'|'unloading'|'error';phase:string;loadedAt:string;error:string|null;metrics:Record<string,any>|null}
export interface NativeState {
/** The picture reader (strata-vision) is installed with the engine, so models marked for pictures can read them here. */
visionReader?: boolean;available:boolean;repo:string;downloadDirectory?:string;version?:string|null;summary:string;error:string|null;catalog:{families:NativeFamily[];contexts:number[];recommendation:{family:string|null;model:string|null;context?:number;why?:string};context_note:string}|null;installed:{models:{model:string;config:string;model_name:string;ready:boolean;/** The picture-reading files are on this computer (notes-split-agent8.md, item 8). */visionPrepared?:boolean;context?:number;kv?:string;images?:string;visionEnabled?:boolean;visionDevice?:string;lowRamMode?:string;resourceProfile?:'work'|'performance';dataFolder?:string;diskGb?:number;diskBytes?:number;missing_files?:string[]}[];data_folder:string;engine:{version:string|null}}|null;hardware:{ram_gb:number;gpus:{index:number;name:string;vram_gb:number;usable:boolean}[]}|null;fields:NativeField[];instances:NativeInstance[];defaultId:string|null;jobs:NativeJob[];capabilities:{responses?:boolean;updates:boolean;rollback:boolean;calibration:boolean;componentUpdates?:boolean}}
let state:NativeState|null=null,timer:ReturnType<typeof setInterval>|null=null,reading:Promise<void>|null=null;
let state:NativeState|null=null;
const listeners=new Set<()=>void>();
let again=false;
function put(value:NativeState){if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}
/** The host pushes its whole native state (jobs included) at every progress step: the page shows it at once, without waiting for the next poll. */
export function applyNativeEvent(value:unknown){if(value&&typeof value==='object'&&'available' in value&&'jobs' in value)put(value as NativeState);}
const READ_LIMIT_MS=20000;
function read(force:boolean):Promise<void>{
const request=api.get<NativeState>(`/api/native${force?'?refresh=1':''}`);
// A read that never answers must not freeze the page: after the limit the next poll starts a fresh one.
let stop:ReturnType<typeof setTimeout>|undefined;
const limit=new Promise<never>((_,reject)=>{stop=setTimeout(()=>reject(new Error('The host did not answer in time.')),READ_LIMIT_MS);});
return Promise.race([request,limit]).then(put).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>clearTimeout(stop));
}
/* Two kinds of read that never wait for each other: the light poll (the host answers at once with the jobs it holds) and the forced read after an action (the host
re-reads the installation, which can take many seconds while a download is writing). A slow forced read used to hold every later poll, so a running download looked stuck. */
let light:Promise<void>|null=null,forced:Promise<void>|null=null,again=false;
/** A forced refresh (after an action) never joins a read that began before the action: that read cannot know about the new job. It waits for it, then reads again. */
export function refreshNative(force=false):Promise<void>{if(reading){if(!force)return reading;if(again)return reading;again=true;return reading.then(()=>{again=false;return refreshNative(true);});}reading=api.get<NativeState>(`/api/native${force?'?refresh=1':''}`).then(value=>{if(state&&JSON.stringify(state)===JSON.stringify(value))return;state=value;listeners.forEach(fn=>fn());}).catch(error=>{if(state){state={...state,error:error.message,instances:state.instances.map(i=>({...i,metrics:null,phase:'unavailable'}))};listeners.forEach(fn=>fn());}}).finally(()=>{reading=null;});return reading;}
export function useNative(){const value=useSyncExternalStore(fn=>{listeners.add(fn);return()=>listeners.delete(fn);},()=>state);useEffect(()=>{void refreshNative();if(!timer)timer=setInterval(()=>void refreshNative(),2500);return()=>{if(!listeners.size&&timer){clearInterval(timer);timer=null;}};},[]);return value;}
export function refreshNative(force=false):Promise<void>{
if(!force){if(light)return light;light=read(false).finally(()=>{light=null;});return light;}
if(forced){if(again)return forced;again=true;return forced.then(()=>{again=false;return refreshNative(true);});}
forced=read(true).finally(()=>{forced=null;});return forced;
}
const POLL_MS=2500,RUNNING_POLL_MS=1000;
let users=0,timeout:ReturnType<typeof setTimeout>|null=null,watching=false;
const hidden=()=>typeof document!=='undefined'&&document.visibilityState==='hidden';
/** How long until the next poll: quicker while a download or load is running, none while the window is hidden (it reads again the moment it is shown). */
export const nativePollDelay=(value:NativeState|null,isHidden=false):number|null=>isHidden?null:value?.jobs?.some(j=>j.state==='running')?RUNNING_POLL_MS:POLL_MS;
function schedule(){
if(timeout){clearTimeout(timeout);timeout=null;}
if(!users)return;
const wait=nativePollDelay(state,hidden());
if(wait===null)return;
timeout=setTimeout(()=>{timeout=null;void refreshNative().finally(schedule);},wait);
}
const shown=()=>{if(!hidden()&&users){void refreshNative();schedule();}};
export function useNative(){
const value=useSyncExternalStore(fn=>{listeners.add(fn);return()=>listeners.delete(fn);},()=>state);
useEffect(()=>{
users++;void refreshNative().finally(schedule);
if(!watching&&typeof document!=='undefined'){watching=true;document.addEventListener('visibilitychange',shown);window.addEventListener('focus',shown);}
return()=>{users--;if(!users){if(timeout){clearTimeout(timeout);timeout=null;}if(watching&&typeof document!=='undefined'){watching=false;document.removeEventListener('visibilitychange',shown);window.removeEventListener('focus',shown);}}};
},[]);
// a new job (or its end) changes how fast the next poll should come
const running=value?.jobs?.some(j=>j.state==='running')??false;
useEffect(()=>{schedule();},[running]);
return value;
}
export const nativeState=()=>state;
/** Connection-list projection only; memory reservations are not inferred. */
export function nativeRouting(native:NativeState|null,hardware:Hardware|null):RuntimeModels|null{
+4 -1
View File
@@ -11,7 +11,7 @@ import { PREVIEW_EXAMPLES, type PreviewArtifact } from './artifacts';
import { lifecyclePolicy } from './lifecycle';
import { newestServingState } from './serving-state';
import { photoData, uploadChatPhotos, photoHistorySlots, pendingChatPhotos, takeChatPhotos } from './chat-photos';
import { nativeState } from './native';
import { applyNativeEvent, nativeState } from './native';
import { pictureStatus } from './pictures';
import { taskHandoverMessage, taskHandoverTitle } from './task-handover';
import type { Task } from './tasks';
@@ -641,6 +641,9 @@ function applyEvent(e: StreamEvent) {
case 'runtime':
set({runtime:data as unknown as RuntimeModels});
break;
case 'native':
applyNativeEvent(data);
break;
case 'image-models':
if (Array.isArray(data.variants)) set({ imageModels: data as unknown as ImageModelLibrary });
break;
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "Was sie getan hat",
"s3226": "Dateien",
"s3227": "Bitte hilf mir, von hier aus weiterzumachen.",
"s3228": "…und {0} weitere Schritte"
"s3228": "…und {0} weitere Schritte",
"s3229": "NVFP4 (Strata-Version)",
"s3230": "NVFP4 (NVIDIA-Version)",
"s3231": "NVFP4 (NVIDIA, für FP4 trainiert)",
"s3232": "Strata-eigene Umwandlung. Die beste Qualität unter den NVFP4-Versionen.",
"s3233": "NVIDIAs eigener NVFP4-Checkpoint, für Strata umgewandelt. Gleiche Größe und Geschwindigkeit.",
"s3234": "NVIDIAs für FP4 trainierter Checkpoint. Bei kurzen Eingaben etwas schneller.",
"s3235": "Alle anderen Versionen",
"s3236": "Weitere Versionen",
"s3237": "Modelldateien werden heruntergeladen · Teil {0} von {1}",
"s3238": "Die Bildleser-Dateien werden heruntergeladen…",
"s3239": "Die Engine für diesen PC wird heruntergeladen…",
"s3240": "{0} wird vorbereitet",
"s3241": "Teile des Downloads",
"s3242": "Bildleser"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "What it did",
"s3226": "Files",
"s3227": "Please help me take it from here.",
"s3228": "…and {0} more steps"
"s3228": "…and {0} more steps",
"s3229": "NVFP4 (Strata’s version)",
"s3230": "NVFP4 (NVIDIA’s version)",
"s3231": "NVFP4 (NVIDIA, trained for FP4)",
"s3232": "Strata’s own conversion. The best quality of the NVFP4 versions.",
"s3233": "NVIDIA’s own NVFP4 checkpoint, converted for Strata. Same size and speed.",
"s3234": "NVIDIA’s FP4 checkpoint, trained for FP4. Slightly faster on short prompts.",
"s3235": "All other versions",
"s3236": "More versions",
"s3237": "Downloading model files · part {0} of {1}",
"s3238": "Downloading the picture reader…",
"s3239": "Downloading the engine for this PC…",
"s3240": "Preparing {0}",
"s3241": "Download parts",
"s3242": "Picture reader"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "Qué hizo",
"s3226": "Archivos",
"s3227": "Ayúdame a continuar desde aquí.",
"s3228": "…y {0} pasos más"
"s3228": "…y {0} pasos más",
"s3229": "NVFP4 (versión de Strata)",
"s3230": "NVFP4 (versión de NVIDIA)",
"s3231": "NVFP4 (NVIDIA, entrenada para FP4)",
"s3232": "Conversión propia de Strata. La mejor calidad de las versiones NVFP4.",
"s3233": "El punto de control NVFP4 propio de NVIDIA, convertido para Strata. Mismo tamaño y velocidad.",
"s3234": "El punto de control de NVIDIA entrenado para FP4. Algo más rápido con mensajes cortos.",
"s3235": "Todas las demás versiones",
"s3236": "Más versiones",
"s3237": "Descargando los archivos del modelo · parte {0} de {1}",
"s3238": "Descargando el lector de imágenes…",
"s3239": "Descargando el motor para este PC…",
"s3240": "Preparando {0}",
"s3241": "Partes de la descarga",
"s3242": "Lector de imágenes"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "実行した内容",
"s3226": "ファイル",
"s3227": "ここから先を手伝ってください。",
"s3228": "…ほか {0} 件の手順"
"s3228": "…ほか {0} 件の手順",
"s3229": "NVFP4(Strata 版)",
"s3230": "NVFP4(NVIDIA 版)",
"s3231": "NVFP4(NVIDIA、FP4 向けに学習)",
"s3232": "Strata 独自の変換版です。NVFP4 の中で最も高品質です。",
"s3233": "NVIDIA 自身の NVFP4 チェックポイントを Strata 用に変換したものです。サイズと速度は同じです。",
"s3234": "NVIDIA が FP4 向けに学習したチェックポイントです。短いプロンプトでは少し高速です。",
"s3235": "その他のすべてのバージョン",
"s3236": "その他のバージョン",
"s3237": "モデルファイルをダウンロード中 · {1} 個中 {0} 個目",
"s3238": "画像読み取りファイルをダウンロード中…",
"s3239": "このパソコン用のエンジンをダウンロード中…",
"s3240": "{0} を準備中",
"s3241": "ダウンロードの内訳",
"s3242": "画像読み取り"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "수행한 내용",
"s3226": "파일",
"s3227": "여기서부터 이어서 도와주세요.",
"s3228": "…외 {0}단계"
"s3228": "…외 {0}단계",
"s3229": "NVFP4 (Strata 버전)",
"s3230": "NVFP4 (NVIDIA 버전)",
"s3231": "NVFP4 (NVIDIA, FP4용으로 학습)",
"s3232": "Strata가 직접 변환한 버전입니다. NVFP4 버전 중 품질이 가장 좋습니다.",
"s3233": "NVIDIA가 직접 만든 NVFP4 체크포인트를 Strata용으로 변환했습니다. 크기와 속도는 같습니다.",
"s3234": "NVIDIA가 FP4용으로 학습한 체크포인트입니다. 짧은 입력에서 조금 더 빠릅니다.",
"s3235": "다른 모든 버전",
"s3236": "더 많은 버전",
"s3237": "모델 파일 다운로드 중 · {1}개 중 {0}번째",
"s3238": "이미지 읽기 파일 다운로드 중…",
"s3239": "이 PC용 엔진 다운로드 중…",
"s3240": "{0} 준비 중",
"s3241": "다운로드 구성",
"s3242": "이미지 읽기"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "O que fez",
"s3226": "Arquivos",
"s3227": "Por favor, ajude-me a continuar daqui.",
"s3228": "…e mais {0} etapas"
"s3228": "…e mais {0} etapas",
"s3229": "NVFP4 (versão da Strata)",
"s3230": "NVFP4 (versão da NVIDIA)",
"s3231": "NVFP4 (NVIDIA, treinada para FP4)",
"s3232": "Conversão própria da Strata. A melhor qualidade entre as versões NVFP4.",
"s3233": "O checkpoint NVFP4 da própria NVIDIA, convertido para a Strata. Mesmo tamanho e velocidade.",
"s3234": "O checkpoint da NVIDIA treinado para FP4. Um pouco mais rápido com mensagens curtas.",
"s3235": "Todas as outras versões",
"s3236": "Mais versões",
"s3237": "Baixando arquivos do modelo · parte {0} de {1}",
"s3238": "Baixando o leitor de imagens…",
"s3239": "Baixando o mecanismo para este PC…",
"s3240": "Preparando {0}",
"s3241": "Partes do download",
"s3242": "Leitor de imagens"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "Что она сделала",
"s3226": "Файлы",
"s3227": "Помогите мне продолжить отсюда.",
"s3228": "…и ещё шагов: {0}"
"s3228": "…и ещё шагов: {0}",
"s3229": "NVFP4 (версия Strata)",
"s3230": "NVFP4 (версия NVIDIA)",
"s3231": "NVFP4 (NVIDIA, обучена для FP4)",
"s3232": "Собственная конвертация Strata. Лучшее качество среди версий NVFP4.",
"s3233": "Собственный NVFP4-чекпойнт NVIDIA, конвертированный для Strata. Тот же размер и скорость.",
"s3234": "Чекпойнт NVIDIA, обученный для FP4. Немного быстрее на коротких запросах.",
"s3235": "Все остальные версии",
"s3236": "Другие версии",
"s3237": "Скачивание файлов модели · часть {0} из {1}",
"s3238": "Скачивание модуля чтения изображений…",
"s3239": "Скачивание движка для этого компьютера…",
"s3240": "Подготовка: {0}",
"s3241": "Части загрузки",
"s3242": "Чтение изображений"
}
+15 -1
View File
@@ -3221,5 +3221,19 @@
"s3225": "它做了什么",
"s3226": "文件",
"s3227": "请帮我从这里继续。",
"s3228": "……以及另外 {0} 个步骤"
"s3228": "……以及另外 {0} 个步骤",
"s3229": "NVFP4(Strata 版本)",
"s3230": "NVFP4(NVIDIA 版本)",
"s3231": "NVFP4(NVIDIA,为 FP4 训练)",
"s3232": "Strata 自己的转换版本,是 NVFP4 各版本中质量最好的。",
"s3233": "NVIDIA 自己的 NVFP4 检查点,已为 Strata 转换。大小和速度相同。",
"s3234": "NVIDIA 为 FP4 训练的检查点。短提示下速度略快。",
"s3235": "其他所有版本",
"s3236": "更多版本",
"s3237": "正在下载模型文件 · 第 {0} 部分,共 {1} 部分",
"s3238": "正在下载图片读取组件…",
"s3239": "正在下载适用于此电脑的引擎…",
"s3240": "正在准备 {0}",
"s3241": "下载分段",
"s3242": "图片读取组件"
}
+5 -2
View File
@@ -7021,14 +7021,17 @@ textarea {
.version-menu { display: flex; flex-direction: column; max-height: min(70vh, 640px); overflow: auto; padding: 4px 0; min-width: min(620px, calc(100vw - 24px)); }
.version-head { display: grid; grid-template-columns: 1fr 84px 84px; gap: 10px; padding: 8px 18px 4px; font-size: var(--st-fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--st-ink-muted); }
.version-head span:nth-child(n+2) { text-align: right; }
.version-row { display: grid; grid-template-columns: 1fr 84px 84px; gap: 10px; align-items: baseline; width: calc(100% - 12px); margin: 0 6px; padding: 8px 12px; border: 0; border-radius: var(--st-r-sm); background: transparent; color: var(--st-ink); font: inherit; text-align: left; cursor: pointer; }
.version-row { display: grid; grid-template-columns: 1fr 84px 84px; gap: 10px; align-items: baseline; width: calc(100% - 12px); margin: 0 6px; padding: 6px 12px; border: 0; border-radius: var(--st-r-sm); background: transparent; color: var(--st-ink); font: inherit; font-size: var(--st-fs-md); text-align: left; cursor: pointer; }
.version-row:hover, .version-row:focus-visible { background: var(--st-surface-2); }
.version-row.is-on { background: var(--st-surface-2); }
.version-row__name { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.version-row__name svg { color: var(--st-accent-text); margin-right: 6px; vertical-align: -2px; }
.version-row__title { display: inline-flex; align-items: baseline; gap: 0; max-width: 100%; }
.version-row__note { display: block; margin-top: 1px; font-size: var(--st-fs-xs); white-space: normal; line-height: 1.35; }
.version-row__have, .version-trigger .version-row__have { margin-left: 8px; padding: 1px 8px; border-radius: var(--st-r-pill); background: var(--st-accent-tint); color: var(--st-accent-text); font-size: var(--st-fs-xs); font-weight: 700; white-space: nowrap; }
.version-row__ssd { margin-left: 10px; font-size: var(--st-fs-xs); color: var(--st-warn-text); }
.version-row__ram { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.version-row__dl { text-align: right; font-size: var(--st-fs-sm); color: var(--st-ink-muted); font-variant-numeric: tabular-nums; }
.version-row__dl { text-align: right; font-size: var(--st-fs-xs); color: var(--st-ink-muted); font-variant-numeric: tabular-nums; }
.version-group { border-top: 1px solid var(--st-line-soft); margin-top: 4px; }
.version-group[data-open] { background: var(--st-surface-2); padding-bottom: 6px; }
.version-group[data-open] .version-row:hover { background: var(--st-surface); }
+8
View File
@@ -243,3 +243,11 @@
@media(max-width:700px){.onboard-sharing{grid-template-columns:1fr;gap:20px;padding:22px}.onboard-sharing-computer{width:min(300px,100%);justify-self:center}.onboard-sharing-caption{font-size:14px}.onboard-sharing-numbers{justify-content:space-between;gap:20px}.onboard-sharing-headroom{padding-left:20px}.guided-onboarding .onboard-resource-options>button{padding:16px;grid-template-columns:1fr;gap:7px}.guided-onboarding .onboard-resource-options small{grid-column:1;grid-row:4;justify-self:start}.guided-onboarding .onboard-resource-options strong{font-size:13px}.guided-onboarding .onboard-resource-options p{font-size:11px}.guided-onboarding .onboard-load-vision,.guided-onboarding .onboard-calibration{padding:14px}.guided-onboarding .onboard-load-vision strong,.guided-onboarding .onboard-calibration strong{font-size:12px}}
.onboard-progress-actions{display:flex;align-items:center;gap:10px}
.onboard-tune-stage:has(.error-notice) .onboard-sharing{display:none}
/* ---- QA 2026-10-18: more versions, download parts ---- */
.onboard-more-versions { margin-top: 12px; }
.onboard-more-versions .version-trigger { background: var(--st-surface); }
.native-parts { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: var(--st-fs-sm); }
.native-parts li { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0; border-top: 1px solid var(--st-line-soft); }
.native-parts li[data-state="done"] > span::before { content: "\2713\00a0"; color: var(--st-accent-text); }
.native-parts li[data-state="downloading"] > span { font-weight: 700; }
+125
View File
@@ -0,0 +1,125 @@
import test from 'node:test';
import assert from 'node:assert/strict';
import { build } from 'esbuild';
import { createEngineStep } from '../server/engine-step.mjs';
const compiled = await build({
stdin: {
contents: "export * from './src/lib/native'; export * from './src/lib/download-eta'; export * from './src/lib/native-fit'; export * from './src/lib/native-names'; export * from './src/lib/native-catalog'; export * from './src/lib/i18n';",
resolveDir: process.cwd(),
},
bundle: true, write: false, platform: 'node', format: 'esm',
});
const lib = await import(`data:text/javascript;base64,${Buffer.from(compiled.outputFiles[0].text).toString('base64')}`);
const job = (progress, state = 'running') => ({ id: 'j1', kind: 'install', state, startedAt: '', summary: '', error: null, result: { install: progress } });
const stateWith = (jobs, extra = {}) => ({ available: true, repo: '', summary: '', error: null, catalog: null, installed: null, hardware: null, instances: [], jobs, ...extra });
const answer = body => ({ ok: true, status: 200, statusText: 'OK', text: async () => JSON.stringify(body) });
test('a slow forced read never holds the light poll: a running download keeps moving', async () => {
const seen = [];
globalThis.fetch = async url => {
seen.push(url);
if (String(url).includes('refresh=1')) { await new Promise(r => setTimeout(r, 400)); return answer(stateWith([job({ download: { done_gb: 1, total_gb: 10 } })])); }
return answer(stateWith([job({ download: { done_gb: 5, total_gb: 10 } })]));
};
const slow = lib.refreshNative(true);
const t0 = Date.now();
await lib.refreshNative();
assert.ok(Date.now() - t0 < 200, 'the light read answered while the forced one was still running');
assert.equal(lib.nativeState().jobs[0].result.install.download.done_gb, 5);
await slow;
assert.ok(seen.some(u => String(u).includes('refresh=1')) && seen.some(u => !String(u).includes('refresh=1')));
});
test('a second forced read waits for the first and then reads again (it never joins a read that began before the action)', async () => {
let calls = 0;
globalThis.fetch = async () => { calls += 1; await new Promise(r => setTimeout(r, 50)); return answer(stateWith([], { summary: `read ${calls}` })); };
const a = lib.refreshNative(true), b = lib.refreshNative(true), c = lib.refreshNative(true);
await Promise.all([a, b, c]);
assert.equal(calls, 2, 'one read for the first, one more for everything asked meanwhile');
assert.equal(lib.nativeState().summary, 'read 2');
});
test('the host pushes its native state and the page takes it at once', () => {
lib.applyNativeEvent(stateWith([job({ download: { done_gb: 7, total_gb: 10 } })], { summary: 'pushed' }));
assert.equal(lib.nativeState().summary, 'pushed');
lib.applyNativeEvent({ nonsense: true });
lib.applyNativeEvent(null);
assert.equal(lib.nativeState().summary, 'pushed', 'a frame that is not a native state changes nothing');
});
test('the poll is quick while a job runs, normal otherwise, and stops while the window is hidden', () => {
assert.equal(lib.nativePollDelay(null), 2500);
assert.equal(lib.nativePollDelay(stateWith([job({})], {})), 1000);
assert.equal(lib.nativePollDelay(stateWith([job({}, 'done')])), 2500);
assert.equal(lib.nativePollDelay(stateWith([job({})]), true), null);
});
const parts = (model, vision, engine = { kind: 'engine', name: 'Engine', state: 'done', done_gb: 0.4, total_gb: 0.4 }) => [model, vision, engine];
const modelPart = (state, done, total, files_done, files_total) => ({ kind: 'model', name: 'Model files', state, done_gb: done, total_gb: total, files_done, files_total });
const visionPart = (state, done = 0) => ({ kind: 'vision', name: 'Picture reader', state, done_gb: done, total_gb: 0.9 });
test('a model in parts says which part is under way, then the picture reader', () => {
lib.setTranslationLanguage('en');
const second = { parts: parts(modelPart('downloading', 20, 66, 1, 2), visionPart('waiting')) };
assert.deepEqual(lib.installStage(second), { kind: 'model', index: 2, count: 2 });
assert.equal(lib.stageText(lib.installStage(second)), 'Downloading model files · part 2 of 2');
const reader = { parts: parts(modelPart('done', 66, 66, 2, 2), visionPart('downloading', 0.3)) };
assert.deepEqual(lib.installStage(reader), { kind: 'vision' });
assert.equal(lib.stageText(lib.installStage(reader)), 'Downloading the picture reader…');
assert.equal(lib.stageText(lib.installStage(undefined)), 'Downloading model files…');
const single = { parts: [modelPart('downloading', 1, 20, 0, 1), visionPart('waiting')] };
assert.equal(lib.stageText(lib.installStage(single)), 'Downloading model files…', 'one file is not "part 1 of 1"');
});
test('the figure counts every part: the model whole but the picture reader not yet is not finished', () => {
const p = lib.installProgress({ parts: parts(modelPart('done', 10, 10, 2, 2), visionPart('downloading', 0.3)) });
assert.equal(p.percent, 94, 'the bar is not at its end while the picture reader is still coming');
assert.ok(Math.abs(p.total_gb - 11.3) < 0.01, `total ${p.total_gb}`);
assert.ok(p.remaining_gb > 0.5);
const half = lib.installProgress({ parts: parts(modelPart('downloading', 33, 66, 1, 2), visionPart('waiting')) });
assert.equal(half.percent, Math.floor(100 * (33 + 0.4) / (66 + 0.9 + 0.4)));
});
test('the engine step keeps the install job\'s own parts (model parts, picture reader) and adds the engine', () => {
const step = createEngineStep({ control: null });
const install = { running: true, step: '5/7: downloading', download: { file: 'picture reader', done_gb: 66.3, total_gb: 66.9, remaining_gb: 0.6, percent: 99 },
parts: [modelPart('done', 66, 66, 2, 2), visionPart('downloading', 0.3)] };
const merged = step.merge(install);
assert.deepEqual(merged.parts.map(p => p.kind), ['model', 'vision', 'engine']);
assert.equal(merged.parts[0].files_total, 2);
const bare = step.merge({ running: true, download: { file: 'model files', done_gb: 1, remaining_gb: 9 } });
assert.deepEqual(bare.parts.map(p => p.kind), ['model', 'engine'], 'an install without part information keeps the old two-part list');
});
test('the recommended four come first; the others are what the "More versions" list holds', () => {
const v = (sourceFamily, model) => ({ sourceFamily, model, id: `${sourceFamily}-${model}` });
const all = [v('qwen', 'Q2_0'), v('gyro', 'Gyro-S'), v('swift', 'IQ2_XS'), v('qwen', 'IQ3_S'), v('unsloth', 'UD-Q4_K_XL'), v('nvfp4', 'NVFP4')];
const rec = lib.recommendedVersions(all).map(x => x.v.model);
assert.deepEqual(rec, ['Gyro-S', 'IQ2_XS', 'IQ3_S', 'UD-Q4_K_XL']);
assert.deepEqual(all.filter(x => !rec.includes(x.model)).map(x => x.model), ['Q2_0', 'NVFP4']);
assert.deepEqual(lib.recommendedVersions([v('qwen36', 'UD-Q4_K_XL')]), [], 'Qwen3.6 has no recommended set: its versions are all shown');
});
test('the three NVFP4 versions have clear names and one line that tells them apart', () => {
lib.setTranslationLanguage('en');
const names = ['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].map(m => lib.nativeVersionLabel(m));
assert.deepEqual(names, ['NVFP4 (Strata’s version)', 'NVFP4 (NVIDIA’s version)', 'NVFP4 (NVIDIA, trained for FP4)']);
assert.equal(new Set(names).size, 3);
const lines = ['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].map(m => lib.versionNote(m));
assert.match(lines[0], /best quality/i);
assert.match(lines[1], /NVIDIA’s own NVFP4 checkpoint/);
assert.match(lines[2], /trained for FP4/);
assert.match(lines[2], /faster on short prompts/);
assert.equal(lib.versionNote('IQ3_S'), '');
assert.equal(lib.nativeShortName('nvfp4-nvfp4-nvidia'), 'NVFP4 (NVIDIA’s version)');
for (const language of ['zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko']) {
lib.setTranslationLanguage(language);
const local = ['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].map(m => lib.nativeVersionLabel(m));
assert.equal(new Set(local).size, 3, `${language}: three different names`);
assert.ok(local.every((n, i) => n !== names[i]), `${language}: translated`);
assert.ok(['NVFP4', 'NVFP4-NVIDIA', 'NVFP4-QAD'].every((m, i) => lib.versionNote(m) !== lines[i]), `${language}: the line is translated`);
}
lib.setTranslationLanguage('en');
});
+3 -1
View File
@@ -21,7 +21,9 @@ test('item 1: downloaded models get a short name, family and quantization', asyn
assert.equal(nativeShortName('unsloth-ud-q4_k_xl'), 'Unsloth UD-Q4_K_XL');
assert.equal(nativeShortName('gyro-gyro-s'), 'Gyro-S');
assert.equal(nativeShortName('coder-iq1_m'), 'Coder IQ1_M');
assert.equal(nativeShortName('nvfp4-nvfp4'), 'NVFP4 NVFP4');
assert.equal(nativeShortName('nvfp4-nvfp4'), 'NVFP4 (Strata’s version)');
assert.equal(nativeShortName('nvfp4-nvfp4-nvidia'), 'NVFP4 (NVIDIA’s version)');
assert.equal(nativeShortName('nvfp4-nvfp4-qad'), 'NVFP4 (NVIDIA, trained for FP4)');
const storage = await read('components/SettingsStorage.tsx');
assert.match(storage, /title=\{m\.model_name \|\| m\.model\}/, 'the full name is the tooltip');
});
+65
View File
@@ -249,6 +249,71 @@ class InstallerServerTests(unittest.TestCase):
# a resumed install counts what is already on disk
self.assertGreater(self.mcp.combined_progress(dict(step5), job)["download"]["done_gb"], 0)
def test_a_model_in_parts_counts_every_part_and_the_picture_reader(self):
"""QA 2026-10-18 (6): the bar stopped at 99 % while the picture reader downloaded, and a first whole part looked like a finished
model. Every part is counted, the picture reader is a part of its own, and 'done' needs all of them."""
S = self.mcp.Strata(self.root, ROOT).setup_module()
models = self.root / "Strata-data" / "models"
files = self.mcp.expected_files(S, "qwen", "IQ3_S", models, True)
self.assertEqual([f["role"] for f in files], ["model", "model", "vision"])
self.assertEqual(Path(files[2]["path"]).parent, models, "the picture reader sits beside the model folders")
folder = Path(files[0]["path"]).parent
folder.mkdir(parents=True)
job = {"folder": str(folder), "total_gb": 0.004, "files": files}
step5 = {"step": "5/7: downloading Qwen3.8-Flash-Next IQ3_S"}
# the first part is whole, the second not started: the model is NOT downloaded
Path(files[0]["path"]).write_bytes(b"x" * 2_000_000)
one = self.mcp.combined_progress(dict(step5), job)
model = next(x for x in one["parts"] if x["kind"] == "model")
self.assertEqual((model["files_done"], model["files_total"], model["state"]), (1, 2, "downloading"))
self.assertLess(one["download"]["percent"], 99)
# both parts whole, the picture reader under way: still counted, and the bar is not at its end
Path(files[1]["path"]).write_bytes(b"x" * 2_000_000)
Path(files[2]["path"]).with_name(Path(files[2]["path"]).name + ".part").write_bytes(b"x" * 400_000)
two = self.mcp.combined_progress(dict(step5), job)
vision = next(x for x in two["parts"] if x["kind"] == "vision")
self.assertEqual(vision["state"], "downloading")
self.assertEqual(two["download"]["file"], "picture reader")
self.assertGreater(two["download"]["done_gb"], one["download"]["done_gb"])
self.assertGreater(two["download"]["total_gb"], 0.004, "the picture reader is part of the total")
self.assertLessEqual(two["download"]["percent"], 99)
# all whole
Path(files[2]["path"]).with_name(Path(files[2]["path"]).name + ".part").unlink()
Path(files[2]["path"]).write_bytes(b"x" * 907_543_008)
three = self.mcp.combined_progress(dict(step5), job)
self.assertTrue(all(x["state"] == "done" for x in three["parts"]))
self.assertEqual(three["download"]["done_gb"], three["download"]["total_gb"])
# not a download once setup prepares the files
self.assertNotIn("download", self.mcp.combined_progress({"step": "6/7: preparing the model for Strata", "download": {"x": 1}}, job))
def test_a_pack_with_many_files_reports_the_whole_pack(self):
S = self.mcp.Strata(self.root, ROOT).setup_module()
files = self.mcp.expected_files(S, "nvfp4", "NVFP4", self.root / "models", False)
self.assertGreater(len(files), 5)
self.assertTrue(all(f["bytes"] for f in files), "a ready-made pack pins every file's size")
big = next(f for f in files if f["path"].endswith("experts.bin"))
Path(big["path"]).parent.mkdir(parents=True)
Path(big["path"] + ".part").write_bytes(b"x" * 1000)
prog = self.mcp.combined_progress({"step": "5/7: downloading"}, {"files": files, "total_gb": 128.0})
model = prog["parts"][0]
self.assertEqual((model["kind"], model["state"], model["files_done"], model["files_total"]), ("model", "downloading", 0, len(files)))
self.assertAlmostEqual(model["total_gb"], sum(f["bytes"] for f in files) / 1e9, places=2)
def test_a_config_with_only_some_parts_is_not_ready(self):
"""The config names the first part only; 'ready' used to mean that part exists."""
data = self.root / "models" / "x"
data.mkdir(parents=True)
first = data / "Model-00001-of-00003.gguf"
first.write_bytes(b"x")
self.assertEqual(len(self.mcp.shard_gaps([str(first)])), 2)
(data / "Model-00002-of-00003.gguf").write_bytes(b"x")
(data / "Model-00003-of-00003.gguf.part").write_bytes(b"x")
self.assertEqual([Path(g).name for g in self.mcp.shard_gaps([str(first)])], ["Model-00003-of-00003.gguf"])
(data / "Model-00003-of-00003.gguf.part").unlink()
(data / "Model-00003-of-00003.gguf").write_bytes(b"x")
self.assertEqual(self.mcp.shard_gaps([str(first)]), [])
self.assertEqual(self.mcp.shard_gaps([str(data / "single.gguf")]), [])
@unittest.skipUnless(os.name == "nt" or sys.platform.startswith("linux"), "a PC with a GPU probe")
def test_a_real_install_reaches_the_model_download_with_nothing_else_acquired(self):
"""setup.py in the app's mode, as the install job runs it: steps 1-4 pass (PC check, packages bundled, engine component
+107 -1
View File
@@ -580,6 +580,7 @@ class Strata:
tag = path.stem[len("strata-"):]
missing = [p for p in [cfg.get("exe"), *[x for x in a if isinstance(x, str) and x.endswith(".gguf")]]
if not p or not Path(p).exists()]
missing += shard_gaps([x for x in a if isinstance(x, str) and x.endswith(".gguf")]) # a model in parts is whole only with every part
script = self.root / f"run-{tag}.{'bat' if WIN else 'sh'}"
vis = cfg.get("vision")
return {"model": tag, "config": path.name, "model_name": cfg.get("model_name"),
@@ -1115,12 +1116,112 @@ class Strata:
return out
SHARD_NAME = re.compile(r"^(.*)-(\d{5})-of-(\d{5})\.gguf$")
DEFAULT_MMPROJ_BYTES = 907_543_008 # the Flash-Next picture reader (mmproj BF16), when a family does not pin its size
def shard_gaps(ggufs) -> list:
"""The parts of a multi-part GGUF (name-00001-of-00004.gguf) that are not there whole: a missing part, or one still being
downloaded (<part>.part). A config that names only the first part used to look finished with one part of four on disk."""
gaps = []
for g in ggufs:
m = SHARD_NAME.match(str(g))
if not m:
continue
for i in range(1, int(m.group(3)) + 1):
sib = Path(f"{m.group(1)}-{i:05d}-of-{m.group(3)}.gguf")
if not sib.is_file() or sib.with_name(sib.name + ".part").exists():
gaps.append(str(sib))
return gaps
def expected_files(S, family: str, model: str, models_dir: Path, vision: bool) -> list:
"""The files setup fetches for one install, with the sizes it can know before the download starts:
[{path, bytes|None, role}] where role is "model" (the shards or the pack's files) or "vision" (the picture reader).
Empty when the setup module cannot say (the caller then falls back to the folder scan)."""
out = []
try:
own = (getattr(S, "OWN_PATH_FAMILIES", None) or {}).get(family)
if own: # Qwen3.6: the GGUF and the picture reader in the model's folder
folder = Path(models_dir) / (own["tag"] + model)
name = own["file"].format(q=model)
out.append({"path": str(folder / name), "bytes": own["sha256"][name][0], "role": "model"})
if vision:
out.append({"path": str(folder / own["mmproj"]), "bytes": own["sha256"][own["mmproj"]][0], "role": "vision"})
return out
fam, d = S.FAMILIES[family], S.MODELS[model]
if d.get("repo"): # NVFP4: a ready-made pack, many files with pinned sizes
for f in S.ready_needed(model, Path(models_dir)):
out.append({"path": str(S.ready_where(Path(models_dir), f)), "bytes": f[4], "role": "model"})
else:
folder = Path(models_dir) / (fam.get("tag", "") + model)
for i in range(1, S.model_shards(fam, model) + 1):
out.append({"path": str(folder / S.model_file(fam, model, i)), "bytes": None, "role": "model"})
if vision: # beside the model folders, not inside them (setup step 5)
size = (fam.get("mmproj_sha256") or (None,))[0] or DEFAULT_MMPROJ_BYTES
out.append({"path": str(Path(models_dir) / fam.get("mmproj", S.MMPROJ)), "bytes": size, "role": "vision"})
except Exception: # noqa: BLE001 - progress is a convenience: never break the install
return []
return out
def files_progress(prog: dict, job: dict, files: list) -> dict:
"""One honest download figure for a model in parts: every part counted (finished, partial, waiting), the picture reader as a part
of its own, and a part list the screen can name ("part 2 of 4"). The finished state needs EVERY part: a first shard that is whole
does not make the model downloaded."""
log = prog.get("download") or {}
cur_gb = float(log.get("total_gb") or 0)
rows = []
for f in files:
p = Path(f["path"])
part = p.with_name(p.name + ".part")
try:
if part.is_file():
state, have = "downloading", part.stat().st_size
elif p.is_file():
state, have = "done", p.stat().st_size
else:
state, have = "waiting", 0
except OSError:
state, have = "waiting", 0
total = f.get("bytes") or (have if state == "done" else 0)
if state == "downloading" and not total and cur_gb and p.name in str(log.get("file", "")): # the log line names this file
total = int(cur_gb * 1e9)
rows.append({"role": f.get("role", "model"), "state": state, "have": have, "total": max(total, have)})
plan_total = float(job.get("total_gb") or 0) * 1e9
parts = []
for role, name in (("model", "Model files"), ("vision", "Picture reader")):
mine = [r for r in rows if r["role"] == role]
if not mine:
continue
have = sum(r["have"] for r in mine)
known = sum(r["total"] for r in mine)
total = known if all(r["total"] for r in mine) else max(plan_total if role == "model" else 0, known, have)
k = sum(1 for r in mine if r["state"] == "done")
state = "done" if k == len(mine) else "downloading" if any(r["state"] == "downloading" for r in mine) or k else "waiting"
parts.append({"kind": role, "name": name, "state": state, "done_gb": round(min(have, total) / 1e9, 3),
"total_gb": round(total / 1e9, 3), "files_done": k, "files_total": len(mine)})
total_gb = sum(x["total_gb"] for x in parts)
done_gb = min(sum(x["done_gb"] for x in parts), total_gb)
active = next((x for x in parts if x["state"] != "done"), parts[-1] if parts else None)
if active and active["state"] == "waiting" and any(x["state"] == "done" for x in parts):
active = dict(active, state="downloading")
prog["download"] = {"file": "picture reader" if active and active["kind"] == "vision" else "model files",
"done_gb": round(done_gb, 3), "total_gb": round(total_gb, 3),
"remaining_gb": round(max(0.0, total_gb - done_gb), 3),
"percent": min(99, int(100 * done_gb / total_gb)) if total_gb else 0}
prog["parts"] = parts
return prog
def combined_progress(prog: dict, job: dict) -> dict:
"""One total for the whole model: the bytes of all its files (finished, partial and the one in flight, read from the
model's folder) over the download size, instead of each file's own 0-100% (a two-file model went 70 GB -> 0 -> up
again). Only while the download step runs; later steps are not a download."""
folder, total = job.get("folder"), job.get("total_gb")
step = str(prog.get("step") or "")
if job.get("files") and step.startswith("5/"): # the install knows its files: count each of them
return files_progress(prog, job, job["files"])
if not folder or not total or not step.startswith("5/"):
prog.pop("download", None)
return prog
@@ -1687,8 +1788,13 @@ class Tools:
ident = proc_identity(p.pid)
if ident is None and p.poll() and s.state("install-result").get("job") != job_id:
raise ToolError("setup did not start: " + " | ".join(read_tail(log_path, 5)))
folder = plan.get("model_folder")
files = []
if s.setup_module() is not None and folder: # every file of this install, for a progress that counts all the parts
files = expected_files(s.setup_module(), plan["family"], plan["model"], Path(folder).parent,
plan.get("images") in ("yes", "gpu", "cpu"))
s.save_state("install", {"job": job_id, "pid": p.pid, "ident": ident, "log": str(log_path),
"model": plan["model"], "family": plan["family"], "folder": plan.get("model_folder"),
"model": plan["model"], "family": plan["family"], "folder": folder, "files": files,
"total_gb": plan.get("download_gb"),
"started": time.strftime("%Y-%m-%d %H:%M:%S"), "args": args})
return {"summary": f"Install of {plan['title']} started in the background (about 20-90 minutes, mostly the "