Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active
TypeScript aianthropicartifactsawsazurechatgptchatgpt-cloneclaudeclonedeepseekgeminigooglegpt-5librechatmcpo1openairesponses-apivisionwebui
import useSpeechToTextExternal from './useSpeechToTextExternal';
import useSpeechToTextBrowser from './useSpeechToTextBrowser';
import useGetAudioSettings from './useGetAudioSettings';
const useSpeechToText = (
setText: (text: string, takeId?: number) => void,
onTranscriptionComplete: (text: string, takeId?: number) => void,
onTranscriptionSettled: (takeId?: number) => void,
/** Host-owned Auto Send Text preference. */
autoSendText: number,
): {
isLoading?: boolean;
isListening?: boolean;
stopRecording: () => void | Promise<void>;
startRecording: (takeId?: number) => void | Promise<void>;
/** Ends capture without producing a transcript. */
abortRecording: () => void;
} => {
const { speechToTextEndpoint } = useGetAudioSettings();
const externalSpeechToText = speechToTextEndpoint === 'external';
const {
isListening: speechIsListeningBrowser,
isLoading: speechIsLoadingBrowser,
startRecording: startSpeechRecordingBrowser,
stopRecording: stopSpeechRecordingBrowser,
abortRecording: abortSpeechRecordingBrowser,
} = useSpeechToTextBrowser(
setText,
onTranscriptionComplete,
onTranscriptionSettled,
autoSendText,
);
const {
isListening: speechIsListeningExternal,
isLoading: speechIsLoadingExternal,
externalStartRecording: startSpeechRecordingExternal,
externalStopRecording: stopSpeechRecordingExternal,
externalAbortRecording: abortSpeechRecordingExternal,
} = useSpeechToTextExternal(
setText,
onTranscriptionComplete,
onTranscriptionSettled,
autoSendText,
);
const isListening = externalSpeechToText ? speechIsListeningExternal : speechIsListeningBrowser;
const isLoading = externalSpeechToText ? speechIsLoadingExternal : speechIsLoadingBrowser;
const startRecording = externalSpeechToText
? startSpeechRecordingExternal
: startSpeechRecordingBrowser;
const stopRecording = externalSpeechToText
? stopSpeechRecordingExternal
: stopSpeechRecordingBrowser;
const abortRecording = externalSpeechToText
? abortSpeechRecordingExternal
: abortSpeechRecordingBrowser;
return {
isLoading,
isListening,
stopRecording,
startRecording,
abortRecording,
};
};
export default useSpeechToText;