Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Studio: change Parallel Slots from the API page's Slots readout (#14225)
Daniel Hancd2595f19d6e
diff --git a/studio/frontend/scripts/check-bundle-budget.ts b/studio/frontend/scripts/check-bundle-budget.tsindex 2315f1b7ca9..f7410578e43 100644--- a/studio/frontend/scripts/check-bundle-budget.ts+++ b/studio/frontend/scripts/check-bundle-budget.ts@@ -281,8 +281,14 @@ export const BUDGET = {// Naming a chat export after its model, title and day (#12586) adds 615 B raw / 65 B transfer (6,842,183 ->// 6,842,798 B raw, 2,060,321 -> 2,060,386 B transfer against 46e4f50bea, one machine and build, Node 24,// 96 chunks): the name builder sits beside the chat exporters in the eager chat chunk. Raised by that growth.- transferBytes: 2_060_794,- rawBytes: 6_843_649,+ // Opening Parallel Slots from the API page's Slots readout (#14225) adds 546 B raw / 212 B transfer (6,842,518 ->+ // 6,843,064 B raw, 2,060,427 -> 2,060,639 B transfer against bff0a25b4, one machine and build, Node 24, 96 chunks):+ // the field focus and per-visit Advanced reveal live in the Run settings page and the picker, both in the eager chat+ // chunk. Raised to the measured build plus the same 160 B raw / 189 B transfer margin.+ // Reconciled with main at 87c6408455: the combined build measures 6,844,101 B raw / 2,060,934 B transfer+ // (Node 24, 96 chunks). The API Settings button stays in its lazy page. Keep the same 160 B / 189 B margin.+ transferBytes: 2_061_123,+ rawBytes: 6_844_261,};// The chunk count is reported but not budgeted. Splitting a page out of the entry raises it while lowering thediff --git a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx b/studio/frontend/src/features/api-monitor/api-monitor-page.tsxindex b44840b5d45..5f742954637 100644--- a/studio/frontend/src/features/api-monitor/api-monitor-page.tsx+++ b/studio/frontend/src/features/api-monitor/api-monitor-page.tsx@@ -25,6 +25,10 @@ import { useChatRuntimeStore } from "@/features/chat/stores/chat-runtime-store";import type { ApiMonitorEntry } from "@/features/chat";import { isExternalModelId } from "@/features/chat/external-providers";import { modelIdsMatch } from "@/features/hub/lib/model-identity";+import {+ type ModelConfigHandoffRequest,+ createModelConfigHandoffRequestId,+} from "@/features/model-picker";import {lanApiUrls,loadLanAccess,@@ -53,6 +57,13 @@ import { isLifecycleEntry, lifecycleLabel } from "./lifecycle";import { PAYLOAD_SHOW_ALL_MAX_CHARS, payloadPreview } from "./payload-preview";import { ToolbarTooltip } from "./components/toolbar-tooltip";import { unloadResident } from "./unload-resident";+import {+ residentHasRunSettings,+ residentHasSlotsSetting,+ runSettingsRequest,+ slotsSettingsRequest,+} from "./slots-settings-request";+import { useResidentRunTarget } from "./use-resident-run-target";import {type MonitorStatusFilter,filterEntries,@@ -604,6 +615,13 @@ export function ApiMonitorPage(): ReactElement {// block raw unloads while a picker load could finish afterward without a lifecycle guard.const modelLoading = useChatRuntimeStore((s) => s.modelLoading);const [unloadError, setUnloadError] = useState<string | null>(null);+ const resident = useResidentRunTarget(data?.active_model);+ const [configRequest, setConfigRequest] =+ useState<ModelConfigHandoffRequest | null>(null);+ const canEditSettings =+ !modelLoading && !unloading && residentHasRunSettings(resident);+ const canEditSlots =+ !modelLoading && !unloading && residentHasSlotsSetting(resident);useEffect(() => {const refreshRemoteBase = () => {@@ -744,6 +762,15 @@ export function ApiMonitorPage(): ReactElement {: serverStatus === "ready"? "Ready": "No model loaded";+ const slotsLabel = data?.queue+ ? `${data.queue.active}/${data.queue.capacity} busy${+ data.queue.queued > 0 ? ` · ${data.queue.queued} queued` : ""+ }`+ : "";+ const slotsClassName = cn(+ "text-ui-12 tabular-nums text-foreground",+ (data?.queue?.queued ?? 0) > 0 && "text-amber-700 dark:text-amber-500",+ );return (<main className="mx-auto flex w-full max-w-6xl 3xl:max-w-[calc(1440px*var(--ui-space-scale,1))] 4xl:max-w-[calc(1760px*var(--ui-space-scale,1))] flex-col gap-6 px-6 pb-10 pt-12 max-sm:px-4 max-sm:pt-8 font-heading sm:px-10">@@ -763,6 +790,19 @@ export function ApiMonitorPage(): ReactElement {onSettled={refresh}onUnloadActive={unloadActiveModel}unloading={unloading}+ configRequest={configRequest}+ onConfigRequestAdopted={() => setConfigRequest(null)}+ onOpenSettings={+ canEditSettings+ ? () =>+ setConfigRequest(+ runSettingsRequest(+ resident,+ createModelConfigHandoffRequestId(),+ ),+ )+ : undefined+ }/><ToolbarTooltiplabel={paused ? "Resume the live feed" : "Pause the live feed"}@@ -910,15 +950,29 @@ export function ApiMonitorPage(): ReactElement {<span className="text-ui-10 font-medium uppercase tracking-wider text-muted-foreground">Slots</span>- <span- className={cn(- "text-ui-12 tabular-nums text-foreground",- data.queue.queued > 0 && "text-amber-700 dark:text-amber-500",- )}- >- {data.queue.active}/{data.queue.capacity} busy- {data.queue.queued > 0 ? ` · ${data.queue.queued} queued` : ""}- </span>+ {canEditSlots ? (+ <ToolbarTooltip label="Change parallel slots">+ <button+ type="button"+ onClick={() =>+ setConfigRequest(+ slotsSettingsRequest(+ resident,+ createModelConfigHandoffRequestId(),+ ),+ )+ }+ className={cn(+ slotsClassName,+ "w-fit cursor-pointer text-left underline decoration-dotted decoration-muted-foreground/60 underline-offset-4 hover:decoration-foreground",+ )}+ >+ {slotsLabel}+ </button>+ </ToolbarTooltip>+ ) : (+ <span className={slotsClassName}>{slotsLabel}</span>+ )}</div>) : null}<div className="flex min-w-0 flex-1 flex-col">diff --git a/studio/frontend/src/features/api-monitor/components/api-model-load-controls.tsx b/studio/frontend/src/features/api-monitor/components/api-model-load-controls.tsxindex c52af249dff..dbf39c45354 100644--- a/studio/frontend/src/features/api-monitor/components/api-model-load-controls.tsx+++ b/studio/frontend/src/features/api-monitor/components/api-model-load-controls.tsx@@ -22,17 +22,17 @@ import {} from "@/features/hub";import {type LoraModelOption,+ type ModelConfigHandoffRequest,type ModelOption,ModelSelector,type ModelSelectorChangeMeta,currentRuntimePerModelConfig,resolveResidentInitialConfig,- splitQuantSuffix,useActiveModelConfig,} from "@/features/model-picker";import { isNpuModelId } from "@/features/npu";import { cn } from "@/lib/utils";-import { ReloadIcon } from "@hugeicons/core-free-icons";+import { ReloadIcon, Settings02Icon } from "@hugeicons/core-free-icons";import { HugeiconsIcon } from "@hugeicons/react";import {type Dispatch,@@ -47,6 +47,7 @@ import {RELOAD_MISSING_HISTORY_MESSAGE,reloadLastModel,} from "../reload-last-model";+import { monitorSelection } from "../use-resident-run-target";import { ToolbarTooltip } from "./toolbar-tooltip";// A pick superseded by a newer one rejects too; the newer pick owns the outcome.@@ -124,22 +125,6 @@ function localSelection(};}-// The monitor reports a llama.cpp model as "<id>:<quant>"; Ollama ids carry their own ":<tag>".-function monitorSelection(activeModel: string | null | undefined): {- id: string;- ggufVariant: string | null;-} {- if (!activeModel) {- return { id: "", ggufVariant: null };- }- const split = activeModel.startsWith("ollama/")- ? null- : splitQuantSuffix(activeModel);- return split- ? { id: split[0], ggufVariant: split[1] }- : { id: activeModel, ggufVariant: null };-}-type PendingDownload = {id: string;meta: ModelSelectorChangeMeta;@@ -226,12 +211,18 @@ export function ApiModelLoadControls({onSettled,onUnloadActive,unloading,+ configRequest = null,+ onConfigRequestAdopted,+ onOpenSettings,}: {activeModel: string | null | undefined;onSettled: () => void;onUnloadActive: () => void;// The page's unload rereads the resident on its second pass, so a load started meanwhile would be unloaded.unloading: boolean;+ configRequest?: ModelConfigHandoffRequest | null;+ onConfigRequestAdopted?: (requestId: string) => void;+ onOpenSettings?: () => void;}): ReactElement {const { selectModel, loadNpuModel, refresh, ejectModel } =useChatModelRuntime();@@ -273,6 +264,13 @@ export function ApiModelLoadControls({refreshLastLoadLabel();}, [refresh, refreshLocalModels, refreshLastLoadLabel]);+ // Opened during render, as the picker adopts the request, so the same pass mounts its page.+ const [openedRequestId, setOpenedRequestId] = useState<string | null>(null);+ if (configRequest && configRequest.requestId !== openedRequestId) {+ setOpenedRequestId(configRequest.requestId);+ setSelectorOpen(true);+ }+// An API auto-switch changes the resident model behind Chat's store; this page's own loads// reconcile themselves.useEffect(() => {@@ -427,7 +425,7 @@ export function ApiModelLoadControls({publicModelId(runtimeCheckpoint) === effectiveModel;return (- <div className="flex flex-wrap items-center gap-2">+ <div className="flex min-w-0 max-w-full flex-wrap items-center gap-2"><ModelSelectormodels={models}loraModels={loraModels}@@ -438,6 +436,8 @@ export function ApiModelLoadControls({activeLoadedContextLength={runtimeIsResident ? loadedContextLength : null}+ configRequest={configRequest}+ onConfigRequestAdopted={onConfigRequestAdopted}onValueChange={(value, meta) => {handlePick(value, meta);}}@@ -456,8 +456,35 @@ export function ApiModelLoadControls({placeholder="Load model"open={selectorOpen && !unloading}onOpenChange={setSelectorOpen}- className={cn("h-9 rounded-full")}+ className="h-9 max-w-full rounded-full"+ contentClassName="max-sm:max-w-[calc(100vw-3rem)]"/>+ <ToolbarTooltip+ label={+ activeModel+ ? "Model run settings"+ : "Load a model to change its run settings"+ }+ >+ <Button+ type="button"+ variant="outline"+ size="sm"+ aria-label="Model settings"+ aria-haspopup="dialog"+ aria-expanded={selectorOpen && !unloading}+ onClick={onOpenSettings}+ disabled={busy || reloading || !onOpenSettings}+ className="h-9 gap-1.5 rounded-full"+ >+ <HugeiconsIcon+ icon={Settings02Icon}+ strokeWidth={1.75}+ className="size-4"+ />+ Settings+ </Button>+ </ToolbarTooltip><ToolbarTooltip label={reloadTitle(lastLoadLabel, Boolean(activeModel))}><Buttontype="button"diff --git a/studio/frontend/src/features/api-monitor/slots-settings-request.ts b/studio/frontend/src/features/api-monitor/slots-settings-request.tsnew file mode 100644index 00000000000..cf0ab0eea2c--- /dev/null+++ b/studio/frontend/src/features/api-monitor/slots-settings-request.ts@@ -0,0 +1,106 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++// eslint-disable-next-line no-restricted-imports -- The barrel pulls in React components, which node tests cannot load.+import {+ type ModelConfigHandoffRequest,+ modelConfigTarget,+ modelConfigTargetIsResident,+} from "@/features/model-picker/model-config/model-config-handoff";++/** The resident model as Chat's runtime holds it: the same fields Chat's own reload sends. */+export type ResidentRunTarget = {+ checkpoint: string;+ ggufVariant: string | null;+ isGguf: boolean;+ isLora: boolean;+ isDiffusion: boolean;+ loadId: string | null;+ nativePathToken: string | null;+ nativePathExpiresAtMs: number | null;+};++/** Run can only apply settings while access to the resident model is still valid. */+export function residentHasRunSettings(+ resident: ResidentRunTarget | null,+ nowMs: number = Date.now(),+): resident is ResidentRunTarget {+ if (!resident) {+ return false;+ }+ // An expired file token cannot reload the model, so there is nothing to apply the change to.+ return !(+ resident.nativePathToken &&+ resident.nativePathExpiresAtMs != null &&+ nowMs >= resident.nativePathExpiresAtMs+ );+}++/** Only a llama-server load reports slots to the monitor; the diffusion runner gets no --parallel. */+export function residentHasSlotsSetting(+ resident: ResidentRunTarget | null,+ nowMs: number = Date.now(),+): resident is ResidentRunTarget {+ return (+ residentHasRunSettings(resident, nowMs) &&+ resident.isGguf &&+ !resident.isDiffusion+ );+}++/** Open the loaded model's settings with Advanced visible for this visit. */+export function runSettingsRequest(+ resident: ResidentRunTarget | null,+ requestId: string,+ nowMs: number = Date.now(),+): ModelConfigHandoffRequest | null {+ if (!residentHasRunSettings(resident, nowMs)) {+ return null;+ }+ return {+ requestId,+ id: resident.checkpoint,+ focus: "advanced",+ meta: {+ source: "local",+ isLora: resident.isLora,+ loadId: resident.loadId,+ ggufVariant: resident.ggufVariant ?? undefined,+ nativePathToken: resident.nativePathToken ?? undefined,+ nativePathExpiresAtMs: resident.nativePathExpiresAtMs,+ isGguf: resident.isGguf,+ isDiffusion: resident.isDiffusion,+ isDownloaded: true,+ },+ };+}++/** Opens the resident's Run settings on Parallel Slots, so Run saves and reloads as it does there. */+export function slotsSettingsRequest(+ resident: ResidentRunTarget | null,+ requestId: string,+ nowMs: number = Date.now(),+): ModelConfigHandoffRequest | null {+ const request = runSettingsRequest(resident, requestId, nowMs);+ return request && residentHasSlotsSetting(resident, nowMs)+ ? { ...request, focus: "parallelSlots" }+ : null;+}++/** The picker's residency test on the target the request opens. A file-picked GGUF (path vs the+ * monitor's stem) or a quant Chat has not caught up with fails it and would open on stored settings. */+export function residentMatchesMonitor(+ resident: ResidentRunTarget | null,+ monitor: { id: string; ggufVariant: string | null },+ nowMs: number = Date.now(),+): boolean {+ const request = runSettingsRequest(resident, "", nowMs);+ return (+ request !== null &&+ modelConfigTargetIsResident({+ target: modelConfigTarget(request.id, request.meta),+ selectedId: monitor.id,+ activeGgufVariant: monitor.ggufVariant,+ })+ );+}diff --git a/studio/frontend/src/features/api-monitor/use-resident-run-target.ts b/studio/frontend/src/features/api-monitor/use-resident-run-target.tsnew file mode 100644index 00000000000..d7c2cd60a35--- /dev/null+++ b/studio/frontend/src/features/api-monitor/use-resident-run-target.ts@@ -0,0 +1,81 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import { useChatRuntimeStore } from "@/features/chat";+import { publicModelId } from "@/features/hub";+import {+ splitQuantSuffix,+ useActiveModelConfig,+} from "@/features/model-picker";+import { useMemo } from "react";+import {+ type ResidentRunTarget,+ residentMatchesMonitor,+} from "./slots-settings-request";++// The monitor reports a llama.cpp model as "<id>:<quant>"; Ollama ids carry their own ":<tag>".+export function monitorSelection(activeModel: string | null | undefined): {+ id: string;+ ggufVariant: string | null;+} {+ if (!activeModel) {+ return { id: "", ggufVariant: null };+ }+ const split = activeModel.startsWith("ollama/")+ ? null+ : splitQuantSuffix(activeModel);+ return split+ ? { id: split[0], ggufVariant: split[1] }+ : { id: activeModel, ggufVariant: null };+}++/** The resident as Chat's runtime holds it, or null when that is not the model the monitor reports. */+export function useResidentRunTarget(+ activeModel: string | null | undefined,+): ResidentRunTarget | null {+ const { checkpoint, isGguf } = useActiveModelConfig();+ const ggufVariant = useChatRuntimeStore((s) => s.activeGgufVariant);+ const isDiffusion = useChatRuntimeStore((s) => s.loadedIsDiffusion);+ const loadId = useChatRuntimeStore((s) => s.activeLoadId);+ const nativePathToken = useChatRuntimeStore((s) => s.activeNativePathToken);+ const nativePathExpiresAtMs = useChatRuntimeStore(+ (s) => s.activeNativePathExpiresAtMs,+ );+ const models = useChatRuntimeStore((s) => s.models);+ const loras = useChatRuntimeStore((s) => s.loras);+ return useMemo(() => {+ const { id, ggufVariant: monitorVariant } = monitorSelection(activeModel);+ // The picker's own test for handing Run settings the live config (runtimeIsResident).+ if (!id || checkpoint == null || publicModelId(checkpoint) !== id) {+ return null;+ }+ const model = models.find((entry) => entry.id === checkpoint);+ const isLora = model+ ? model.isLora+ : loras.find((entry) => entry.id === checkpoint)?.exportType === "lora";+ const resident = {+ checkpoint,+ ggufVariant,+ isGguf,+ isLora,+ isDiffusion,+ loadId,+ nativePathToken,+ nativePathExpiresAtMs,+ };+ return residentMatchesMonitor(resident, { id, ggufVariant: monitorVariant })+ ? resident+ : null;+ }, [+ activeModel,+ checkpoint,+ isGguf,+ ggufVariant,+ isDiffusion,+ loadId,+ nativePathToken,+ nativePathExpiresAtMs,+ models,+ loras,+ ]);+}diff --git a/studio/frontend/src/features/model-picker/components/model-config-page.tsx b/studio/frontend/src/features/model-picker/components/model-config-page.tsxindex c8f063c26bd..1558397e824 100644--- a/studio/frontend/src/features/model-picker/components/model-config-page.tsx+++ b/studio/frontend/src/features/model-picker/components/model-config-page.tsx@@ -220,6 +220,7 @@ import {import { ChatTemplateEditorDialog } from "./chat-template-editor-dialog";import { MemoryEstimateRow } from "./memory-estimate-row";import type { ModelPickTarget } from "./model-selector/types";+import type { ModelConfigFocus } from "../model-config/model-config-handoff";import { reconcileTensorSplit } from "@/hooks/gpu-tensor-split";import {NumericValueInput,@@ -1260,11 +1261,25 @@ function ParallelSlotsRow({config,update,hint,+ focusOnMount = false,}: {config: PerModelConfig;update: (patch: Partial<PerModelConfig>) => void;hint: string;+ focusOnMount?: boolean;}) {+ const inputRef = useRef<HTMLInputElement>(null);+ useEffect(() => {+ if (!focusOnMount) {+ return;+ }+ // Next frame: the popover moves focus to itself after its children mount.+ const frame = window.requestAnimationFrame(() => {+ inputRef.current?.scrollIntoView({ block: "center" });+ inputRef.current?.focus({ preventScroll: true });+ });+ return () => window.cancelAnimationFrame(frame);+ }, [focusOnMount]);return (<div className={ROW_CLASS}><div className="flex min-w-0 items-center gap-1.5">@@ -1272,6 +1287,7 @@ function ParallelSlotsRow({<InfoHint>{hint}</InfoHint></div><input+ ref={inputRef}type="number"min={N_PARALLEL_MIN}max={N_PARALLEL_MAX}@@ -1658,6 +1674,7 @@ function GgufAdvancedSettings({moeLayersInputRef,onExtraArgsLoadableChange,draftKey,+ focusParallelSlots,}: {config: PerModelConfig;update: (patch: Partial<PerModelConfig>) => void;@@ -1674,6 +1691,7 @@ function GgufAdvancedSettings({/** Which stored entries the extra-arguments row reads, most specific first. */onExtraArgsLoadableChange: (loadable: boolean) => void;draftKey: string;+ focusParallelSlots: boolean;}) {const batchAdviceId = useId();const ubatchAdviceId = useId();@@ -1853,7 +1871,12 @@ function GgufAdvancedSettings({</div>)}- <ParallelSlotsRow config={config} update={update} hint={GGUF_PARALLEL_HINT} />+ <ParallelSlotsRow+ config={config}+ update={update}+ hint={GGUF_PARALLEL_HINT}+ focusOnMount={focusParallelSlots}+ />{!isDiffusion && (<div className="space-y-1">@@ -2342,6 +2365,7 @@ interface ModelConfigPageProps {/** Page variant only: render the built-in "Run settings" title block. A host that already shows* the model name as its page heading turns this off. */showHeader?: boolean;+ focusField?: ModelConfigFocus;}export function ModelConfigPage({@@ -2354,6 +2378,7 @@ export function ModelConfigPage({isDiffusion = false,variant = "page",showHeader = true,+ focusField,}: ModelConfigPageProps) {const rememberId = useId();const platformDeviceType = usePlatformStore((s) => s.deviceType);@@ -2568,10 +2593,16 @@ export function ModelConfigPage({// and a width that starts applying then has to surface.const autoOpenForMlxKvQuant = servedByMlx && initialMlxKvQuant != null;const autoOpenForMlxInt8Prefill = servedByMlx && initialMlxInt8Prefill;+ // Opened to change one field: show its section for this visit, leaving the saved switch alone.+ const [revealForFocus, setRevealForFocus] = useState(focusField != null);const showAdvanced =- advancedPreference ??- (autoOpenAdvanced || autoOpenForMlxKvQuant || autoOpenForMlxInt8Prefill);- const toggleAdvanced = saveAdvancedSettingsOpen;+ revealForFocus ||+ (advancedPreference ??+ (autoOpenAdvanced || autoOpenForMlxKvQuant || autoOpenForMlxInt8Prefill));+ const toggleAdvanced = (open: boolean) => {+ setRevealForFocus(false);+ saveAdvancedSettingsOpen(open);+ };const contextInputRef = useRef<NumericValueInputHandle>(null);const maxSeqLengthInputRef = useRef<NumericValueInputHandle>(null);const gpuLayersInputRef = useRef<NumericValueInputHandle>(null);@@ -3813,6 +3844,7 @@ export function ModelConfigPage({moeLayersInputRef={moeLayersInputRef}draftKey={draftKey}onExtraArgsLoadableChange={setExtraArgsLoadable}+ focusParallelSlots={focusField === "parallelSlots"}/>)}</>diff --git a/studio/frontend/src/features/model-picker/components/model-selector.tsx b/studio/frontend/src/features/model-picker/components/model-selector.tsxindex 24ea2d12fcf..7e903ceaac9 100644--- a/studio/frontend/src/features/model-picker/components/model-selector.tsx+++ b/studio/frontend/src/features/model-picker/components/model-selector.tsx@@ -37,6 +37,7 @@ import {useState,} from "react";import {+ type ModelConfigFocus,type ModelConfigHandoffRequest,modelConfigTarget,modelConfigTargetIsResident,@@ -480,6 +481,7 @@ function ModelSelectorContent({const [adoptedConfigRequestId, setAdoptedConfigRequestId] = useState<string | null>(null);+ const [configFocus, setConfigFocus] = useState<ModelConfigFocus | null>(null);// The picker remounts on each open but this section state does not, so re-derive the default// section on the open edge.@@ -494,6 +496,7 @@ function ModelSelectorContent({}if (!open && wasOpen.current) {setConfigTarget(null);+ setConfigFocus(null);}wasOpen.current = open;}, [open, wantsConnectedDefault, hasAdditionalOnDeviceModels]);@@ -545,6 +548,7 @@ function ModelSelectorContent({? id.slice(NPU_MODEL_PREFIX.length): undefined;setConfigTarget(modelConfigTarget(id, meta, displayName));+ setConfigFocus(null);};const requestedConfigTarget = useMemo(() =>@@ -581,6 +585,7 @@ function ModelSelectorContent({) {setAdoptedConfigRequestId(configRequest.requestId);setConfigTarget(requestedConfigTarget);+ setConfigFocus(configRequest.focus ?? null);}useEffect(() => {if (!configRequest || adoptedConfigRequestId !== configRequest.requestId) {@@ -652,7 +657,11 @@ function ModelSelectorContent({visibleLoadedConfig,)}target={visibleConfigTarget}- onBack={() => setConfigTarget(null)}+ onBack={() => {+ setConfigTarget(null);+ setConfigFocus(null);+ }}+ focusField={configFocus ?? undefined}onRun={(config, isDiffusion) =>onSelect(visibleConfigTarget.configId ?? visibleConfigTarget.id,diff --git a/studio/frontend/src/features/model-picker/model-config/model-config-handoff.ts b/studio/frontend/src/features/model-picker/model-config/model-config-handoff.tsindex e1639d41126..6164b69701b 100644--- a/studio/frontend/src/features/model-picker/model-config/model-config-handoff.ts+++ b/studio/frontend/src/features/model-picker/model-config/model-config-handoff.ts@@ -24,8 +24,12 @@ export interface ModelConfigHandoffRequest {id: string;displayName?: string;meta: ModelSelectorChangeMeta;+ /** Section or field the Run settings page opens on. */+ focus?: ModelConfigFocus;}+export type ModelConfigFocus = "advanced" | "parallelSlots";+interface ModelConfigHandoffState {request: ModelConfigHandoffRequest | null;submit: (request: ModelConfigHandoffRequest) => void;diff --git a/studio/frontend/tests/api-monitor-slots-settings-request.test.ts b/studio/frontend/tests/api-monitor-slots-settings-request.test.tsnew file mode 100644index 00000000000..deb52bf0c76--- /dev/null+++ b/studio/frontend/tests/api-monitor-slots-settings-request.test.ts@@ -0,0 +1,137 @@+// SPDX-License-Identifier: AGPL-3.0-only+// Copyright 2026-present the Unsloth AI Inc. team. All rights reserved. See /studio/LICENSE.AGPL-3.0++import assert from "node:assert/strict";+import test from "node:test";++import type { ResidentRunTarget } from "../src/features/api-monitor/slots-settings-request.ts";+import { registerBundlerResolver } from "./helpers/kit.ts";++registerBundlerResolver();++const {+ residentHasRunSettings,+ residentHasSlotsSetting,+ residentMatchesMonitor,+ runSettingsRequest,+ slotsSettingsRequest,+} = await import("../src/features/api-monitor/slots-settings-request.ts");++const GGUF: ResidentRunTarget = {+ checkpoint: "unsloth/Qwen3-4B-GGUF",+ ggufVariant: "UD-Q4_K_XL",+ isGguf: true,+ isLora: false,+ isDiffusion: false,+ loadId: null,+ nativePathToken: null,+ nativePathExpiresAtMs: null,+};++test("Settings opens Advanced without focusing Parallel Slots or changing the load identity", () => {+ const resident = {+ ...GGUF,+ loadId: "/cache/qwen",+ nativePathToken: "token",+ nativePathExpiresAtMs: 1_000,+ };+ const request = runSettingsRequest(resident, "settings", 999);+ const slots = slotsSettingsRequest(resident, "slots", 999);+ assert.equal(request?.focus, "advanced");+ assert.equal(request?.id, resident.checkpoint);+ assert.equal(request?.meta.loadId, resident.loadId);+ assert.equal(request?.meta.nativePathToken, "token");+ assert.deepEqual(request?.meta, slots?.meta);+ assert.equal(runSettingsRequest(resident, "expired", 1_000), null);+ assert.equal(residentHasRunSettings(null), false);+});++test("Settings also supports non-GGUF residents without offering a Slots shortcut", () => {+ const resident = {+ ...GGUF,+ checkpoint: "unsloth/Qwen3-0.6B",+ isGguf: false,+ ggufVariant: null,+ isLora: true,+ };+ assert.equal(residentHasRunSettings(resident), true);+ assert.equal(+ residentMatchesMonitor(resident, {+ id: resident.checkpoint,+ ggufVariant: null,+ }),+ true,+ );+ assert.equal(runSettingsRequest(resident, "settings")?.meta.isLora, true);+ assert.equal(slotsSettingsRequest(resident, "slots"), null);+});++test("a GGUF resident opens its Run settings on Parallel Slots, as Chat's reload names it", () => {+ assert.deepEqual(slotsSettingsRequest(GGUF, "req-1"), {+ requestId: "req-1",+ id: "unsloth/Qwen3-4B-GGUF",+ focus: "parallelSlots",+ meta: {+ source: "local",+ isLora: false,+ loadId: null,+ ggufVariant: "UD-Q4_K_XL",+ nativePathToken: undefined,+ nativePathExpiresAtMs: null,+ isGguf: true,+ isDiffusion: false,+ isDownloaded: true,+ },+ });+});++test("models without a Parallel Slots field stay a plain readout", () => {+ assert.equal(residentHasSlotsSetting(null), false);+ assert.equal(slotsSettingsRequest(null, "req"), null);+ // Transformers, MLX and NPU loads: the monitor reports no llama-server slots for them.+ assert.equal(residentHasSlotsSetting({ ...GGUF, isGguf: false }), false);+ // The diffusion runner never receives --parallel.+ assert.equal(residentHasSlotsSetting({ ...GGUF, isDiffusion: true }), false);+});++test("a file-picked GGUF whose access expired cannot be reloaded, so it is not offered", () => {+ const picked = {+ ...GGUF,+ nativePathToken: "tok",+ nativePathExpiresAtMs: 1_000,+ };+ assert.equal(residentHasSlotsSetting(picked, 999), true);+ assert.equal(+ slotsSettingsRequest(picked, "req", 999)?.meta.nativePathToken,+ "tok",+ );+ assert.equal(residentHasSlotsSetting(picked, 1_000), false);+});++test("the readout is offered only when the picker takes the target for the monitor's model", () => {+ const monitor = { id: "unsloth/Qwen3-4B-GGUF", ggufVariant: "UD-Q4_K_XL" };+ assert.equal(residentMatchesMonitor(GGUF, monitor), true);+ // An API auto-switch to another quant of the same repo, before Chat's runtime catches up:+ // Run would reload the old quant.+ assert.equal(+ residentMatchesMonitor(GGUF, { ...monitor, ggufVariant: "Q8_0" }),+ false,+ );+ // A file-picked GGUF: Chat holds the path, the monitor its bare stem. The picker cannot tie+ // them, so Run settings would open on stored settings rather than the loaded ones.+ const picked = {+ ...GGUF,+ checkpoint: "/home/user/models/qwen3-4b-Q4_K_M.gguf",+ ggufVariant: "Q4_K_M",+ nativePathToken: "tok",+ nativePathExpiresAtMs: Number.MAX_SAFE_INTEGER,+ };+ assert.equal(+ residentMatchesMonitor(picked, {+ id: "qwen3-4b-Q4_K_M",+ ggufVariant: "Q4_K_M",+ }),+ false,+ );+ assert.equal(residentMatchesMonitor(null, monitor), false);+});