From c3abba84623156659efbc811dfbb3f57e4465788 Mon Sep 17 00:00:00 2001 From: ItzCrazyKns <95534749+ItzCrazyKns@users.noreply.github.com> Date: Wed, 29 Oct 2025 23:13:51 +0530 Subject: [PATCH] feat(settings): separate personalization & preferences --- .../Settings/Sections/Personalization.tsx | 29 +++++++++++++++ .../Sections/{General.tsx => Preferences.tsx} | 6 ++-- src/components/Settings/SettingsDialogue.tsx | 26 +++++++++----- src/lib/config/index.ts | 36 ++++++++++++------- src/lib/config/types.ts | 9 +++-- 5 files changed, 81 insertions(+), 25 deletions(-) create mode 100644 src/components/Settings/Sections/Personalization.tsx rename src/components/Settings/Sections/{General.tsx => Preferences.tsx} (87%) diff --git a/src/components/Settings/Sections/Personalization.tsx b/src/components/Settings/Sections/Personalization.tsx new file mode 100644 index 0000000..c0f0ede --- /dev/null +++ b/src/components/Settings/Sections/Personalization.tsx @@ -0,0 +1,29 @@ +import { UIConfigField } from '@/lib/config/types'; +import SettingsField from '../SettingsField'; + +const Personalization = ({ + fields, + values, +}: { + fields: UIConfigField[]; + values: Record; +}) => { + return ( +
+ {fields.map((field) => ( + + ))} +
+ ); +}; + +export default Personalization; diff --git a/src/components/Settings/Sections/General.tsx b/src/components/Settings/Sections/Preferences.tsx similarity index 87% rename from src/components/Settings/Sections/General.tsx rename to src/components/Settings/Sections/Preferences.tsx index 18b77bc..e14f763 100644 --- a/src/components/Settings/Sections/General.tsx +++ b/src/components/Settings/Sections/Preferences.tsx @@ -1,7 +1,7 @@ import { UIConfigField } from '@/lib/config/types'; import SettingsField from '../SettingsField'; -const General = ({ +const Preferences = ({ fields, values, }: { @@ -19,11 +19,11 @@ const General = ({ ? localStorage.getItem(field.key) : values[field.key]) ?? field.default } - dataAdd="general" + dataAdd="preferences" /> ))} ); }; -export default General; +export default Preferences; diff --git a/src/components/Settings/SettingsDialogue.tsx b/src/components/Settings/SettingsDialogue.tsx index a799bd3..eb0335f 100644 --- a/src/components/Settings/SettingsDialogue.tsx +++ b/src/components/Settings/SettingsDialogue.tsx @@ -4,9 +4,10 @@ import { BrainCog, ChevronLeft, Search, - Settings, + Sliders, + ToggleRight, } from 'lucide-react'; -import General from './Sections/General'; +import Preferences from './Sections/Preferences'; import { motion } from 'framer-motion'; import { useEffect, useState } from 'react'; import { toast } from 'sonner'; @@ -15,15 +16,24 @@ import { cn } from '@/lib/utils'; import Models from './Sections/Models/Section'; import SearchSection from './Sections/Search'; import Select from '@/components/ui/Select'; +import Personalization from './Sections/Personalization'; const sections = [ { - key: 'general', - name: 'General', - description: 'Adjust common settings.', - icon: Settings, - component: General, - dataAdd: 'general', + key: 'preferences', + name: 'Preferences', + description: 'Customize your application preferences.', + icon: Sliders, + component: Preferences, + dataAdd: 'preferences', + }, + { + key: 'personalization', + name: 'Personalization', + description: 'Customize the behavior and tone of the model.', + icon: ToggleRight, + component: Personalization, + dataAdd: 'personalization', }, { key: 'models', diff --git a/src/lib/config/index.ts b/src/lib/config/index.ts index 0487a11..9b69c8a 100644 --- a/src/lib/config/index.ts +++ b/src/lib/config/index.ts @@ -13,14 +13,15 @@ class ConfigManager { currentConfig: Config = { version: this.configVersion, setupComplete: false, - general: {}, + preferences: {}, + personalization: {}, modelProviders: [], search: { searxngURL: '', }, }; uiConfigSections: UIConfigSections = { - general: [ + preferences: [ { name: 'Theme', key: 'theme', @@ -40,16 +41,6 @@ class ConfigManager { default: 'dark', scope: 'client', }, - { - name: 'System Instructions', - key: 'systemInstructions', - type: 'textarea', - required: false, - description: 'Add custom behavior or tone for the model.', - placeholder: - 'e.g., "Respond in a friendly and concise tone" or "Use British English and format answers as bullet points."', - scope: 'client', - }, { name: 'Measurement Unit', key: 'measureUnit', @@ -69,6 +60,27 @@ class ConfigManager { default: 'Metric', scope: 'client', }, + { + name: 'Auto video & image search', + key: 'autoMediaSearch', + type: 'switch', + required: false, + description: 'Automatically search for relevant images and videos.', + default: true, + scope: 'client', + }, + ], + personalization: [ + { + name: 'System Instructions', + key: 'systemInstructions', + type: 'textarea', + required: false, + description: 'Add custom behavior or tone for the model.', + placeholder: + 'e.g., "Respond in a friendly and concise tone" or "Use British English and format answers as bullet points."', + scope: 'client', + }, ], modelProviders: [], search: [ diff --git a/src/lib/config/types.ts b/src/lib/config/types.ts index 484d676..6eaa70c 100644 --- a/src/lib/config/types.ts +++ b/src/lib/config/types.ts @@ -63,7 +63,10 @@ type ConfigModelProvider = { type Config = { version: number; setupComplete: boolean; - general: { + preferences: { + [key: string]: any; + }; + personalization: { [key: string]: any; }; modelProviders: ConfigModelProvider[]; @@ -86,7 +89,8 @@ type ModelProviderUISection = { }; type UIConfigSections = { - general: UIConfigField[]; + preferences: UIConfigField[]; + personalization: UIConfigField[]; modelProviders: ModelProviderUISection[]; search: UIConfigField[]; }; @@ -101,4 +105,5 @@ export type { ModelProviderUISection, ConfigModelProvider, TextareaUIConfigField, + SwitchUIConfigField, };