Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
💫 fix: catch constant conditions in recoil state usage (#3513)
Gerkincd326c4cf068
diff --git a/.eslintrc.js b/.eslintrc.jsindex 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.tsxindex 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<HTMLButtonElement>(null);const textAreaRef = useRef<HTMLTextAreaElement | null>(null);- const SpeechToText = useRecoilState<boolean>(store.speechToText);- const TextToSpeech = useRecoilState<boolean>(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.tsxindex 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<boolean>(store.conversationMode);- const speechToText = useRecoilState<boolean>(store.speechToText);- const textToSpeech = useRecoilState<boolean>(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<boolean>(store.autoTranscribeAudio);diff --git a/client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsx b/client/src/components/Nav/SettingsTabs/Speech/STT/AutoSendTextSelector.tsxindex 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<boolean>(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.tsxindex 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<boolean>(store.autoTranscribeAudio,);- const speechToText = useRecoilState<boolean>(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.tsxindex 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<boolean>(store.speechToText);+ const speechToText = useRecoilValue(store.speechToText);const [decibelValue, setDecibelValue] = useRecoilState(store.decibelValue);return (