mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
🔀 refactor: Modularize TTS Logic for Improved Browser support (#3657)
* WIP: message audio refactor * WIP: use MessageAudio by provider * fix: Update MessageAudio component to use TTSEndpoints enum * feat: Update useTextToSpeechBrowser hook to handle errors and improve error logging * feat: Add voice dropdown components for different TTS engines * docs: update incorrect `voices` example changed `voice: ''` to `voices: ['alloy']` * feat: Add brwoser support check for Edge TTS engine component with error toast if not supported --------- Co-authored-by: Marco Beretta <81851188+berry-13@users.noreply.github.com>
This commit is contained in:
parent
bcde0beb47
commit
dba704079c
18 changed files with 784 additions and 187 deletions
|
|
@ -1,8 +1,8 @@
|
|||
import { useRecoilValue } from 'recoil';
|
||||
import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
||||
import { useTextToSpeechMutation, useVoicesQuery } from '~/data-provider';
|
||||
import { useToastContext } from '~/Providers/ToastContext';
|
||||
import useLocalize from '~/hooks/useLocalize';
|
||||
import { useToastContext } from '~/Providers';
|
||||
import store from '~/store';
|
||||
|
||||
const createFormData = (text: string, voice: string) => {
|
||||
|
|
@ -13,7 +13,7 @@ const createFormData = (text: string, voice: string) => {
|
|||
};
|
||||
|
||||
type TUseTTSExternal = {
|
||||
setIsSpeaking: (isSpeaking: boolean) => void;
|
||||
setIsSpeaking: React.Dispatch<React.SetStateAction<boolean>>;
|
||||
audioRef: React.MutableRefObject<HTMLAudioElement | null>;
|
||||
messageId?: string;
|
||||
isLast: boolean;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue