From 1be5dcc06bf3653aafd0e6e0cd896677beae5db9 Mon Sep 17 00:00:00 2001 From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com> Date: Mon, 13 Feb 2023 20:37:32 +0700 Subject: [PATCH] feat: nvidia tts/stt speech (#201) * feat: nvidia tts/stt speech * fix: rename riva server uri * fix: review comments * fix: review comments * sort vendors in alphabetic order --------- Co-authored-by: Quan HL Co-authored-by: Dave Horton --- src/api/types.ts | 1 + .../internal/views/speech-services/form.tsx | 28 +++++++++ src/vendor/index.tsx | 31 +++++++--- .../nvidia-speech-recognizer-lang.ts | 62 +++++++++++++++++++ .../nvidia-speech-synthesis-lang.ts | 20 ++++++ src/vendor/types.ts | 7 ++- 6 files changed, 137 insertions(+), 12 deletions(-) create mode 100644 src/vendor/speech-recognizer/nvidia-speech-recognizer-lang.ts create mode 100644 src/vendor/speech-synthesis/nvidia-speech-synthesis-lang.ts diff --git a/src/api/types.ts b/src/api/types.ts index d460705..6cdc61e 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -307,6 +307,7 @@ export interface SpeechCredential { stt_api_key: null | string; stt_region: null | string; instance_id: null | string; + riva_server_uri: null | string; } export interface Alert { diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx index eb2884d..12e0cad 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -26,6 +26,7 @@ import { VENDOR_WELLSAID, VENDOR_DEEPGRAM, VENDOR_IBM, + VENDOR_NVIDIA, } from "src/vendor"; import { MSG_REQUIRED_FIELDS } from "src/constants"; import { @@ -75,6 +76,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const [tmpCustomTtsEndpoint, setTmpCustomTtsEndpoint] = useState(""); const [customSttEndpoint, setCustomSttEndpoint] = useState(""); const [tmpCustomSttEndpoint, setTmpCustomSttEndpoint] = useState(""); + const [rivaServerUri, setRivaServerUri] = useState(""); const handleFile = (file: File) => { const handleError = () => { @@ -136,6 +138,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { tts_api_key: ttsApiKey || null, tts_region: ttsRegion || null, }), + ...(vendor === VENDOR_NVIDIA && { + riva_server_uri: rivaServerUri || null, + }), }; if (credential && credential.data) { @@ -173,6 +178,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { : null, client_id: vendor === VENDOR_NUANCE ? clientId : null, secret: vendor === VENDOR_NUANCE ? secretKey : null, + riva_server_uri: vendor == VENDOR_NVIDIA ? rivaServerUri : null, }) .then(() => { toastSuccess("Speech credential created successfully"); @@ -261,6 +267,10 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { setInstanceId(credential.data.instance_id); } + if (credential.data.riva_server_uri) { + setRivaServerUri(credential.data.riva_server_uri); + } + setUseCustomTts(credential.data.use_custom_tts > 0 ? true : false); setUseCustomStt(credential.data.use_custom_stt > 0 ? true : false); setCustomTtsEndpoint(credential.data.custom_tts_endpoint || ""); @@ -626,6 +636,24 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { )} + {vendor === VENDOR_NVIDIA && ( + +
+ + setRivaServerUri(e.target.value)} + /> +
+
+ )} +