diff --git a/app/components/Settings.tsx b/app/components/Settings.tsx index 7875724..e3e626b 100644 --- a/app/components/Settings.tsx +++ b/app/components/Settings.tsx @@ -15,6 +15,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( const [newName, setNewName] = useState(''); const [newEmail, setNewEmail] = useState(''); const [newPassword, setNewPassword] = useState(''); + const [preferredMessurement, setPreferredMessurement] = useState('Metric'); // Theme settings state const [backgroundColor, setBackgroundColor] = useState(getComputedStyle(document.documentElement).getPropertyValue('--background-color').trim()); @@ -37,9 +38,15 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( const [fontFamily, setFontFamily] = useState(getComputedStyle(document.documentElement).getPropertyValue('--font-family').trim()); const [fontSize, setFontSize] = useState(getComputedStyle(document.documentElement).getPropertyValue('--font-size').trim()); - // Theme selection - const [selectedTheme, setSelectedTheme] = useState('default'); + // Theme selection + const [selectedTheme, setSelectedTheme] = useState('default'); + // API Keys + const [laPlateforme, setLaPlateforme] = useState(getComputedStyle(document.documentElement).getPropertyValue('--online-la-plateforme').trim()); + const [openAI, setOpenAI] = useState(getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-openai').trim()); + const [anthropic, setAnthropic] = useState(getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-anthropic').trim()); + const [google, setGoogle] = useState(getComputedStyle(document.documentElement).getPropertyValue('--online-cheap-google').trim()); + // Apply imported settings to the CSS variables const applySettings = (settings: any) => { if (settings.backgroundColor) { @@ -147,85 +154,102 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( case 'general': return (
-

General Settings

-
- - -
-
- - -
-
- - -
-
- - -
-
- - -
+

General Settings

+ +
+ +
- ); + +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + {/* New Preferred Measurement Option */} +
+ + +
+
+ ); case 'privacy': return ( @@ -697,17 +721,55 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( ); + case 'api': + return ( +
+
+ + setLaPlateforme(e.target.value)} + /> +
+
+ + setOpenAI(e.target.value)} + /> +
+
+ + setAnthropic(e.target.value)} + /> +
+
+ + setGoogle(e.target.value)} + /> +
+
+ ); + case 'im/export': return (

Import & Export

Export the settings

- +

Import the settings

- +
); @@ -748,6 +810,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( fontSize, preferredLanguage, preferredCurrency, + preferredMessurement, dateFormat, timeFormat, timeZone, @@ -755,7 +818,14 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = ( disableChatHistory, disableAIMemory, openSourceMode, - }; + + // API Keys + laPlateforme, + openAI, + anthropic, + google +}; + return (
@@ -768,6 +838,7 @@ const Settings: React.FC<{ closeSettings: () => void; accountName: string }> = (
  • setActiveSection('theme')}>Theme
  • setActiveSection('foss')}>FOSS
  • setActiveSection('account')}>Account
  • +
  • setActiveSection('api')}>API Keys
  • setActiveSection('im/export')}>Import/Export
  • diff --git a/app/components/json/black.json b/app/components/json/black.json new file mode 100644 index 0000000..cc56d50 --- /dev/null +++ b/app/components/json/black.json @@ -0,0 +1 @@ +{"backgroundColor":"#8B9635","textColor":"#474D22","inputBackgroundColor":"#ffffff","inputButtonColor":"#8B9635","inputButtonHoverColor":"#6b7c2b","userMessageBackgroundColor":"#8B9635","userMessageTextColor":"#000","aiMessageBackgroundColor":"#FCFCEB","aiMessageTextColor":"#000","buttonBackgroundColor":"#8B9635","buttonHoverBackgroundColor":"#6b7c2b","modelsBackgroundColor":"#ffffff","historyBackgroundColor":"#f9f9f9","leftPanelBackgroundColor":"#79832e","conversationBackgroundColor":"#79832e","popUpTextColor":"#000","inputBorderColor":"#8B9635","fontFamily":"'Poppins', 'sans-serif'","fontSize":"16px","preferredLanguage":"en","preferredCurrency":"usd","dateFormat":"mm/dd/yyyy","timeFormat":"12-hour","timeZone":"GMT","disableOnlineAI":false,"disableChatHistory":false,"disableAIMemory":false,"openSourceMode":false,"laPlateforme":"","openAI":"","anthropic":"","google":""} \ No newline at end of file diff --git a/app/components/json/iomarket.json b/app/components/json/iomarket.json new file mode 100644 index 0000000..cc56d50 --- /dev/null +++ b/app/components/json/iomarket.json @@ -0,0 +1 @@ +{"backgroundColor":"#8B9635","textColor":"#474D22","inputBackgroundColor":"#ffffff","inputButtonColor":"#8B9635","inputButtonHoverColor":"#6b7c2b","userMessageBackgroundColor":"#8B9635","userMessageTextColor":"#000","aiMessageBackgroundColor":"#FCFCEB","aiMessageTextColor":"#000","buttonBackgroundColor":"#8B9635","buttonHoverBackgroundColor":"#6b7c2b","modelsBackgroundColor":"#ffffff","historyBackgroundColor":"#f9f9f9","leftPanelBackgroundColor":"#79832e","conversationBackgroundColor":"#79832e","popUpTextColor":"#000","inputBorderColor":"#8B9635","fontFamily":"'Poppins', 'sans-serif'","fontSize":"16px","preferredLanguage":"en","preferredCurrency":"usd","dateFormat":"mm/dd/yyyy","timeFormat":"12-hour","timeZone":"GMT","disableOnlineAI":false,"disableChatHistory":false,"disableAIMemory":false,"openSourceMode":false,"laPlateforme":"","openAI":"","anthropic":"","google":""} \ No newline at end of file diff --git a/app/components/json/white.json b/app/components/json/white.json new file mode 100644 index 0000000..cc56d50 --- /dev/null +++ b/app/components/json/white.json @@ -0,0 +1 @@ +{"backgroundColor":"#8B9635","textColor":"#474D22","inputBackgroundColor":"#ffffff","inputButtonColor":"#8B9635","inputButtonHoverColor":"#6b7c2b","userMessageBackgroundColor":"#8B9635","userMessageTextColor":"#000","aiMessageBackgroundColor":"#FCFCEB","aiMessageTextColor":"#000","buttonBackgroundColor":"#8B9635","buttonHoverBackgroundColor":"#6b7c2b","modelsBackgroundColor":"#ffffff","historyBackgroundColor":"#f9f9f9","leftPanelBackgroundColor":"#79832e","conversationBackgroundColor":"#79832e","popUpTextColor":"#000","inputBorderColor":"#8B9635","fontFamily":"'Poppins', 'sans-serif'","fontSize":"16px","preferredLanguage":"en","preferredCurrency":"usd","dateFormat":"mm/dd/yyyy","timeFormat":"12-hour","timeZone":"GMT","disableOnlineAI":false,"disableChatHistory":false,"disableAIMemory":false,"openSourceMode":false,"laPlateforme":"","openAI":"","anthropic":"","google":""} \ No newline at end of file diff --git a/app/styles/Settings.css b/app/styles/Settings.css index bf88759..a2224a4 100644 --- a/app/styles/Settings.css +++ b/app/styles/Settings.css @@ -147,3 +147,16 @@ display: block; font-weight: bold; } + +.export-button{ + background-color: var(--button-hover-background-color); + padding: 10px; + margin: 10px; + border-radius: 10px; +} + +.import-file{ + background-color: var(--button-hover-background-color); + padding: 10px; + margin: 10px; +} \ No newline at end of file diff --git a/py/api.py b/py/api.py index d90429b..f328a7d 100644 --- a/py/api.py +++ b/py/api.py @@ -1,4 +1,4 @@ -from flask import Flask, request, jsonify + from flask import Flask, request, jsonify from flask_cors import CORS import secrets import threading