diff --git a/.eslintrc.js b/.eslintrc.js index 58ee6d20a2..a391348e77 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -118,6 +118,8 @@ module.exports = { ], rules: { '@typescript-eslint/no-explicit-any': 'error', + '@typescript-eslint/no-unnecessary-condition': 'warn', + '@typescript-eslint/strict-boolean-expressions': 'warn', }, }, { diff --git a/client/src/components/Chat/Input/ChatForm.tsx b/client/src/components/Chat/Input/ChatForm.tsx index 3e29332322..90c6d7e078 100644 --- a/client/src/components/Chat/Input/ChatForm.tsx +++ b/client/src/components/Chat/Input/ChatForm.tsx @@ -38,8 +38,8 @@ const ChatForm = ({ index = 0 }) => { const submitButtonRef = useRef(null); const textAreaRef = useRef(null); - const SpeechToText = useRecoilState(store.speechToText); - const TextToSpeech = useRecoilState(store.textToSpeech); + const SpeechToText = useRecoilValue(store.speechToText); + const TextToSpeech = useRecoilValue(store.textToSpeech); const automaticPlayback = useRecoilValue(store.automaticPlayback); const [showStopButton, setShowStopButton] = useRecoilState(store.showStopButtonByIndex(index)); @@ -106,7 +106,7 @@ const ChatForm = ({ index = 0 }) => { () => isAssistantsEndpoint(conversation?.endpoint) && (!conversation?.assistant_id || - !assistantMap?.[conversation?.endpoint ?? '']?.[conversation?.assistant_id ?? '']), + !assistantMap[conversation.endpoint ?? ''][conversation.assistant_id ?? '']), [conversation?.assistant_id, conversation?.endpoint, assistantMap], ); const disableInputs = useMemo( diff --git a/client/src/components/Nav/SettingsTabs/Speech/ConversationModeSwitch.tsx b/client/src/components/Nav/SettingsTabs/Speech/ConversationModeSwitch.tsx index 7510175dfc..3fb662e3c9 100644 --- a/client/src/components/Nav/SettingsTabs/Speech/ConversationModeSwitch.tsx +++ b/client/src/components/Nav/SettingsTabs/Speech/ConversationModeSwitch.tsx @@ -1,4 +1,4 @@ -import { useRecoilState } from 'recoil'; +import { useRecoilState, useRecoilValue } from 'recoil'; import { Switch } from '~/components/ui'; import { useLocalize } from '~/hooks'; import store from '~/store'; @@ -10,8 +10,8 @@ export default function ConversationModeSwitch({ }) { const localize = useLocalize(); const [conversationMode, setConversationMode] = useRecoilState(store.conversationMode); - const speechToText = useRecoilState(store.speechToText); - const textToSpeech = useRecoilState(store.textToSpeech); + const speechToText = useRecoilValue(store.speechToText); + const textToSpeech = useRecoilValue(store.textToSpeech); const [, setAutoSendText] = useRecoilState(store.autoSendText); const [, setDecibelValue] = useRecoilState(store.decibelValue); const [, setAutoTranscribeAudio] = useRecoilState(store.autoTranscribeAudio); diff --git a/client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx b/client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx index 06ece50490..03d50c98bc 100644 --- a/client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx +++ b/client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useRecoilState } from 'recoil'; +import { useRecoilState, useRecoilValue } from 'recoil'; import { cn, defaultTextProps, optionText } from '~/utils/'; import { Slider, InputNumber } from '~/components/ui'; import { useLocalize } from '~/hooks'; @@ -8,7 +8,7 @@ import store from '~/store'; export default function AutoSendTextSelector() { const localize = useLocalize(); - const speechToText = useRecoilState(store.speechToText); + const speechToText = useRecoilValue(store.speechToText); const [autoSendText, setAutoSendText] = useRecoilState(store.autoSendText); return ( diff --git a/client/src/components/Nav/SettingsTabs/Speech/STT/AutoTranscribeAudioSwitch.tsx b/client/src/components/Nav/SettingsTabs/Speech/STT/AutoTranscribeAudioSwitch.tsx index a9c6b3ea5a..a2f3bebc9e 100644 --- a/client/src/components/Nav/SettingsTabs/Speech/STT/AutoTranscribeAudioSwitch.tsx +++ b/client/src/components/Nav/SettingsTabs/Speech/STT/AutoTranscribeAudioSwitch.tsx @@ -1,4 +1,4 @@ -import { useRecoilState } from 'recoil'; +import { useRecoilState, useRecoilValue } from 'recoil'; import { Switch } from '~/components/ui'; import { useLocalize } from '~/hooks'; import store from '~/store'; @@ -12,7 +12,7 @@ export default function AutoTranscribeAudioSwitch({ const [autoTranscribeAudio, setAutoTranscribeAudio] = useRecoilState( store.autoTranscribeAudio, ); - const speechToText = useRecoilState(store.speechToText); + const speechToText = useRecoilValue(store.speechToText); const handleCheckedChange = (value: boolean) => { setAutoTranscribeAudio(value); diff --git a/client/src/components/Nav/SettingsTabs/Speech/STT/DecibelSelector.tsx b/client/src/components/Nav/SettingsTabs/Speech/STT/DecibelSelector.tsx index 12836775e5..274f54b4a8 100755 --- a/client/src/components/Nav/SettingsTabs/Speech/STT/DecibelSelector.tsx +++ b/client/src/components/Nav/SettingsTabs/Speech/STT/DecibelSelector.tsx @@ -1,5 +1,5 @@ import React from 'react'; -import { useRecoilState } from 'recoil'; +import { useRecoilState, useRecoilValue } from 'recoil'; import { Slider, InputNumber } from '~/components/ui'; import { useLocalize } from '~/hooks'; import store from '~/store'; @@ -7,7 +7,7 @@ import { cn, defaultTextProps, optionText } from '~/utils/'; export default function DecibelSelector() { const localize = useLocalize(); - const speechToText = useRecoilState(store.speechToText); + const speechToText = useRecoilValue(store.speechToText); const [decibelValue, setDecibelValue] = useRecoilState(store.decibelValue); return (