From 2f2e58e180cc37abaa805c8f18b7b1c3470db28a Mon Sep 17 00:00:00 2001
From: Hoan Luu Huu <110280845+xquanluu@users.noreply.github.com>
Date: Tue, 26 Dec 2023 19:53:13 +0700
Subject: [PATCH] support deepgram (#369)
* support deepgram
* wip
---
.../views/applications/speech-selection.tsx | 26 ++++++++++++++++++-
.../internal/views/speech-services/form.tsx | 3 +--
src/vendor/index.tsx | 24 ++++++++++++-----
.../speech-synthsis-models/deepgram-models.ts | 13 ++++++++++
src/vendor/types.ts | 2 ++
5 files changed, 58 insertions(+), 10 deletions(-)
create mode 100644 src/vendor/speech-synthsis-models/deepgram-models.ts
diff --git a/src/containers/internal/views/applications/speech-selection.tsx b/src/containers/internal/views/applications/speech-selection.tsx
index caf88b9..50d32ac 100644
--- a/src/containers/internal/views/applications/speech-selection.tsx
+++ b/src/containers/internal/views/applications/speech-selection.tsx
@@ -25,6 +25,7 @@ import {
VENDOR_SONIOX,
VENDOR_WELLSAID,
VENDOR_WHISPER,
+ useTtsModels,
} from "src/vendor";
import {
LabelOptions,
@@ -92,11 +93,16 @@ export const SpeechProviderSelection = ({
const currentVendor = useRef(synthVendor);
+ const ttsModels = useTtsModels();
+
useEffect(() => {
currentVendor.current = synthVendor;
if (!synthesis || synthVendor.startsWith("custom:")) {
return;
}
+ if (synthVendor === VENDOR_DEEPGRAM) {
+ return;
+ }
const voiceOpts = synthesis[synthVendor as keyof SynthesisVendors]
.filter((lang: VoiceLanguage) => {
// ELEVENLABS has same voice for all lange, take voices from the 1st language
@@ -206,7 +212,6 @@ export const SpeechProviderSelection = ({
value={synthVendor}
options={ttsVendorOptions.filter(
(vendor) =>
- vendor.value != VENDOR_DEEPGRAM &&
vendor.value != VENDOR_ASSEMBLYAI &&
vendor.value != VENDOR_SONIOX &&
vendor.value !== VENDOR_CUSTOM &&
@@ -223,6 +228,12 @@ export const SpeechProviderSelection = ({
return;
}
+ /** DEEPGRAM only support voice */
+ if (vendor.toString().startsWith(VENDOR_DEEPGRAM)) {
+ setSynthVoice("");
+ return;
+ }
+
/** When using Google and en-US, ensure "Standard-C" is used as default */
if (
e.target.value === VENDOR_GOOGLE &&
@@ -282,8 +293,21 @@ export const SpeechProviderSelection = ({
/>
>
)}
+ {ttsModels && synthVendor === VENDOR_DEEPGRAM && (
+ <>
+
+ setSynthVoice(e.target.value)}
+ />
+ >
+ )}
{synthVendor &&
!synthVendor.toString().startsWith(VENDOR_CUSTOM) &&
+ synthVendor !== VENDOR_DEEPGRAM &&
synthLang && (
<>
diff --git a/src/containers/internal/views/speech-services/form.tsx b/src/containers/internal/views/speech-services/form.tsx
index a0e56a3..3fcadc8 100644
--- a/src/containers/internal/views/speech-services/form.tsx
+++ b/src/containers/internal/views/speech-services/form.tsx
@@ -639,8 +639,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
{vendor && (