import React, { useState, useEffect } from 'react'; // Define the available model options const offlineModels = [ 'Offline Fast', 'Offline Fast (FOSS)', 'Offline Slow', 'Offline Slow (FOSS)', ]; const 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)', ]; const fossModels = [ 'Offline Fast (FOSS)', 'Offline Slow (FOSS)', 'Online (FOSS) (La Plateforme)', ]; // Define the properties passed to the Models component interface ModelsProps { selectedOption: string; // Privacy setting: "Offline", "AI Online", "None" } const Models: React.FC = ({ selectedOption }) => { const [selectedModel, setSelectedModel] = useState(() => { return localStorage.getItem('selectedModel') || 'Offline Fast'; }); const handleModelChange = (event: React.ChangeEvent) => { const newModel = event.target.value; setSelectedModel(newModel); }; const isOfflineModel = (model: string) => offlineModels.includes(model); const isOnlineModel = (model: string) => onlineModels.includes(model); const isFossModel = (model: string) => fossModels.includes(model); useEffect(() => { localStorage.setItem('selectedModel', selectedModel); }, [selectedModel]); const filteredModels = (() => { switch (selectedOption) { case 'Offline': return offlineModels; // Show only offline models case 'AI Online': return onlineModels; // Show only online models default: return [...offlineModels, ...onlineModels]; // Show all models } })(); return (

Different AI models

{/* Model Selection Dropdown */}
{/* Model Grid with Cards */}
); }; export default Models;