diff --git a/app/components/Models.tsx b/app/components/Models.tsx index f151777..7647753 100644 --- a/app/components/Models.tsx +++ b/app/components/Models.tsx @@ -1,23 +1,37 @@ import React, { useState, useEffect } from 'react'; -const Models: React.FC = () => { - const modelOptions = [ - 'Offline Fast', - 'Offline Fast (FOSS)', - 'Offline Slow', - 'Offline Slow (FOSS)', - '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)', - ]; +// 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(() => { - // Load the selected model from localStorage on initial render return localStorage.getItem('selectedModel') || 'Offline Fast'; }); @@ -26,31 +40,45 @@ const Models: React.FC = () => { setSelectedModel(newModel); }; - const isOfflineModel = (model: string) => { - return model.includes('Offline'); - }; + const isOfflineModel = (model: string) => offlineModels.includes(model); + const isOnlineModel = (model: string) => onlineModels.includes(model); + const isFossModel = (model: string) => fossModels.includes(model); - // Save selected model to localStorage whenever it changes 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

+
+

Different AI models

+ + {/* Model Selection Dropdown */}
+ + {/* Model Grid with Cards */}