LibreChat/client/src/store/settings.ts
Marco Beretta 96581d56df
🖼️ style: Conversation Menu and Dialogs update (#3601)
* feat: new dropdown

* fix: maintain popover active when open

* fix: update DeleteButton and ShareButton component to use useState for managing dialog state

* BREAKING: style improvement of base Button component

* style: update export button

* a11y: ExportAndShareButton

* add border

* quick style fix

* fix: flick issue on convo

* fix: DropDown opens when renaming

* chore: update radix-ui/react-dropdown-menu to latest

* small fix

* style: bookmarks update

* reorder export modal

* feat: imporved dropdowns

* style: a lot of changes; header, bookmarks, export, nav, convo, convoOptions

* fix: small style issues

* fix: button

* fix: bookmarks header menu

* fix: dropdown close glitch

* feat: Improve accessibility and keyboard navigation in ModelSpec component

* fix: Nav related type issues

* style: ConvoOptions theming and focus ring

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
2024-08-16 04:30:14 -04:00

70 lines
3.1 KiB
TypeScript

import { atom } from 'recoil';
import { SettingsViews } from 'librechat-data-provider';
import { atomWithLocalStorage } from '~/store/utils';
import type { TOptionSettings } from '~/common';
// Static atoms without localStorage
const staticAtoms = {
abortScroll: atom<boolean>({ key: 'abortScroll', default: false }),
showFiles: atom<boolean>({ key: 'showFiles', default: false }),
optionSettings: atom<TOptionSettings>({ key: 'optionSettings', default: {} }),
showPluginStoreDialog: atom<boolean>({ key: 'showPluginStoreDialog', default: false }),
showAgentSettings: atom<boolean>({ key: 'showAgentSettings', default: false }),
currentSettingsView: atom<SettingsViews>({
key: 'currentSettingsView',
default: SettingsViews.default,
}),
showBingToneSetting: atom<boolean>({ key: 'showBingToneSetting', default: false }),
showPopover: atom<boolean>({ key: 'showPopover', default: false }),
};
const localStorageAtoms = {
// General settings
autoScroll: atomWithLocalStorage('autoScroll', false),
hideSidePanel: atomWithLocalStorage('hideSidePanel', false),
fontSize: atomWithLocalStorage('fontSize', 'text-base'),
// Messages settings
enterToSend: atomWithLocalStorage('enterToSend', true),
chatDirection: atomWithLocalStorage('chatDirection', 'LTR'),
showCode: atomWithLocalStorage('showCode', false),
saveDrafts: atomWithLocalStorage('saveDrafts', true),
forkSetting: atomWithLocalStorage('forkSetting', ''),
splitAtTarget: atomWithLocalStorage('splitAtTarget', false),
rememberForkOption: atomWithLocalStorage('rememberForkOption', true),
// Beta features settings
modularChat: atomWithLocalStorage('modularChat', true),
LaTeXParsing: atomWithLocalStorage('LaTeXParsing', true),
// Commands settings
atCommand: atomWithLocalStorage('atCommand', true),
plusCommand: atomWithLocalStorage('plusCommand', true),
slashCommand: atomWithLocalStorage('slashCommand', true),
// Speech settings
conversationMode: atomWithLocalStorage('conversationMode', false),
advancedMode: atomWithLocalStorage('advancedMode', false),
speechToText: atomWithLocalStorage('speechToText', true),
engineSTT: atomWithLocalStorage('engineSTT', 'browser'),
languageSTT: atomWithLocalStorage('languageSTT', ''),
autoTranscribeAudio: atomWithLocalStorage('autoTranscribeAudio', false),
decibelValue: atomWithLocalStorage('decibelValue', -45),
autoSendText: atomWithLocalStorage('autoSendText', -1),
textToSpeech: atomWithLocalStorage('textToSpeech', true),
engineTTS: atomWithLocalStorage('engineTTS', 'browser'),
voice: atomWithLocalStorage<string | undefined>('voice', undefined),
cloudBrowserVoices: atomWithLocalStorage('cloudBrowserVoices', false),
languageTTS: atomWithLocalStorage('languageTTS', ''),
automaticPlayback: atomWithLocalStorage('automaticPlayback', false),
playbackRate: atomWithLocalStorage<number | null>('playbackRate', null),
cacheTTS: atomWithLocalStorage('cacheTTS', true),
// Account settings
UsernameDisplay: atomWithLocalStorage('UsernameDisplay', true),
};
export default { ...staticAtoms, ...localStorageAtoms };