diff --git a/studio/frontend/src/features/chat/stores/chat-runtime-store.ts b/studio/frontend/src/features/chat/stores/chat-runtime-store.ts index 287dd1fa8b..1f7442ccd2 100644 --- a/studio/frontend/src/features/chat/stores/chat-runtime-store.ts +++ b/studio/frontend/src/features/chat/stores/chat-runtime-store.ts @@ -627,6 +627,17 @@ export const useChatRuntimeStore = create((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) =>