@@ -7,7 +7,7 @@ import { TTLCache } from '$lib/utils';
77import {
88 MODEL_PROPS_CACHE_TTL_MS ,
99 MODEL_PROPS_CACHE_MAX_ENTRIES ,
10- FAVOURITE_MODELS_LOCALSTORAGE_KEY
10+ FAVORITE_MODELS_LOCALSTORAGE_KEY
1111} from '$lib/constants' ;
1212
1313/**
@@ -57,7 +57,7 @@ class ModelsStore {
5757 private modelUsage = $state < Map < string , SvelteSet < string > > > ( new Map ( ) ) ;
5858 private modelLoadingStates = new SvelteMap < string , boolean > ( ) ;
5959
60- favouriteModelIds = $state < Set < string > > ( this . loadFavouritesFromStorage ( ) ) ;
60+ favoriteModelIds = $state < Set < string > > ( this . loadFavoritesFromStorage ( ) ) ;
6161
6262 /**
6363 * Model-specific props cache with TTL
@@ -90,7 +90,11 @@ class ModelsStore {
9090
9191 get loadedModelIds ( ) : string [ ] {
9292 return this . routerModels
93- . filter ( ( m ) => m . status . value === ServerModelStatus . LOADED )
93+ . filter (
94+ ( m ) =>
95+ m . status . value === ServerModelStatus . LOADED ||
96+ m . status . value === ServerModelStatus . SLEEPING
97+ )
9498 . map ( ( m ) => m . id ) ;
9599 }
96100
@@ -215,7 +219,11 @@ class ModelsStore {
215219
216220 isModelLoaded ( modelId : string ) : boolean {
217221 const model = this . routerModels . find ( ( m ) => m . id === modelId ) ;
218- return model ?. status . value === ServerModelStatus . LOADED || false ;
222+ return (
223+ model ?. status . value === ServerModelStatus . LOADED ||
224+ model ?. status . value === ServerModelStatus . SLEEPING ||
225+ false
226+ ) ;
219227 }
220228
221229 isModelOperationInProgress ( modelId : string ) : boolean {
@@ -621,40 +629,40 @@ class ModelsStore {
621629 /**
622630 *
623631 *
624- * Favourites
632+ * Favorites
625633 *
626634 *
627635 */
628636
629- isFavourite ( modelId : string ) : boolean {
630- return this . favouriteModelIds . has ( modelId ) ;
637+ isFavorite ( modelId : string ) : boolean {
638+ return this . favoriteModelIds . has ( modelId ) ;
631639 }
632640
633- toggleFavourite ( modelId : string ) : void {
634- const next = new SvelteSet ( this . favouriteModelIds ) ;
641+ toggleFavorite ( modelId : string ) : void {
642+ const next = new SvelteSet ( this . favoriteModelIds ) ;
635643
636644 if ( next . has ( modelId ) ) {
637645 next . delete ( modelId ) ;
638646 } else {
639647 next . add ( modelId ) ;
640648 }
641649
642- this . favouriteModelIds = next ;
650+ this . favoriteModelIds = next ;
643651
644652 try {
645- localStorage . setItem ( FAVOURITE_MODELS_LOCALSTORAGE_KEY , JSON . stringify ( [ ...next ] ) ) ;
653+ localStorage . setItem ( FAVORITE_MODELS_LOCALSTORAGE_KEY , JSON . stringify ( [ ...next ] ) ) ;
646654 } catch {
647- toast . error ( 'Failed to save favourite models to local storage' ) ;
655+ toast . error ( 'Failed to save favorite models to local storage' ) ;
648656 }
649657 }
650658
651- private loadFavouritesFromStorage ( ) : Set < string > {
659+ private loadFavoritesFromStorage ( ) : Set < string > {
652660 try {
653- const raw = localStorage . getItem ( FAVOURITE_MODELS_LOCALSTORAGE_KEY ) ;
661+ const raw = localStorage . getItem ( FAVORITE_MODELS_LOCALSTORAGE_KEY ) ;
654662
655663 return raw ? new Set ( JSON . parse ( raw ) as string [ ] ) : new Set ( ) ;
656664 } catch {
657- toast . error ( 'Failed to load favourite models from local storage' ) ;
665+ toast . error ( 'Failed to load favorite models from local storage' ) ;
658666
659667 return new Set ( ) ;
660668 }
@@ -713,4 +721,4 @@ export const loadingModelIds = () => modelsStore.loadingModelIds;
713721export const propsCacheVersion = ( ) => modelsStore . propsCacheVersion ;
714722export const singleModelName = ( ) => modelsStore . singleModelName ;
715723export const selectedModelContextSize = ( ) => modelsStore . selectedModelContextSize ;
716- export const favouriteModelIds = ( ) => modelsStore . favouriteModelIds ;
724+ export const favoriteModelIds = ( ) => modelsStore . favoriteModelIds ;
0 commit comments