From f7dc957c3ac2902fa17b6427465d017562f669e2 Mon Sep 17 00:00:00 2001 From: sageTheDM Date: Wed, 2 Oct 2024 08:24:01 +0200 Subject: [PATCH] Minor model changes --- app/components/Models.tsx | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/app/components/Models.tsx b/app/components/Models.tsx index dee935e..74f096e 100644 --- a/app/components/Models.tsx +++ b/app/components/Models.tsx @@ -174,9 +174,18 @@ const Models: React.FC = () => { const [currentCategory, setCurrentCategory] = useState(localStorage.getItem("activeCategory")); useEffect(() => { - // Retrieve initial values from localStorage - setRadioSelection(localStorage.getItem('radioSelection') || ''); - setSelectedModel(localStorage.getItem('selectedModel') || ''); + if (!localStorage.getItem('selectedModel')) { + localStorage.setItem("selectedModel", "Offline Fast" ) + } + + if (!localStorage.getItem("activeCategory")) { + setActiveCategory('Code') + localStorage.setItem('activeCategory' ,'Code') + } + + if (!localStorage.getItem("model")) { + localStorage.setItem("model" ,'starcoder2') + } const handleStorageChange = () => { setSelectedModel(localStorage.getItem('selectedModel') || ''); @@ -185,6 +194,8 @@ const Models: React.FC = () => { // Update immediately when localStorage changes window.addEventListener('storage', handleStorageChange); + setRadioSelection(localStorage.getItem('radioSelection') || ''); + setSelectedModel(localStorage.getItem('selectedModel') || ''); // Cleanup listener on component unmount return () => { window.removeEventListener('storage', handleStorageChange);