forked from React-Group/interstellar_ai
Compare commits
No commits in common. "f5a9f2e1f5c6bba958be1333712fdb674cef1fdc" and "dbcf1f7d0c4d1052e671b4928a816c3a6ebc2adb" have entirely different histories.
f5a9f2e1f5
...
dbcf1f7d0c
2 changed files with 139 additions and 215 deletions
|
@ -135,36 +135,8 @@ const modelList = {
|
||||||
Image: 'pixtral-12b-2409'
|
Image: 'pixtral-12b-2409'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// Define the keys of modelList
|
||||||
|
type ModelKeys = keyof typeof modelList;
|
||||||
// Define the available selectedAIFunction options
|
|
||||||
const modelDropdown = {
|
|
||||||
offlineNonFoss: ['Offline Fast', 'Offline Slow'],
|
|
||||||
offlineFoss: ['Offline Fast (FOSS)', 'Offline Slow (FOSS)'],
|
|
||||||
onlineNonFoss: [
|
|
||||||
'Online Cheap (OpenAI)',
|
|
||||||
'Online Expensive (OpenAI)',
|
|
||||||
'Online Cheap (Anthropic)',
|
|
||||||
'Online Expensive (Anthropic)',
|
|
||||||
'Online Cheap (Google)',
|
|
||||||
'Online Expensive (Google)',
|
|
||||||
'Online (La Plateforme)'
|
|
||||||
],
|
|
||||||
onlineFoss: ['Online (FOSS) (La Plateforme)'],
|
|
||||||
};
|
|
||||||
|
|
||||||
const selectedAIFunction = [
|
|
||||||
'Code',
|
|
||||||
'Math',
|
|
||||||
'Language',
|
|
||||||
'Character',
|
|
||||||
'Finance',
|
|
||||||
'Weather',
|
|
||||||
'Time',
|
|
||||||
'Image',
|
|
||||||
'Custom1',
|
|
||||||
'Custom2'
|
|
||||||
]
|
|
||||||
|
|
||||||
const ModelSection: React.FC = () => {
|
const ModelSection: React.FC = () => {
|
||||||
// Initialize state with value from localStorage or default to ''
|
// Initialize state with value from localStorage or default to ''
|
||||||
|
@ -172,7 +144,6 @@ const ModelSection: React.FC = () => {
|
||||||
const [radioSelection, setRadioSelection] = useState<string | null>("");
|
const [radioSelection, setRadioSelection] = useState<string | null>("");
|
||||||
const [activeSelectedAIFunction, setActiveSelectedAIFunction] = useState('');
|
const [activeSelectedAIFunction, setActiveSelectedAIFunction] = useState('');
|
||||||
const [currentSelectedAIFunction, setCurrentSelectedAIFunction] = useState<string | null>("");
|
const [currentSelectedAIFunction, setCurrentSelectedAIFunction] = useState<string | null>("");
|
||||||
const [isOpenSourceMode, setIsOpenSourceMode] = useState(localStorage.getItem('openSourceMode') || "false")
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Load initial values from localStorage
|
// Load initial values from localStorage
|
||||||
|
@ -218,60 +189,9 @@ const ModelSection: React.FC = () => {
|
||||||
localStorage.setItem('type', modelType);
|
localStorage.setItem('type', modelType);
|
||||||
};
|
};
|
||||||
|
|
||||||
// Determine the filtered models based on current radioSelection
|
const isOfflineModel = (model: string) => {
|
||||||
const filteredModels = (() => {
|
return modelList[model as ModelKeys].model_type === 'local';
|
||||||
let models = [];
|
};
|
||||||
switch (radioSelection) {
|
|
||||||
case 'Offline':
|
|
||||||
models = [
|
|
||||||
...modelDropdown.onlineNonFoss,
|
|
||||||
...modelDropdown.onlineFoss,
|
|
||||||
];
|
|
||||||
if (isOpenSourceMode == "true") {
|
|
||||||
models = [
|
|
||||||
...modelDropdown.onlineFoss,
|
|
||||||
];
|
|
||||||
} // Show only offline models without FOSS
|
|
||||||
break;
|
|
||||||
case 'Online':
|
|
||||||
models = [
|
|
||||||
...modelDropdown.offlineNonFoss,
|
|
||||||
...modelDropdown.offlineFoss,
|
|
||||||
];
|
|
||||||
if (isOpenSourceMode == "true") {
|
|
||||||
models = [
|
|
||||||
...modelDropdown.offlineFoss,
|
|
||||||
];
|
|
||||||
} // Show only online models without FOSS
|
|
||||||
break;
|
|
||||||
case 'None':
|
|
||||||
models = [
|
|
||||||
...modelDropdown.offlineNonFoss,
|
|
||||||
...modelDropdown.offlineFoss,
|
|
||||||
...modelDropdown.onlineNonFoss,
|
|
||||||
...modelDropdown.onlineFoss,
|
|
||||||
];
|
|
||||||
if (isOpenSourceMode == "true") {
|
|
||||||
models = [
|
|
||||||
...modelDropdown.offlineFoss,
|
|
||||||
...modelDropdown.onlineFoss,
|
|
||||||
];
|
|
||||||
} // Show all models if nothing matches
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
models = [
|
|
||||||
...modelDropdown.offlineNonFoss,
|
|
||||||
...modelDropdown.offlineFoss,
|
|
||||||
...modelDropdown.onlineNonFoss,
|
|
||||||
...modelDropdown.onlineFoss,
|
|
||||||
]; // Show all models if nothing matches
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
return Array.from(new Set(models)); // Remove duplicates using Set
|
|
||||||
})();
|
|
||||||
|
|
||||||
const isOfflineModel = (model: string) =>
|
|
||||||
modelDropdown.offlineNonFoss.includes(model) || modelDropdown.offlineFoss.includes(model);
|
|
||||||
|
|
||||||
const modelClicked = (model: string) => {
|
const modelClicked = (model: string) => {
|
||||||
const selectedAIFunction = currentSelectedAIFunction as keyof typeof modelList;
|
const selectedAIFunction = currentSelectedAIFunction as keyof typeof modelList;
|
||||||
|
|
|
@ -112,6 +112,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
|
||||||
const [closeButtonHoverColor, setCloseButtonHoverColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--close-button-hover-color').trim());
|
const [closeButtonHoverColor, setCloseButtonHoverColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--close-button-hover-color').trim());
|
||||||
const [applyButtonColor, setApplyButtonColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--apply-button-color').trim());
|
const [applyButtonColor, setApplyButtonColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--apply-button-color').trim());
|
||||||
const [applyButtonHoverColor, setApplyButtonHoverColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--apply-button-hover-color').trim());
|
const [applyButtonHoverColor, setApplyButtonHoverColor] = useState(() => getComputedStyle(document.documentElement).getPropertyValue('--apply-button-hover-color').trim());
|
||||||
|
|
||||||
// Per default a purple color gradient
|
// Per default a purple color gradient
|
||||||
const [primaryColor, setPrimaryColor] = useState(localStorage.getItem("primaryColor") || "#dc8add");
|
const [primaryColor, setPrimaryColor] = useState(localStorage.getItem("primaryColor") || "#dc8add");
|
||||||
const [secondaryColor, setSecondaryColor] = useState(localStorage.getItem("secondaryColor") || "#c061cb");
|
const [secondaryColor, setSecondaryColor] = useState(localStorage.getItem("secondaryColor") || "#c061cb");
|
||||||
|
@ -127,7 +128,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
|
||||||
const [openai, setOpenai] = useState(localStorage.getItem('openai') || "");
|
const [openai, setOpenai] = useState(localStorage.getItem('openai') || "");
|
||||||
const [anthropic, setAnthropic] = useState(localStorage.getItem('anthropic') || "");
|
const [anthropic, setAnthropic] = useState(localStorage.getItem('anthropic') || "");
|
||||||
const [google, setGoogle] = useState(localStorage.getItem('google') || "");
|
const [google, setGoogle] = useState(localStorage.getItem('google') || "");
|
||||||
const [myBoolean, setMyBoolean] = useState<boolean | any>(() => getItemFromLocalStorage('myBoolean'));
|
const [myBoolean, setMyBoolean] =useState<boolean | any>(() => getItemFromLocalStorage('myBoolean'));
|
||||||
|
|
||||||
const settings = {
|
const settings = {
|
||||||
userPreferences: {
|
userPreferences: {
|
||||||
|
@ -223,7 +224,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
|
||||||
{ name: "Apply Button Color", value: applyButtonColor, setValue: setApplyButtonColor, cssVariable: "--apply-button-color" },
|
{ name: "Apply Button Color", value: applyButtonColor, setValue: setApplyButtonColor, cssVariable: "--apply-button-color" },
|
||||||
{ name: "Apply Button Hover Color", value: applyButtonHoverColor, setValue: setApplyButtonHoverColor, cssVariable: "--apply-button-hover-color" },
|
{ name: "Apply Button Hover Color", value: applyButtonHoverColor, setValue: setApplyButtonHoverColor, cssVariable: "--apply-button-hover-color" },
|
||||||
{ name: "Burger Menu Background Color", value: burgerMenuBackgroundColor, setValue: setBurgerMenuBackgroundColor, cssVariable: "--burger-menu-background-color" },
|
{ name: "Burger Menu Background Color", value: burgerMenuBackgroundColor, setValue: setBurgerMenuBackgroundColor, cssVariable: "--burger-menu-background-color" },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
const timeZoneOptions = [
|
const timeZoneOptions = [
|
||||||
|
@ -337,13 +338,15 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const savedOption = localStorage.getItem('radioSelection');
|
const savedOption = localStorage.getItem('radioSelection');
|
||||||
if (savedOption) {
|
if (savedOption) {
|
||||||
savedOption.replace(" (FOSS)", "");
|
handleRadioChange(savedOption); // Set saved selection
|
||||||
setSelectedOption(savedOption); // Set saved selection
|
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleRadioChange = (newValue: string) => {
|
const handleRadioChange = (newValue: string) => {
|
||||||
setSelectedOption(newValue); // Update the state with the selected option
|
setSelectedOption(newValue); // Update the state with the selected option
|
||||||
|
if (openSourceMode) {
|
||||||
|
newValue += " (FOSS)"
|
||||||
|
}
|
||||||
localStorage.setItem('radioSelection', newValue); // Save the selection for persistence
|
localStorage.setItem('radioSelection', newValue); // Save the selection for persistence
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -577,13 +580,14 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
|
||||||
label="New Name"
|
label="New Name"
|
||||||
value={newName}
|
value={newName}
|
||||||
setValue={setNewName}
|
setValue={setNewName}
|
||||||
|
type="text"
|
||||||
placeholder={localStorage.getItem("accountName") || "Current Name"} // Show current name or a default
|
placeholder={localStorage.getItem("accountName") || "Current Name"} // Show current name or a default
|
||||||
/>
|
/>
|
||||||
<TextSettings
|
<TextSettings
|
||||||
label="New Email"
|
label="New Email"
|
||||||
value={newEmail}
|
value={newEmail}
|
||||||
setValue={setNewEmail}
|
setValue={setNewEmail}
|
||||||
type="email" // Input type is email
|
type="email"
|
||||||
placeholder={localStorage.getItem("accountEmail") || "Current Email"} // Show current email or a default
|
placeholder={localStorage.getItem("accountEmail") || "Current Email"} // Show current email or a default
|
||||||
/>
|
/>
|
||||||
<TextSettings
|
<TextSettings
|
||||||
|
|
Loading…
Reference in a new issue