mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-16 16:30:15 +01:00
38 lines
1 KiB
TypeScript
38 lines
1 KiB
TypeScript
import { useRecoilState } from 'recoil';
|
|||
import { Switch } from '~/components/ui';
|
|||
import { useLocalize } from '~/hooks';
|
|||
import store from '~/store';
|
|||
|
|||
export default function AutoTranscribeAudioSwitch({
|
|||
onCheckedChange,
|
|||
}: {
|
|||
onCheckedChange?: (value: boolean) => void;
|
|||
}) {
|
|||
const localize = useLocalize();
|
|||
const [autoTranscribeAudio, setAutoTranscribeAudio] = useRecoilState<boolean>(
|
|||
store.autoTranscribeAudio,
|
|||
);
|
|||
const [speechToText] = useRecoilState<boolean>(store.SpeechToText);
|
|||
|
|||
const handleCheckedChange = (value: boolean) => {
|
|||
setAutoTranscribeAudio(value);
|
|||
if (onCheckedChange) {
|
|||
onCheckedChange(value);
|
|||
}
|
|||
};
|
|||
|
|||
return (
|
|||
<div className="flex items-center justify-between">
|
|||
<div>{localize('com_nav_auto_transcribe_audio')}</div>
|
|||
<Switch
|
|||
id="AutoTranscribeAudio"
|
|||
checked={autoTranscribeAudio}
|
|||
onCheckedChange={handleCheckedChange}
|
|||
className="ml-4"
|
|||
data-testid="AutoTranscribeAudio"
|
|||
disabled={!speechToText}
|
|||
/>
|
|||
</div>
|
|||
);
|
|||
}
|