mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-20 10:20:15 +01:00
🗣️ feat: Edge TTS engine (#3358)
* feat: MS Edge TTS * feat: Edge TTS; fix: STT hook
This commit is contained in:
parent
01a88991ab
commit
b390ba781f
14 changed files with 379 additions and 129 deletions
|
|
@ -1,6 +1,6 @@
|
|||
import { useRecoilValue } from 'recoil';
|
||||
import { useState, useMemo, useRef, useCallback, useEffect } from 'react';
|
||||
import { useTextToSpeechMutation } from '~/data-provider';
|
||||
import { useTextToSpeechMutation, useVoicesQuery } from '~/data-provider';
|
||||
import useAudioRef from '~/hooks/Audio/useAudioRef';
|
||||
import useLocalize from '~/hooks/useLocalize';
|
||||
import { useToastContext } from '~/Providers';
|
||||
|
|
@ -178,7 +178,18 @@ function useTextToSpeechExternal(messageId: string, isLast: boolean, index = 0)
|
|||
return isLocalSpeaking || (isLast && globalIsPlaying);
|
||||
}, [isLocalSpeaking, globalIsPlaying, isLast]);
|
||||
|
||||
return { generateSpeechExternal, cancelSpeech, isLoading, isSpeaking, audioRef };
|
||||
const useVoices = () => {
|
||||
return useVoicesQuery().data ?? [];
|
||||
};
|
||||
|
||||
return {
|
||||
generateSpeechExternal,
|
||||
cancelSpeech,
|
||||
isLoading,
|
||||
isSpeaking,
|
||||
audioRef,
|
||||
voices: useVoices,
|
||||
};
|
||||
}
|
||||
|
||||
export default useTextToSpeechExternal;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue