Files
open-gsio/packages/client/src/stores/ModelStore.ts
geoffsee 3d16bd94b4 **Refactor imports and improve type annotations**
- Adjusted import statements across the codebase to align with consistent use of `type`.
- Unified usage of `EventSource` initialization.
- Introduced `RootDeps` type for shared dependencies.
- Commented out unused VitePWA configuration.
- Updated proxy target URLs in Vite configuration.
2025-06-18 12:34:16 -04:00

36 lines
1.1 KiB
TypeScript

// ---------------------------
// stores/ModelStore.ts
// ---------------------------
import { type Instance, types } from "mobx-state-tree";
export const ModelStore = types
.model("ModelStore", {
model: types.optional(
types.string,
"meta-llama/llama-4-scout-17b-16e-instruct",
),
imageModel: types.optional(types.string, "black-forest-labs/flux-1.1-pro"),
supportedModels: types.optional(types.array(types.string), []),
})
.actions((self) => ({
setModel(value: string) {
self.model = value;
try {
localStorage.setItem("recentModel", value);
} catch (_) {}
},
setImageModel(value: string) {
self.imageModel = value;
},
setSupportedModels(list: string[]) {
self.supportedModels = list;
if (!list.includes(self.model)) {
// fall back to last entry (arbitrary but predictable)
self.model = list[list.length - 1] ?? self.model;
}
},
}));
export interface IModelStore extends Instance<typeof ModelStore> {}