🗣️ fix: get speechTab config; feature: not overriding variables selected by user (#3282)

* fix(Speech): speechTab settings update

* fix: get speech config; refactor: moved everything to types and removed file types; feature: not overriding variables selected by user
This commit is contained in:
Marco Beretta 2024-07-10 22:38:36 +02:00 committed by GitHub
parent cd00df69bb
commit f959ee302c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 30 additions and 16 deletions

View file

@ -23,11 +23,11 @@ import {
AutoSendTextSwitch,
AutoTranscribeAudioSwitch,
} from './STT';
import { useCustomConfigSpeechQuery } from '~/data-provider';
import { useGetCustomConfigSpeechQuery } from 'librechat-data-provider/react-query';
function Speech() {
const [confirmClear, setConfirmClear] = useState(false);
const { data } = useCustomConfigSpeechQuery();
const { data } = useGetCustomConfigSpeechQuery();
const isSmallScreen = useMediaQuery('(max-width: 767px)');
const [advancedMode, setAdvancedMode] = useRecoilState(store.advancedMode);
@ -66,10 +66,12 @@ function Speech() {
playbackRate: { value: playbackRate, setFunc: setPlaybackRate },
};
if (settings[key]) {
const setting = settings[key];
setting.setFunc(newValue);
if (settings[key].value !== newValue || settings[key].value === newValue || !settings[key]) {
return;
}
const setting = settings[key];
setting.setFunc(newValue);
},
[
conversationMode,
@ -111,7 +113,8 @@ function Speech() {
updateSetting(key, value);
});
}
}, []);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [data]);
const contentRef = useRef(null);
useOnClickOutside(contentRef, () => confirmClear && setConfirmClear(false), []);