From 55c1b26ddca72eb35e795b22fcadc84265304f17 Mon Sep 17 00:00:00 2001 From: EgleH Date: Wed, 11 Jan 2023 20:48:25 +0100 Subject: [PATCH] add instance ID field (#175) Co-authored-by: EgleHelms --- src/api/types.ts | 1 + .../internal/views/speech-services/form.tsx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/src/api/types.ts b/src/api/types.ts index 0fa144e..41ba8d3 100644 --- a/src/api/types.ts +++ b/src/api/types.ts @@ -306,6 +306,7 @@ export interface SpeechCredential { tts_region: null | string; stt_api_key: null | string; stt_region: null | string; + instance_id: 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 05151b5..6ff112e 100644 --- a/src/containers/internal/views/speech-services/form.tsx +++ b/src/containers/internal/views/speech-services/form.tsx @@ -67,6 +67,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { const [sttApiKey, setSttApiKey] = useState(""); const [ttsRegion, setTtsRegion] = useState(""); const [ttsApiKey, setTtsApiKey] = useState(""); + const [instanceId, setInstanceId] = useState(""); const [useCustomTts, setUseCustomTts] = useState(false); const [useCustomStt, setUseCustomStt] = useState(false); const [customTtsEndpoint, setCustomTtsEndpoint] = useState(""); @@ -129,6 +130,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { custom_stt_endpoint: customSttEndpoint || null, }), ...(vendor === VENDOR_IBM && { + instance_id: instanceId, stt_api_key: sttApiKey || null, stt_region: sttRegion || null, tts_api_key: ttsApiKey || null, @@ -253,6 +255,10 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { setSttRegion(credential.data.stt_region); } + if (credential.data.instance_id) { + setInstanceId(credential.data.instance_id); + } + setUseCustomTts(credential.data.use_custom_tts > 0 ? true : false); setUseCustomStt(credential.data.use_custom_stt > 0 ? true : false); setCustomTtsEndpoint(credential.data.custom_tts_endpoint || ""); @@ -528,6 +534,18 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => { onChange={(e) => setSttApiKey(e.target.value)} disabled={credential ? true : false} /> + + setInstanceId(e.target.value)} + /> )} {vendor === VENDOR_MICROSOFT && (