From 781ccb95f29f4e3e735561b779f481e93904c164 Mon Sep 17 00:00:00 2001 From: EgleH Date: Sun, 6 Nov 2022 17:01:55 +0100 Subject: [PATCH] Add nuance speech provider (#144) * add nuance as Synthesis recognizer * fix getStatus for cred test check * add all languages * fixup nuance voice names * fix label focus issue Co-authored-by: eglehelms Co-authored-by: Dave Horton --- src/api/types.ts | 2 + .../internal/views/speech-services/form.tsx | 42 + .../internal/views/speech-services/utils.ts | 8 +- src/vendor/index.tsx | 11 + .../nuance-speech-recognizer-lang.ts | 211 ++++ .../nuance-speech-synthesis-lang.ts | 962 ++++++++++++++++++ src/vendor/types.ts | 6 +- 7 files changed, 1239 insertions(+), 3 deletions(-) create mode 100644 src/vendor/speech-recognizer/nuance-speech-recognizer-lang.ts create mode 100644 src/vendor/speech-synthesis/nuance-speech-synthesis-lang.ts diff --git a/src/api/types.ts b/src/api/types.ts index 6658243..7e4eaf8 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -258,6 +258,8 @@ export interface SpeechCredential { custom_tts_endpoint: null | string; use_custom_stt: number; custom_stt_endpoint: null | string; + client_id: null | string; + secret: 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 d5719f9..f107067 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -22,6 +22,7 @@ import { VENDOR_AWS, VENDOR_GOOGLE, VENDOR_MICROSOFT, + VENDOR_NUANCE, VENDOR_WELLSAID, } from "src/vendor"; import { MSG_REQUIRED_FIELDS } from "src/constants"; @@ -51,6 +52,8 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const [apiKey, setApiKey] = useState(""); const [accessKeyId, setAccessKeyId] = useState(""); const [secretAccessKey, setSecretAccessKey] = useState(""); + const [clientId, setClientId] = useState(""); + const [secretKey, setSecretKey] = useState(""); const [googleServiceKey, setGoogleServiceKey] = useState(null); const [useCustomTts, setUseCustomTts] = useState(false); @@ -137,6 +140,8 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { vendor === VENDOR_MICROSOFT || vendor === VENDOR_WELLSAID ? apiKey : null, + client_id: vendor === VENDOR_NUANCE ? clientId : null, + secret: vendor === VENDOR_NUANCE ? secretKey : null, }) .then(({ json }) => { toastSuccess("Speech credential created successfully"); @@ -195,6 +200,14 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { setRegion(credential.data.aws_region); } + if (credential.data.client_id) { + setClientId(credential.data.client_id); + } + + if (credential.data.secret) { + setSecretKey(credential.data.secret); + } + setUseCustomTts(credential.data.use_custom_tts > 0 ? true : false); setUseCustomStt(credential.data.use_custom_stt > 0 ? true : false); setCustomTtsEndpoint(credential.data.custom_tts_endpoint || ""); @@ -304,6 +317,35 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { )} )} + {vendor === VENDOR_NUANCE && ( +
+ + setClientId(e.target.value)} + disabled={credential ? true : false} + /> + + setSecretKey(e.target.value)} + disabled={credential ? true : false} + /> +
+ )} {vendor === VENDOR_AWS && (