Co-authored-by: Reifonas <211114984+Reifonas@users.noreply.github.com>
This commit is contained in:
gpt-engineer-app[bot]
2026-05-24 19:34:13 +00:00
parent 3b42d44ff7
commit cbfeee3078
+15 -4
View File
@@ -418,8 +418,11 @@ export const useModelStore = create<ModelStore>((set, get) => ({
fineTuning: { ...defaultFineTuning },
setFineTuning: (ft) => set((state) => {
const newFT = { ...state.fineTuning, ...ft };
const activeId = state.activeModelId;
const activeBefore = state.models.find(m => m.id === activeId);
// Lock guard: when the active model is locked, ignore any movement/scale change.
if (activeBefore?.locked) return {};
const newFT = { ...state.fineTuning, ...ft };
const models = activeId
? state.models.map(m => m.id === activeId ? { ...m, fineTuning: newFT } : m)
: state.models;
@@ -429,8 +432,10 @@ export const useModelStore = create<ModelStore>((set, get) => ({
return { fineTuning: newFT, models };
}),
resetFineTuning: () => set((state) => {
const reset = { ...defaultFineTuning };
const activeId = state.activeModelId;
const activeBefore = state.models.find(m => m.id === activeId);
if (activeBefore?.locked) return {};
const reset = { ...defaultFineTuning };
const models = activeId
? state.models.map(m => m.id === activeId ? { ...m, fineTuning: reset } : m)
: state.models;
@@ -449,11 +454,17 @@ export const useModelStore = create<ModelStore>((set, get) => ({
setXrSupported: (xrSupported) => set({ xrSupported }),
scaleRatio: SCALE_PRESETS.find(p => p.label === '1:1')!,
setScaleRatio: (scaleRatio) => set({ scaleRatio }),
setScaleRatio: (scaleRatio) => set((state) => {
const activeBefore = state.models.find(m => m.id === state.activeModelId);
if (activeBefore?.locked) return {};
return { scaleRatio };
}),
scaleResetNonce: 0,
resetScale: () => set((state) => {
const oneToOne = SCALE_PRESETS.find(p => p.label === '1:1')!;
const activeId = state.activeModelId;
const activeBefore = state.models.find(m => m.id === activeId);
if (activeBefore?.locked) return {};
const oneToOne = SCALE_PRESETS.find(p => p.label === '1:1')!;
const models = activeId
? state.models.map(m => m.id === activeId
? { ...m, fineTuning: { ...m.fineTuning, scale: 1 } }