Studio: also persist external checkpoint when picker calls setParams (#5700)

The first pass only wired the localStorage mirror into `setCheckpoint`,
but the main chat-page picker actually selects an external model by
calling `setParams({ ...store.params, checkpoint: value })`. That path
never hit `setCheckpoint`, so the persisted slot stayed empty and a
refresh fell back to whatever `/api/inference/status.active_model`
returned -- the previously loaded local model (Qwen3.5 etc) or null
("Select model") when nothing was loaded locally.

Mirror the persistence in `setParams` whenever the checkpoint changes
so every entry point converges on the same behavior. `setCheckpoint`
still does it directly so the load path (compare, GGUF auto-load,
gemma fallback in chat-adapter) keeps working.
This commit is contained in:
Daniel Han 2026-05-22 07:06:49 -07:00 committed by GitHub
commit 9d3ad3ba12
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -627,6 +627,17 @@ export const useChatRuntimeStore = create<ChatRuntimeStore>((set, get) => ({
if (state.settingsHydrated && hasKeys(changedParams)) {
saveSettingsPatch({ inferenceParams: changedParams });
}
// chat-page picks an external model by mutating `params.checkpoint`
// through this setter (not through `setCheckpoint`), so the
// localStorage mirror needs to be refreshed here too. Otherwise
// the persisted slot stays empty and a refresh falls back to
// whatever the backend's `/api/inference/status.active_model`
// returns -- usually the previously loaded local model.
if (params.checkpoint !== state.params.checkpoint) {
saveLastExternalCheckpoint(
isExternalModelId(params.checkpoint) ? params.checkpoint : null,
);
}
return { params };
}),
setCustomPresets: (customPresets) =>