LibreChat/client/src/components/Chat/Messages/MessageAudio.tsx
Danny Avila 10c0d7d474
⬇️ fix: Image Download Browser Compatibility (#7950)
* fix: Add null check for SelectedTTS in MessageAudio component to prevent rendering issues

* fix: image download browser compatibility with error handling and fallback mechanism

- Updated the downloadImage function to use fetch for improved reliability and added error handling.
- Implemented a fallback to the original download method in case of fetch failure.
- Ensured the download link uses a blob URL for better compatibility with various image types.
2025-06-17 21:11:39 -04:00

23 lines
643 B
TypeScript

import { memo } from 'react';
import { useRecoilValue } from 'recoil';
import type { TMessageAudio } from '~/common';
import { BrowserTTS, ExternalTTS } from '~/components/Audio/TTS';
import { TTSEndpoints } from '~/common';
import store from '~/store';
function MessageAudio(props: TMessageAudio) {
const engineTTS = useRecoilValue<string>(store.engineTTS);
const TTSComponents = {
[TTSEndpoints.browser]: BrowserTTS,
[TTSEndpoints.external]: ExternalTTS,
};
const SelectedTTS = TTSComponents[engineTTS];
if (!SelectedTTS) {
return null;
}
return <SelectedTTS {...props} />;
}
export default memo(MessageAudio);