add elevenlabs (#330)

* add elevenlabs

* wip

* wip

* fix review comments

* fetch voice and language for eleven labs

* fix revciew comment

* fix revciew comment

* fix revciew comment

* fixed review comment
This commit is contained in:
Hoan Luu Huu authored and GitHub committed 2023-10-16 10:21:19 +02:00
1 parent f5302583b5
commit 26e3856603
8 files changed
+391 -33

No files matched your search

+8
View File
@@ -197,6 +197,14 @@ export const AUDIO_FORMAT_OPTIONS = [
value: "wav",
},
];
export const DEFAULT_ELEVENLABS_MODEL = "eleven_multilingual_v2";
export const ELEVENLABS_MODEL_OPTIONS = [
{ name: "Multilingual v2", value: "eleven_multilingual_v2" },
{ name: "Multilingual v1", value: "eleven_multilingual_v1" },
{ name: "English v1", value: "eleven_monolingual_v1" },
];
/** Password Length options */
export const PASSWORD_MIN = 8;
+30
View File
@@ -90,6 +90,10 @@ import type {
DeleteAccount,
ChangePassword,
SignIn,
GetVoices,
LanguageOption,
VoiceOption,
GetLanguages,
} from "./types";
import { Availability, StatusCodes } from "./types";
import { JaegerRoot } from "./jaeger-types";
@@ -329,6 +333,32 @@ export const postSpeechService = (
return postFetch<SidResponse, Partial<SpeechCredential>>(apiUrl, payload);
};
export const postSpeechServiceVoices = (
sid: string,
payload: Partial<GetVoices>
) => {
const userData = parseJwt(getToken());
const apiUrl =
userData.scope === USER_ACCOUNT
? `${API_ACCOUNTS}/${userData.account_sid}/SpeechCredentials/voices`
: `${API_SERVICE_PROVIDERS}/${sid}/SpeechCredentials/voices`;
return postFetch<VoiceOption[], Partial<GetVoices>>(apiUrl, payload);
};
export const postSpeechServiceLanguages = (
sid: string,
payload: Partial<GetLanguages>
) => {
const userData = parseJwt(getToken());
const apiUrl =
userData.scope === USER_ACCOUNT
? `${API_ACCOUNTS}/${userData.account_sid}/SpeechCredentials/languages`
: `${API_SERVICE_PROVIDERS}/${sid}/SpeechCredentials/languages`;
return postFetch<LanguageOption[], Partial<GetLanguages>>(apiUrl, payload);
};
export const postMsTeamsTentant = (payload: Partial<MSTeamsTenant>) => {
return postFetch<SidResponse, Partial<MSTeamsTenant>>(
API_MS_TEAMS_TENANTS,
+18
View File
@@ -407,6 +407,7 @@ export interface SpeechCredential {
custom_tts_url: null | string;
label: null | string;
cobalt_server_uri: null | string;
model_id: null | string;
}
export interface Alert {
@@ -675,3 +676,20 @@ export interface SignIn {
jwt?: null | string;
account_sid?: null | string;
}
export interface GetVoices {
vendor: string;
label: string;
}
export interface VoiceOption extends SelectorOptions {
[key: string]: unknown;
}
export interface GetLanguages extends GetVoices {
[key: string]: unknown;
}
export interface LanguageOption extends SelectorOptions {
[key: string]: unknown;
}