diff --git a/app/components/Login.tsx b/app/components/Login.tsx
index ade180b..665a7b3 100644
--- a/app/components/Login.tsx
+++ b/app/components/Login.tsx
@@ -47,10 +47,13 @@ const Login: React.FC = () => {
const savedAccountPassword = localStorage.getItem('accountPassword');
const savedAccountName = localStorage.getItem('accountName');
- if ((email === savedAccountEmail || accountName === savedAccountName) && password === savedAccountPassword) {
+ if (
+ (email === savedAccountEmail || accountName === savedAccountName) &&
+ password === savedAccountPassword
+ ) {
setIsLoggedIn(true); // Successful login
setShowLoginPopup(false); // Close the login popup
- // Save credentials to localStorage
+ // Save credentials to localStorage (optional in case of changes)
localStorage.setItem('accountName', savedAccountName || accountName);
localStorage.setItem('accountEmail', savedAccountEmail || email);
localStorage.setItem('accountPassword', savedAccountPassword || password);
@@ -75,7 +78,7 @@ const Login: React.FC = () => {
{/* Login or Settings Button */}
{/* Conditional rendering of the Login Popup */}
@@ -94,8 +97,12 @@ const Login: React.FC = () => {
setEmail(e.target.value)}
+ value={email || accountName} // Display whichever is set
+ onChange={(e) => {
+ const input = e.target.value;
+ setEmail(input); // Update both email and accountName states
+ setAccountName(input);
+ }}
/>
@@ -178,7 +185,7 @@ const Login: React.FC = () => {
)}
{/* Conditional rendering of the Settings Popup */}
- {showSettingsPopup && }
+ {showSettingsPopup && }
);
};
diff --git a/app/components/Models.tsx b/app/components/Models.tsx
index 4a1fb90..cf84932 100644
--- a/app/components/Models.tsx
+++ b/app/components/Models.tsx
@@ -30,12 +30,12 @@ const modelDropdown = {
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()
+ handleStorageChange();
// Update dropdown immediately when localStorage changes internally or externally
window.addEventListener('storage', handleStorageChange);
@@ -54,52 +54,58 @@ const Models: React.FC = () => {
// Determine the filtered models based on current radioSelection
const filteredModels = (() => {
+ let models = [];
switch (radioSelection) {
case 'Offline':
- return modelDropdown.offlineModels; // Show only offline models
+ models = modelDropdown.offlineModels; // Show only offline models
+ break;
case 'AI Online':
- return modelDropdown.onlineModels; // Show only online models
+ models = modelDropdown.onlineModels; // Show only online models
+ break;
case 'FOSS':
- return modelDropdown.fossModels; // Show only FOSS models
+ models = modelDropdown.fossModels; // Show only FOSS models
+ break;
default:
- return [...modelDropdown.offlineModels, ...modelDropdown.onlineModels, ...modelDropdown.fossModels]; // Show all models if nothing matches
+ 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
-
+
+
+
Different AI Models
+
- {/* Model Selection Dropdown */}
-
-
-
-
);
};
diff --git a/app/layout.tsx b/app/layout.tsx
index 8070a08..0425420 100644
--- a/app/layout.tsx
+++ b/app/layout.tsx
@@ -12,7 +12,7 @@ export default function RootLayout({ children }: { children: ReactNode }) {
{metadata.title}
{/* Tried adding the favicon here */}
-
+
{children}