Add deepgram as STT (#151)

* add deepgram as stt

* add all languages

* remove unused types

* temporary remove Flemish

* apply review comments

Co-authored-by: eglehelms <e.helms@cognigy.com>
This commit is contained in:
EgleH
2022-11-16 16:18:28 +01:00
committed by GitHub
parent 29cd5a5fa7
commit a9edbdbd26
5 changed files with 177 additions and 25 deletions
@@ -19,6 +19,7 @@ import {
VENDOR_AWS,
VENDOR_WELLSAID,
useSpeechVendors,
VENDOR_DEEPGRAM,
} from "src/vendor";
import {
postApplication,
@@ -368,7 +369,9 @@ export const ApplicationForm = ({ application }: ApplicationFormProps) => {
id="synthesis_vendor"
name="synthesis_vendor"
value={synthVendor}
options={vendors}
options={vendors.filter(
(vendor) => vendor.value != VENDOR_DEEPGRAM
)}
onChange={(e) => {
const vendor = e.target.value as keyof SynthesisVendors;
setSynthVendor(vendor);
@@ -24,6 +24,7 @@ import {
VENDOR_MICROSOFT,
VENDOR_NUANCE,
VENDOR_WELLSAID,
VENDOR_DEEPGRAM,
} from "src/vendor";
import { MSG_REQUIRED_FIELDS } from "src/constants";
import { getObscuredSecret } from "src/utils";
@@ -137,7 +138,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
access_key_id: vendor === VENDOR_AWS ? accessKeyId : null,
secret_access_key: vendor === VENDOR_AWS ? secretAccessKey : null,
api_key:
vendor === VENDOR_MICROSOFT || vendor === VENDOR_WELLSAID
vendor === VENDOR_MICROSOFT ||
vendor === VENDOR_WELLSAID ||
vendor === VENDOR_DEEPGRAM
? apiKey
: null,
client_id: vendor === VENDOR_NUANCE ? clientId : null,
@@ -264,26 +267,30 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
</fieldset>
{vendor && (
<fieldset>
<label htmlFor="use_for_tts" className="chk">
<input
id="use_for_tts"
name="use_for_tts"
type="checkbox"
onChange={(e) => setTtsCheck(e.target.checked)}
defaultChecked={ttsCheck}
/>
<div>Use for text-to-speech</div>
</label>
<label htmlFor="use_for_stt" className="chk">
<input
id="use_for_stt"
name="use_for_stt"
type="checkbox"
onChange={(e) => setSttCheck(e.target.checked)}
defaultChecked={sttCheck}
/>
<div>Use for speech-to-text</div>
</label>
{vendor !== VENDOR_DEEPGRAM && (
<label htmlFor="use_for_tts" className="chk">
<input
id="use_for_tts"
name="use_for_tts"
type="checkbox"
onChange={(e) => setTtsCheck(e.target.checked)}
defaultChecked={ttsCheck}
/>
<div>Use for text-to-speech</div>
</label>
)}
{vendor !== VENDOR_WELLSAID && (
<label htmlFor="use_for_stt" className="chk">
<input
id="use_for_stt"
name="use_for_stt"
type="checkbox"
onChange={(e) => setSttCheck(e.target.checked)}
defaultChecked={sttCheck}
/>
<div>Use for speech-to-text</div>
</label>
)}
</fieldset>
)}
{vendor === VENDOR_GOOGLE && (
@@ -379,8 +386,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
/>
</fieldset>
)}
{/* Single API key state var is used for both Microsoft and WellSaid */}
{(vendor === VENDOR_MICROSOFT || vendor === VENDOR_WELLSAID) && (
{(vendor === VENDOR_MICROSOFT ||
vendor === VENDOR_WELLSAID ||
vendor === VENDOR_DEEPGRAM) && (
<fieldset>
<label htmlFor={`${vendor}_apikey`}>
API Key<span>*</span>
+8
View File
@@ -14,6 +14,7 @@ export const VENDOR_AWS = "aws";
export const VENDOR_MICROSOFT = "microsoft";
export const VENDOR_WELLSAID = "wellsaid";
export const VENDOR_NUANCE = "nuance";
export const VENDOR_DEEPGRAM = "deepgram";
export const vendors: VendorOptions[] = [
{
@@ -36,6 +37,10 @@ export const vendors: VendorOptions[] = [
name: "Nuance",
value: VENDOR_NUANCE,
},
{
name: "deepgram",
value: VENDOR_DEEPGRAM,
},
];
export const useRegionVendors = () => {
@@ -78,6 +83,7 @@ export const useSpeechVendors = () => {
import("./speech-recognizer/google-speech-recognizer-lang"),
import("./speech-recognizer/ms-speech-recognizer-lang"),
import("./speech-recognizer/nuance-speech-recognizer-lang"),
import("./speech-recognizer/deepgram-speech-recognizer-lang"),
import("./speech-synthesis/aws-speech-synthesis-lang"),
import("./speech-synthesis/google-speech-synthesis-lang"),
import("./speech-synthesis/ms-speech-synthesis-lang"),
@@ -89,6 +95,7 @@ export const useSpeechVendors = () => {
{ default: googleRecognizer },
{ default: msRecognizer },
{ default: nuanceRecognizer },
{ default: deepgramRecognizer },
{ default: awsSynthesis },
{ default: googleSynthesis },
{ default: msSynthesis },
@@ -109,6 +116,7 @@ export const useSpeechVendors = () => {
google: googleRecognizer,
microsoft: msRecognizer,
nuance: nuanceRecognizer,
deepgram: deepgramRecognizer,
},
});
}
@@ -0,0 +1,126 @@
import type { Language } from "../types";
export const languages: Language[] = [
{
name: "Chinese - general",
code: "zh",
},
{
name: "Chinese (China)",
code: "zh-CN",
},
{
name: "Chinese (Taiwan)",
code: "zh-TW",
},
{
name: "Dutch - general",
code: "nl",
},
{
name: "English - general",
code: "en",
},
{
name: "English (Australia)",
code: "en-AU",
},
{
name: "English (United Kingdom)",
code: "en-GB",
},
{
name: "English (India)",
code: "en-IN",
},
{
name: "English (New Zealand)",
code: "en-NZ",
},
{
name: "English (United States)",
code: "en-US",
},
{
name: "French - general",
code: "fr",
},
{
name: "French (Canada)",
code: "fr-CA",
},
{
name: "German - general",
code: "de",
},
{
name: "Hindi - general",
code: "hi",
},
{
name: "Hindi (Roman Script)",
code: "hi-Latin",
},
{
name: "Indonesian - general",
code: "in",
},
{
name: "Italian - general",
code: "it",
},
{
name: "Japanese - general",
code: "ja",
},
{
name: "Korean - general",
code: "ko",
},
{
name: "Norwegian - general",
code: "no",
},
{
name: "Polish - general",
code: "pl",
},
{
name: "Portuguese - general",
code: "pt",
},
{
name: "Portuguese (Brazil)",
code: "pt-BR",
},
{
name: "Portuguese (Portugal)",
code: "pt-PT",
},
{
name: "Russian - general",
code: "ru",
},
{
name: "Spanish - general",
code: "es",
},
{
name: "Spanish (Latin America)",
code: "es-419",
},
{
name: "Swedish - general",
code: "sv",
},
{
name: "Turkish - general",
code: "tr",
},
{
name: "Ukrainian - general",
code: "uk",
},
];
export default languages;
+8 -1
View File
@@ -1,4 +1,10 @@
export type Vendor = "Google" | "AWS" | "Microsoft" | "WellSaid" | "Nuance";
export type Vendor =
| "Google"
| "AWS"
| "Microsoft"
| "WellSaid"
| "Nuance"
| "deepgram";
export interface VendorOptions {
name: Vendor;
@@ -50,6 +56,7 @@ export interface RecognizerVendors {
google: Language[];
microsoft: Language[];
nuance: Language[];
deepgram: Language[];
}
export interface SynthesisVendors {