Qwen3.8-Flash-Next on any consumer hardware: one-click install for Windows / Linux. Strata inference engine, OpenAI/Anthropic API on localhost, optional image input.
C++
Two models on two GPUs in the app: say which card a loaded model uses, prefer a free card for the second, explain a failed start on a shared card, show an unload refusal beside its button, keep a failed instance out of the chat picker
Niko1221c1440388fbd0
diff --git a/apps/host/server/native-control.mjs b/apps/host/server/native-control.mjsindex 6993d6278..37a19d689 100644--- a/apps/host/server/native-control.mjs+++ b/apps/host/server/native-control.mjs@@ -223,6 +223,9 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}if(job.state!=='running')return;writeFileSync(configPath,JSON.stringify(cfg,null,2),{mode:0o600});const instance={id,apiModelId,fingerprint,context:entry.context??0,aliases:cfg.aliases??[],vision:!!cfg.vision,resourceProfile:cfg.ui_resource_profile??null,model:args.model,label:entry.model_name??args.model,port:cfg.port,gpus:Array.isArray(cfg.gpu)?cfg.gpu:cfg.gpu===undefined?[]:[cfg.gpu],status:'loading',phase:'loading',parallel:cfg.parallel??1,mcpServers:cfg.mcp_servers??cfg.mcpServers??{},key,configPath,loadedAt:new Date().toISOString(),metrics:null,error:null};+ /* Another model on the same graphics card: the engine takes the card's free memory, so a second one usually finds none. Loading goes on (recommend, never force); if it fails, the reason is said. */+ const sharedWith=instance.gpus.length?[...instances.values()].find(i=>i.id!==id&&i.status!=='error'&&i.model!==args.model&&i.gpus.some(g=>instance.gpus.includes(g))):null;+ const sharedSentence=sharedWith?`GPU ${instance.gpus.find(g=>sharedWith.gpus.includes(g))+1} is already used by ${sharedWith.label}, so this model did not fit there. Load it on another GPU, or unload ${sharedWith.label} first.`:null;let proc=null,started=null,retried=null;if(packaged){/* The engine starts under Control's owner runtime, not as our child: a saved profile per slot, then `runtime start`. */@@ -235,6 +238,7 @@ return {summary:result.summary??'Deleted',removed:result.plan?.gb??null};}/* A settings, profile or run file an elevated run made can be closed to this user: repair the access in Strata's own folders and start again (this is not the memory try below). */const isAccess=e=>/PermissionError|access is denied|EACCES/i.test(String(e?.message??'')+JSON.stringify(e?.output??''));if(isAccess(error)&&typeof control.repairAccess==='function'&&job.state==='running'){await control.repairAccess();append(id,'Strata repaired access to its own files; starting again.');try{await startWith(cfg);started=Promise.resolve();error=null;}catch(again){error=again;}}+ if(error&&sharedSentence&&!isAccess(error)){instance.status='error';instance.error=sharedSentence;emit();throw new Error(sharedSentence);}if(error){const said=humanStartError(error);if(isAccess(error)){instance.status='error';instance.error=said;emit();throw new Error(said);} // access errors are not memory stops: no safer retry/* ONE automatic second try in all, never saved, never repeated (args.retrySafer false turns it off): with a safer memory setting when thediff --git a/apps/host/src/components/ChatModelPicker.tsx b/apps/host/src/components/ChatModelPicker.tsxindex bc759c035..5533bb96b 100644--- a/apps/host/src/components/ChatModelPicker.tsx+++ b/apps/host/src/components/ChatModelPicker.tsx@@ -20,7 +20,7 @@ function NativeChatModelPicker() {const [open, setOpen] = useState(false), [error, setError] = useState('');const ref = useRef<HTMLButtonElement>(null);const current = native?.instances.find(i => i.id === native.defaultId);- return <><button className="chat-model-badge chat-model-picker" ref={ref} aria-label={tr("Choose model: {0}", [current?.label ?? 'Native model'])} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name="models" size={16}/><span>{tr(current?.label ?? 'Native model')}</span><Icon name="chevron" size={12}/></button>{tr(open ? <FloatingMenu anchor={ref.current} title={tr("Chat model")} width={340} onClose={() => setOpen(false)}>{tr(native?.instances.map(i => <button className="menu__item" role="menuitemradio" aria-checked={current?.id === i.id} disabled={streaming || i.status !== 'ready'} key={i.id} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => setOpen(false)).catch(e => setError(e.message))}><Icon name="models"/><span><strong>{tr(i.label)}</strong><small>{tr(i.apiModelId)} · {tr(i.gpus.map(g => `GPU ${g + 1}`).join(' + ') || 'Automatic GPU')}</small></span></button>))}{tr(providers?.connections.flatMap(c => c.models.map(m => <button className="menu__item" role="menuitem" disabled={streaming} key={`${c.id}-${m.id}`} onClick={() => { selectRemoteModel({ connectionId: c.id, modelId: m.id }); setOpen(false); }}><Icon name="link"/>{m.name} · {c.name}</button>)))}<button className="menu__item" role="menuitem" onClick={() => { setOpen(false); go('models'); }}>{tr("Manage models")}</button>{tr(error ? <p className="small inline-error">{tr(error)}</p> : null)}</FloatingMenu> : null)}</>;+ return <><button className="chat-model-badge chat-model-picker" ref={ref} aria-label={tr("Choose model: {0}", [current?.label ?? 'Native model'])} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name="models" size={16}/><span>{tr(current?.label ?? 'Native model')}</span><Icon name="chevron" size={12}/></button>{tr(open ? <FloatingMenu anchor={ref.current} title={tr("Chat model")} width={340} onClose={() => setOpen(false)}>{tr(native?.instances.filter(i => i.status !== 'error').map(i => <button className="menu__item" role="menuitemradio" aria-checked={current?.id === i.id} disabled={streaming || i.status !== 'ready'} key={i.id} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => setOpen(false)).catch(e => setError(e.message))}><Icon name="models"/><span><strong>{tr(i.label)}</strong><small>{tr(i.apiModelId)} · {tr(i.gpus.map(g => `GPU ${g + 1}`).join(' + ') || 'Automatic GPU')}</small></span></button>))}{tr(providers?.connections.flatMap(c => c.models.map(m => <button className="menu__item" role="menuitem" disabled={streaming} key={`${c.id}-${m.id}`} onClick={() => { selectRemoteModel({ connectionId: c.id, modelId: m.id }); setOpen(false); }}><Icon name="link"/>{m.name} · {c.name}</button>)))}<button className="menu__item" role="menuitem" onClick={() => { setOpen(false); go('models'); }}>{tr("Manage models")}</button>{tr(error ? <p className="small inline-error">{tr(error)}</p> : null)}</FloatingMenu> : null)}</>;}function LegacyChatModelPicker() {const native = useNative();@@ -77,7 +77,7 @@ function LegacyChatModelPicker() {return <><button ref={trigger} className="chat-model-badge chat-model-picker" aria-label={tr("Choose model: {0}", [apiModel?.name ?? (running?.local ? running.name : running?.family) ?? 'No model loaded'])} title={tr(apiModel ? `${connection?.name} · ${apiModel.id}` : 'View and switch models')} disabled={!library && !providers} aria-haspopup="menu" aria-expanded={open} onClick={() => setOpen(v => !v)}><Icon name={apiModel ? 'link' : modelFamilyIcon(running?.family ?? groups[0]?.family)} size={16}/><span>{tr(apiModel?.name ?? (running?.local ? running.name : running?.family) ?? groups[0]?.family ?? 'No model loaded')}</span><Icon name="chevron" size={12}/></button>{tr(open ? <FloatingMenu anchor={trigger.current} title={tr("Models")} width={380} onClose={() => setOpen(false)}>- {tr(native?.instances.map(i => <button key={i.id} className="menu__item" role="menuitem" disabled={streaming || i.status !== 'ready'} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => { selectRemoteModel(null); setOpen(false); }).catch(e => setError(e.message))}><Icon name="models"/><span>{tr(i.label)}<small>{tr(i.apiModelId)}</small></span></button>))}<p className="model-picker-heading">{tr("Local models")}</p>+ {tr(native?.instances.filter(i => i.status !== 'error').map(i => <button key={i.id} className="menu__item" role="menuitem" disabled={streaming || i.status !== 'ready'} onClick={() => void nativeAction(`instances/${i.id}/default`).then(() => { selectRemoteModel(null); setOpen(false); }).catch(e => setError(e.message))}><Icon name="models"/><span>{tr(i.label)}<small>{tr(i.apiModelId)}</small></span></button>))}<p className="model-picker-heading">{tr("Local models")}</p>{tr(!groups.length ? <p className="model-picker-empty">{tr("No local models downloaded yet.")}</p> : null)}{tr(groups.map(({ family, versions }, index) => {const main = versions[0], state = pickerVersionState(main, library!.loaded);diff --git a/apps/host/src/components/NativeModels.tsx b/apps/host/src/components/NativeModels.tsxindex 9c2c7ce0c..62b532529 100644--- a/apps/host/src/components/NativeModels.tsx+++ b/apps/host/src/components/NativeModels.tsx@@ -36,7 +36,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngineconst [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), [tuneOpen, setTuneOpen] = useState(false), [jobId, setJobId] = useState(''), [manage, setManage] = useState(false);+ 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 presetPending = useRef(false);const [deleting, setDeleting] = useState<string | null>(null);const families = nativeCatalogModels(native?.catalog?.families ?? []);@@ -76,8 +76,10 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngineconst 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';// Graphics cards (strata_control/gpu_fit.py: the one rule of the app, the Terminal and setup): the recommended option is pre-selected, the person may pick another+ // A card a loaded model already uses (a second model on it usually does not fit): said on its row, and not the pre-selected one while another is free.+ const usedBy = (cards: number[]) => (native?.instances ?? []).filter(i => i.status !== 'error' && i.model !== selectedSize?.id && i.gpus.some(g => cards.includes(g))).map(i => i.label);const cardOptions = selectedSize?.gpu_options && selectedSize.gpu_options.options.length >= 2 ? selectedSize.gpu_options : null;- const activeCards = cardOptions ? (cardOptions.options.find(o => o.key === cardsKey) ?? cardOptions.options.find(o => o.recommended) ?? cardOptions.options[0]) : null;+ const activeCards = cardOptions ? (cardOptions.options.find(o => o.key === cardsKey) ?? (multiple ? cardOptions.options.find(o => o.recommended && !usedBy(o.cards).length) ?? cardOptions.options.find(o => !usedBy(o.cards).length) : undefined) ?? cardOptions.options.find(o => o.recommended) ?? cardOptions.options[0]) : null;const cardsGpus: number[] = activeCards?.cards ?? [];useEffect(() => { 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]);@@ -120,11 +122,21 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine}elsesetPlan(await api.post('/api/native/plan', downloadValues)); }); }+ /* Unload / Use in chat: a refusal (a chat is still using the model) is said here, beside the button, not far below the page. */+ async function loadedAction(path: string) { setLoadedError(''); setPending(true); try {+ await nativeAction(path);+ }+ catch (e) {+ setLoadedError(e instanceof Error ? e.message : String(e));+ }+ finally {+ setPending(false);+ } }async function download() { await perform(async () => { const result = await nativeAction<NativeJob>('operations', { kind: 'install', args: downloadValues }); setJobId(result.id); setPlan(null); }); }return <Screen plainHeader title={<span className="sr-only">{tr("Models")}</span>} titleDetail={<FamilySwitch families={families} selected={selectedFamily?.family} onPick={f => { 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={<Btn icon="sliders" aria-pressed={expert} aria-expanded={expert} aria-controls="native-expert-settings" onClick={() => { setExpert(v => !v); setMultiple(false); setGpus([]); setDeviceChoice('auto'); }}>{tr(expert ? 'Close expert mode' : 'Expert mode')}</Btn>}><div className="native-model-layout native-model-layout--fit"><div className="stack">- {tr(native?.instances.length && expert ? <section className="st-card native-running"><h2 className="h4">{tr(native.instances.length === 1 ? 'Loaded model' : 'Loaded models')}</h2>{tr(native.instances.map(i => <div key={i.id}><span><strong>{tr(i.label)}</strong><small>{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' : '')}</small>{tr(i.error ? <small className="inline-error">{tr(plainFailureText(i.error).message)}</small> : null)}</span>{tr(expert && multiple && native.defaultId !== i.id ? <Btn size="sm" variant="ghost" onClick={() => void perform(() => nativeAction(`instances/${i.id}/default`))}>{tr("Use in chat")}</Btn> : null)}<Btn size="sm" disabled={pending || !!active} onClick={() => void perform(() => nativeAction(`instances/${i.id}/unload`))}>{tr("Unload")}</Btn></div>))}</section> : null)}+ {tr(native?.instances.length && expert ? <section className="st-card native-running"><h2 className="h4">{tr(native.instances.length === 1 ? 'Loaded model' : 'Loaded models')}</h2>{tr(native.instances.map(i => <div key={i.id}><span><strong>{tr(i.label)}</strong><small>{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' : '')}</small>{tr(i.error ? <small className="inline-error">{tr(plainFailureText(i.error).message)}</small> : null)}</span>{tr(expert && multiple && native.defaultId !== i.id ? <Btn size="sm" variant="ghost" onClick={() => void loadedAction(`instances/${i.id}/default`)}>{tr("Use in chat")}</Btn> : null)}<Btn size="sm" disabled={pending || !!active} onClick={() => void loadedAction(`instances/${i.id}/unload`)}>{tr("Unload")}</Btn></div>))}{tr(loadedError ? <ErrorNotice message={loadedError} next={tr("Stop or answer the chat that is still using this model, then try again.")}/> : null)}</section> : null)}<section className="st-card native-choice">{tr(selectedFamily && (!selectedSize || selectedSize.needsNewerEngine) ? <><h2 className="h3">{tr("This model needs a newer engine.")}</h2><p className="small muted">{tr("Update your engine or import a local GGUF for this model.")}</p><Btn onClick={() => { setSettingsSection('Engine'); go('settings'); }}>{tr("Update engine")}</Btn><Btn variant="ghost" onClick={onImport ?? onOtherModels}>{tr("Use a local GGUF\u2026")}</Btn></> : null)}{tr(!selectedFamily ? <><h2 className="h3">{tr("Set up Strata")}</h2><p className="small muted">{tr("Connect your local installation to choose an optimized model.")}</p><Btn variant="primary" onClick={onConnectEngine ?? (() => { setSettingsSection('Engine'); go('settings'); })}>{tr("Connect engine")}</Btn>{tr(native?.error ? <p className="small inline-error">{tr(native.error)}</p> : null)}<Btn variant="ghost" onClick={onOtherModels}>{tr("Other local models")}</Btn></> : null)}{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)@@ -135,7 +147,7 @@ export function NativeModels({ onOtherModels, onReady, onImport, onConnectEngine<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><div className="native-choice__col"><span className="native-choice__label">{tr("Computer use")}</span><div className="native-resource-choice"><button aria-pressed={resourceProfile === 'work'} data-selected={resourceProfile === 'work'} onClick={() => setResourceProfile('work')}><Icon name="computer" size={20}/><span><strong>{tr("Leave 20% for my work")}</strong><small>{tr("Headroom for your other apps")}</small></span>{tr(resourceProfile === 'work' ? <Icon name="check" size={15}/> : null)}</button><button aria-pressed={resourceProfile === 'performance'} data-selected={resourceProfile === 'performance'} onClick={() => setResourceProfile('performance')}><Icon name="bolt" size={20}/><span><strong>{tr("Full performance")}</strong><small>{tr("Give Strata priority")}</small></span>{tr(resourceProfile === 'performance' ? <Icon name="check" size={15}/> : null)}</button></div></div></div>- {tr(cardOptions ? <div className="native-cards"><span className="native-choice__label">{tr("Graphics cards")}</span><div className="native-cards__list" role="radiogroup" aria-label={tr("Graphics cards")}>{cardOptions.options.map(o => { const on = activeCards?.key === o.key; return <button key={o.key} type="button" role="radio" aria-checked={on} data-selected={on} disabled={!!active} className="native-cards__opt" onClick={() => setCardsKey(o.key)}><span className="native-cards__dot" aria-hidden="true"/><span><strong>{o.label}</strong><small data-warn={o.verdict === 'spills' || o.verdict === 'tight'}>{[o.words, ...o.notes].join('. ')}.</small></span></button>; })}{cardOptions.ignored.length ? <p className="small muted native-cards__note">{`Not used: ${cardOptions.ignored.map(g => `${g.name ?? 'a card'} (${g.why_ignored})`).join('; ')}.`}</p> : null}</div></div> : null)}+ {tr(cardOptions ? <div className="native-cards"><span className="native-choice__label">{tr("Graphics cards")}</span><div className="native-cards__list" role="radiogroup" aria-label={tr("Graphics cards")}>{cardOptions.options.map(o => { const on = activeCards?.key === o.key; return <button key={o.key} type="button" role="radio" aria-checked={on} data-selected={on} disabled={!!active} className="native-cards__opt" onClick={() => setCardsKey(o.key)}><span className="native-cards__dot" aria-hidden="true"/><span><strong>{o.label}</strong><small data-warn={o.verdict === 'spills' || o.verdict === 'tight' || usedBy(o.cards).length > 0}>{[o.words, ...o.notes, ...(usedBy(o.cards).length ? [tr('Already used by {0}', [usedBy(o.cards).join(', ')])] : [])].join('. ')}.</small></span></button>; })}{cardOptions.ignored.length ? <p className="small muted native-cards__note">{`Not used: ${cardOptions.ignored.map(g => `${g.name ?? 'a card'} (${g.why_ignored})`).join('; ')}.`}</p> : null}</div></div> : null)}{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("Optional")}</small></strong><small>{tr("Understand photos, screenshots and charts. Vision files download automatically. Enable them when loading this model.")}</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)}diff --git a/apps/host/src/lib/plain-errors.ts b/apps/host/src/lib/plain-errors.tsindex 794e034e5..77e693902 100644--- a/apps/host/src/lib/plain-errors.ts+++ b/apps/host/src/lib/plain-errors.ts@@ -15,6 +15,7 @@ const MEMORY_NEXT = 'Close other programs and try again, or choose “Leave 20%/** Order matters: the first rule that matches wins. */const RULES: Rule[] = [+ { kind: 'gpu-shared', match: /GPU \d+ is already used by .*, so this model did not fit there/i, message: 'Another model on the same graphics card left no room for this one.', next: 'Load it on a different GPU, or unload the other model first.' },{ kind: 'engine-too-old', match: /needs a newer engine: .* needs engine/i, message: 'This model needs a newer engine.', next: 'Update the engine (Settings, Engine, Update engine), then try again.' },{ kind: 'settings-file', match: /settings file for this model has a mistake/i, message: 'Your settings file has a mistake, so the model was not started.', next: 'Open the settings file under Expert settings, fix the line shown under Details, then load the model again.' },{ kind: 'connector-missing', match: /connector \(cloudflared\) is not installed/i, message: 'Strata could not find Cloudflare’s connector (cloudflared) on this computer.', next: 'Install cloudflared (with your package manager, or from Cloudflare’s website), then press Retry setup. Strata finds it on your PATH and in the usual places.' },diff --git a/apps/host/src/locales/de.json b/apps/host/src/locales/de.jsonindex 37b035edb..7be6ca326 100644--- a/apps/host/src/locales/de.json+++ b/apps/host/src/locales/de.json@@ -3188,5 +3188,9 @@"s3192": "Zeile {0}: {1}","s3193": "In deiner Einstellungsdatei steckt ein Fehler, deshalb wurde das Modell nicht gestartet.","s3194": "Öffne die Einstellungsdatei unter „Experteneinstellungen“, behebe die unter „Details“ gezeigte Zeile und lade das Modell dann erneut.",- "s3195": "Aktualisiere die Engine (Einstellungen, Engine, „Engine aktualisieren“) und versuche es dann erneut."+ "s3195": "Aktualisiere die Engine (Einstellungen, Engine, „Engine aktualisieren“) und versuche es dann erneut.",+ "s3196": "Bereits von {0} belegt",+ "s3197": "Beende den Chat, der dieses Modell noch verwendet, oder beantworte seine Rückfrage, und versuche es dann erneut.",+ "s3198": "Ein anderes Modell auf derselben Grafikkarte hat für dieses keinen Platz gelassen.",+ "s3199": "Lade es auf einer anderen GPU oder entlade zuerst das andere Modell."}diff --git a/apps/host/src/locales/en.json b/apps/host/src/locales/en.jsonindex f8ff647c2..1dd02cab4 100644--- a/apps/host/src/locales/en.json+++ b/apps/host/src/locales/en.json@@ -3188,5 +3188,9 @@"s3192": "Line {0}: {1}","s3193": "Your settings file has a mistake, so the model was not started.","s3194": "Open the settings file under Expert settings, fix the line shown under Details, then load the model again.",- "s3195": "Update the engine (Settings, Engine, Update engine), then try again."+ "s3195": "Update the engine (Settings, Engine, Update engine), then try again.",+ "s3196": "Already used by {0}",+ "s3197": "Stop or answer the chat that is still using this model, then try again.",+ "s3198": "Another model on the same graphics card left no room for this one.",+ "s3199": "Load it on a different GPU, or unload the other model first."}diff --git a/apps/host/src/locales/es.json b/apps/host/src/locales/es.jsonindex 7a4e4bdbb..b9385490c 100644--- a/apps/host/src/locales/es.json+++ b/apps/host/src/locales/es.json@@ -3188,5 +3188,9 @@"s3192": "Línea {0}: {1}","s3193": "Tu archivo de ajustes tiene un error, así que el modelo no se ha iniciado.","s3194": "Abre el archivo de ajustes en «Ajustes expertos», corrige la línea que aparece en «Detalles» y vuelve a cargar el modelo.",- "s3195": "Actualiza el motor (Ajustes, Motor, «Actualizar motor») y vuelve a intentarlo."+ "s3195": "Actualiza el motor (Ajustes, Motor, «Actualizar motor») y vuelve a intentarlo.",+ "s3196": "Ya lo usa {0}",+ "s3197": "Detén el chat que sigue usando este modelo, o responde a su pregunta pendiente, y vuelve a intentarlo.",+ "s3198": "Otro modelo en la misma tarjeta gráfica no dejó espacio para este.",+ "s3199": "Cárgalo en otra GPU, o descarga primero el otro modelo."}diff --git a/apps/host/src/locales/ja.json b/apps/host/src/locales/ja.jsonindex 584929bef..f05bf80d4 100644--- a/apps/host/src/locales/ja.json+++ b/apps/host/src/locales/ja.json@@ -3188,5 +3188,9 @@"s3192": "{0}行目: {1}","s3193": "設定ファイルに誤りがあるため、モデルを起動しませんでした。","s3194": "「上級設定」で設定ファイルを開き、「詳細」に表示された行を修正してから、もう一度モデルを読み込んでください。",- "s3195": "エンジンを更新してから(設定、エンジン、「エンジンを更新」)、もう一度お試しください。"+ "s3195": "エンジンを更新してから(設定、エンジン、「エンジンを更新」)、もう一度お試しください。",+ "s3196": "{0} がすでに使用中",+ "s3197": "このモデルをまだ使っているチャットを停止するか、その確認に答えてから、もう一度お試しください。",+ "s3198": "同じグラフィックスカード上の別のモデルが、このモデルの分の空きを残しませんでした。",+ "s3199": "別のGPUに読み込むか、先にもう一方のモデルをアンロードしてください。"}diff --git a/apps/host/src/locales/ko.json b/apps/host/src/locales/ko.jsonindex 585d77b8e..50edd28f2 100644--- a/apps/host/src/locales/ko.json+++ b/apps/host/src/locales/ko.json@@ -3188,5 +3188,9 @@"s3192": "{0}번째 줄: {1}","s3193": "설정 파일에 오류가 있어 모델을 시작하지 않았습니다.","s3194": "'전문가 설정'에서 설정 파일을 열고 '세부 정보'에 표시된 줄을 수정한 뒤 모델을 다시 불러오세요.",- "s3195": "엔진을 업데이트한 뒤(설정, 엔진, '엔진 업데이트') 다시 시도하세요."+ "s3195": "엔진을 업데이트한 뒤(설정, 엔진, '엔진 업데이트') 다시 시도하세요.",+ "s3196": "이미 {0}에서 사용 중",+ "s3197": "이 모델을 아직 사용 중인 채팅을 중지하거나 대기 중인 질문에 답한 뒤 다시 시도하세요.",+ "s3198": "같은 그래픽 카드의 다른 모델이 이 모델을 위한 공간을 남기지 않았습니다.",+ "s3199": "다른 GPU에 불러오거나 먼저 다른 모델을 언로드하세요."}diff --git a/apps/host/src/locales/pt.json b/apps/host/src/locales/pt.jsonindex 67c97df98..33e4c618a 100644--- a/apps/host/src/locales/pt.json+++ b/apps/host/src/locales/pt.json@@ -3188,5 +3188,9 @@"s3192": "Linha {0}: {1}","s3193": "Seu arquivo de configurações tem um erro, então o modelo não foi iniciado.","s3194": "Abra o arquivo de configurações em «Configurações avançadas», corrija a linha mostrada em «Detalhes» e carregue o modelo novamente.",- "s3195": "Atualize o mecanismo (Configurações, Mecanismo, «Atualizar mecanismo») e tente novamente."+ "s3195": "Atualize o mecanismo (Configurações, Mecanismo, «Atualizar mecanismo») e tente novamente.",+ "s3196": "Já em uso por {0}",+ "s3197": "Pare o chat que ainda usa este modelo, ou responda à pergunta pendente dele, e tente novamente.",+ "s3198": "Outro modelo na mesma placa de vídeo não deixou espaço para este.",+ "s3199": "Carregue-o em outra GPU ou descarregue primeiro o outro modelo."}diff --git a/apps/host/src/locales/ru.json b/apps/host/src/locales/ru.jsonindex 2c5df09cb..2ff2b1224 100644--- a/apps/host/src/locales/ru.json+++ b/apps/host/src/locales/ru.json@@ -3188,5 +3188,9 @@"s3192": "Строка {0}: {1}","s3193": "В файле настроек есть ошибка, поэтому модель не была запущена.","s3194": "Откройте файл настроек в разделе «Экспертные настройки», исправьте строку, указанную в «Подробностях», и загрузите модель снова.",- "s3195": "Обновите движок (Настройки, Движок, «Обновить движок») и повторите попытку."+ "s3195": "Обновите движок (Настройки, Движок, «Обновить движок») и повторите попытку.",+ "s3196": "Уже занята: {0}",+ "s3197": "Остановите чат, который всё ещё использует эту модель, или ответьте на его запрос, затем повторите попытку.",+ "s3198": "Другая модель на той же видеокарте не оставила места для этой.",+ "s3199": "Загрузите её на другую видеокарту или сначала выгрузите другую модель."}diff --git a/apps/host/src/locales/zh.json b/apps/host/src/locales/zh.jsonindex 030d05906..597c39e85 100644--- a/apps/host/src/locales/zh.json+++ b/apps/host/src/locales/zh.json@@ -3188,5 +3188,9 @@"s3192": "第 {0} 行:{1}","s3193": "你的设置文件有错误,因此没有启动模型。","s3194": "在“专家设置”中打开设置文件,修复“详情”中显示的那一行,然后重新加载模型。",- "s3195": "请更新引擎(设置、引擎、“更新引擎”),然后重试。"+ "s3195": "请更新引擎(设置、引擎、“更新引擎”),然后重试。",+ "s3196": "已被 {0} 占用",+ "s3197": "请停止仍在使用此模型的聊天,或回答它等待的确认,然后重试。",+ "s3198": "同一块显卡上的另一个模型没有给这个模型留出空间。",+ "s3199": "请将它加载到另一块 GPU 上,或先卸载另一个模型。"}diff --git a/apps/host/tests/native-two-models.test.mjs b/apps/host/tests/native-two-models.test.mjsnew file mode 100644index 000000000..cca9f6cca--- /dev/null+++ b/apps/host/tests/native-two-models.test.mjs@@ -0,0 +1,37 @@+import test from 'node:test';+import assert from 'node:assert/strict';+import { readFile } from 'node:fs/promises';+import { nativeFixture, finishJob } from './helpers/native-fixture.mjs';++test('a second model on a card another model uses still loads (recommend, never force); two cards, two models', async () => {+ const f = nativeFixture();+ try {+ await f.control.refresh(true);+ const load = async args => { const done = await finishJob(f.control, f.control.operation('load', args).id); assert.equal(done.state, 'done', done.error); return done; };+ await load({ model: 'iq2_xs', gpus: [0], multiple: true });+ await load({ model: 'iq3_s', gpus: [1], multiple: true });+ assert.deepEqual(f.control.state().instances.map(i => [i.model, i.gpus, i.status]), [['iq2_xs', [0], 'ready'], ['iq3_s', [1], 'ready']]);+ await load({ model: 'iq3_s', gpus: [0], multiple: true }); // the same card as the first model: allowed, and said on the card's row+ assert.equal(f.control.state().instances.length, 3);+ } finally { await f.cleanup(); }+});++test('the screens say which card a loaded model uses, prefer a free card for a second model, and show an unload refusal beside its button', async () => {+ const models = await readFile(new URL('../src/components/NativeModels.tsx', import.meta.url), 'utf8');+ assert.match(models, /tr\('Already used by \{0\}', \[usedBy\(o\.cards\)\.join\(', '\)\]\)/);+ assert.match(models, /multiple \? cardOptions\.options\.find\(o => o\.recommended && !usedBy\(o\.cards\)\.length\)/);+ assert.match(models, /loadedAction\(`instances\/\$\{i\.id\}\/unload`\)/);+ assert.match(models, /loadedError \? <ErrorNotice message=\{loadedError\}/);+ const control = await readFile(new URL('../server/native-control.mjs', import.meta.url), 'utf8');+ assert.match(control, /is already used by \$\{sharedWith\.label\}, so this model did not fit there/);+});++test('usedBy is declared before the card choice that calls it (a const used earlier broke the Models page when Run multiple models was on)', async () => {+ const models = await readFile(new URL('../src/components/NativeModels.tsx', import.meta.url), 'utf8');+ assert.ok(models.indexOf('const usedBy = ') > 0 && models.indexOf('const usedBy = ') < models.indexOf('const activeCards = '));+});++test('a model that failed to start is not offered in the chat model picker', async () => {+ const picker = await readFile(new URL('../src/components/ChatModelPicker.tsx', import.meta.url), 'utf8');+ assert.equal((picker.match(/native\?\.instances\.filter\(i => i\.status !== 'error'\)\.map/g) ?? []).length, 2);+});diff --git a/apps/host/tests/plain-errors.test.mjs b/apps/host/tests/plain-errors.test.mjsindex 6221f2ca8..f166d959c 100644--- a/apps/host/tests/plain-errors.test.mjs+++ b/apps/host/tests/plain-errors.test.mjs@@ -9,6 +9,7 @@ const built = await build({ stdin: { contents: "export * from './src/lib/plain-econst { plainFailure, plainFailureText, setTranslationLanguage } = await import(`data:text/javascript;base64,${Buffer.from(built.outputFiles[0].text).toString('base64')}`);const cases = [+ ['GPU 2 is already used by qwen3.8-flash-next-q2_0, so this model did not fit there. Load it on another GPU, or unload qwen3.8-flash-next-q2_0 first.', 'gpu-shared', /no room for this one/],['This model needs a newer engine: Gyro-S needs engine 0.1.45.1 or newer, and this one is 0.1.45. Update the engine in Settings, then try again.', 'engine-too-old', /needs a newer engine/],['The settings file for this model has a mistake, so the model was not started. Line 4: The settings file is not valid JSON; look near line 4.', 'settings-file', /settings file has a mistake/],['The Cloudflare connector (cloudflared) is not installed here, and the app never downloads it while it runs. Install it from the optional connector component.', 'connector-missing', /could not find Cloudflare’s connector/],