import React, { useState, useEffect } from 'react'; // Define the available model options const modelDropdown = { offlineModels: [ 'Offline Fast', 'Offline Fast (FOSS)', 'Offline Slow', 'Offline Slow (FOSS)', ], onlineModels: [ 'Online (La Plateforme)', 'Online (FOSS) (La Plateforme)', 'Online Cheap (OpenAI)', 'Online Expensive (OpenAI)', 'Online Cheap (Anthropic)', 'Online Expensive (Anthropic)', 'Online Cheap (Google)', 'Online Expensive (Google)', ], fossModels: [ 'Offline Fast (FOSS)', 'Offline Slow (FOSS)', 'Online (FOSS) (La Plateforme)', ], }; const Models: React.FC = () => { // Initialize state with value from localStorage or default to '' const [radioSelection, setRadioSelection] = useState(''); useEffect(() => { const handleStorageChange = () => { setRadioSelection(localStorage.getItem('radioSelection') || ''); }; handleStorageChange(); // Update dropdown immediately when localStorage changes internally or externally window.addEventListener('storage', handleStorageChange); // Cleanup listener on component unmount return () => { window.removeEventListener('storage', handleStorageChange); }; }, []); const handleModelChange = (event: React.ChangeEvent) => { const newModel = event.target.value; setRadioSelection(newModel); localStorage.setItem('radioSelection', newModel); // Update localStorage directly }; // Determine the filtered models based on current radioSelection const filteredModels = (() => { let models = []; switch (radioSelection) { case 'Offline': models = modelDropdown.offlineModels; // Show only offline models break; case 'AI Online': models = modelDropdown.onlineModels; // Show only online models break; case 'FOSS': models = modelDropdown.fossModels; // Show only FOSS models break; default: models = [...modelDropdown.offlineModels, ...modelDropdown.onlineModels, ...modelDropdown.fossModels]; // Show all models if nothing matches break; } return Array.from(new Set(models)); // Remove duplicates using Set })(); const isOfflineModel = (model: string) => modelDropdown.offlineModels.includes(model); return (

Different AI Models

{/* Model Selection Dropdown */}
{/* Model Grid with Cards */}
{['Code', 'Math', 'Language', 'Character', 'Finance', 'Weather', 'Time', 'Image', 'Custom1', 'Custom2'].map((category) => ( ))}
); }; export default Models;