Fix S3 tab flashing on reload (#7106)

* persist vision/audio model flags to fix S3 tab flash on reload

* persist modelType and reset capability flags on model switch
This commit is contained in:
Nilay 2026-07-14 19:17:24 +05:30 committed by GitHub
commit bb80602174
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -115,11 +115,11 @@ let _yamlLearningRate: number | undefined = undefined;
let _datasetFormatBeforeCpt: DatasetFormat | null = null;
let _datasetFormatAutoForcedByCpt = false;
// modelType / isVisionModel / isAudioModel persist so multimodal-only UI
// paints right on reload; the model-config fetch still re-derives them.
const NON_PERSISTED_STATE_KEYS: ReadonlySet<keyof TrainingConfigState> = new Set([
"modelType",
"isCheckingVision",
"isEmbeddingModel",
"isAudioModel",
"isLoadingModelDefaults",
"modelDefaultsError",
"modelDefaultsAppliedFor",
@ -128,7 +128,6 @@ const NON_PERSISTED_STATE_KEYS: ReadonlySet<keyof TrainingConfigState> = new Set
"isDatasetAudio",
"trainOnCompletions",
"maxPositionEmbeddings",
"isVisionModel",
"s3Config",
]);
@ -570,6 +569,9 @@ export const useTrainingConfigStore = create<TrainingConfigStore>()(
visionImageSize?: number | null;
trustRemoteCode?: boolean;
approvedRemoteCodeFingerprint?: string | null;
isVisionModel?: boolean;
isAudioModel?: boolean;
isEmbeddingModel?: boolean;
} = {
selectedModel,
modelDefaultsError: null,
@ -581,6 +583,11 @@ export const useTrainingConfigStore = create<TrainingConfigStore>()(
// re-applied below, and a custom-code model re-opens the dialog before start.
patch.trustRemoteCode = false;
patch.approvedRemoteCodeFingerprint = null;
// Reset capability flags so a mid-fetch reload can't persist the
// previous model's vision/audio flags against the new model.
patch.isVisionModel = false;
patch.isAudioModel = false;
patch.isEmbeddingModel = false;
}
set(patch);