mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2026-01-25 02:08:19 +00:00
add cobalt stt (#324)
* add cobalt stt * update languages for cobalt * update languages for cobalt
This commit is contained in:
@@ -406,6 +406,7 @@ export interface SpeechCredential {
|
||||
custom_stt_url: null | string;
|
||||
custom_tts_url: null | string;
|
||||
label: null | string;
|
||||
cobalt_server_uri: null | string;
|
||||
}
|
||||
|
||||
export interface Alert {
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
LANG_EN_US,
|
||||
LANG_EN_US_STANDARD_C,
|
||||
VENDOR_AWS,
|
||||
VENDOR_COBALT,
|
||||
VENDOR_CUSTOM,
|
||||
VENDOR_DEEPGRAM,
|
||||
VENDOR_GOOGLE,
|
||||
@@ -87,7 +88,8 @@ export const SpeechProviderSelection = ({
|
||||
(vendor) =>
|
||||
vendor.value != VENDOR_DEEPGRAM &&
|
||||
vendor.value != VENDOR_SONIOX &&
|
||||
vendor.value !== VENDOR_CUSTOM
|
||||
vendor.value !== VENDOR_CUSTOM &&
|
||||
vendor.value !== VENDOR_COBALT
|
||||
)}
|
||||
onChange={(e) => {
|
||||
const vendor = e.target.value as keyof SynthesisVendors;
|
||||
|
||||
@@ -30,6 +30,7 @@ import {
|
||||
VENDOR_NVIDIA,
|
||||
VENDOR_SONIOX,
|
||||
VENDOR_CUSTOM,
|
||||
VENDOR_COBALT,
|
||||
} from "src/vendor";
|
||||
import { MSG_REQUIRED_FIELDS } from "src/constants";
|
||||
import {
|
||||
@@ -108,6 +109,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
const [onPremNuanceSttCheck, setOnPremNuanceSttCheck] = useState(false);
|
||||
const [tmpOnPremNuanceSttUrl, setTmpOnPremNuanceSttUrl] = useState("");
|
||||
const [onPremNuanceSttUrl, setOnPremNuanceSttUrl] = useState("");
|
||||
const [cobaltServerUri, setCobaltServerUri] = useState("");
|
||||
const [label, setLabel] = useState("");
|
||||
|
||||
const handleFile = (file: File) => {
|
||||
@@ -192,6 +194,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
nuance_tts_uri: onPremNuanceTtsUrl || null,
|
||||
nuance_stt_uri: onPremNuanceSttUrl || null,
|
||||
}),
|
||||
...(vendor === VENDOR_COBALT && {
|
||||
cobalt_server_uri: cobaltServerUri || null,
|
||||
}),
|
||||
};
|
||||
|
||||
if (credential && credential.data) {
|
||||
@@ -380,6 +385,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
if (credential.data.label) {
|
||||
setLabel(credential.data.label);
|
||||
}
|
||||
if (credential.data.cobalt_server_uri) {
|
||||
setCobaltServerUri(credential.data.cobalt_server_uri);
|
||||
}
|
||||
}
|
||||
}, [credential]);
|
||||
|
||||
@@ -468,6 +476,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
{vendor && (
|
||||
<fieldset>
|
||||
{vendor !== VENDOR_DEEPGRAM &&
|
||||
vendor !== VENDOR_COBALT &&
|
||||
vendor !== VENDOR_SONIOX &&
|
||||
vendor != VENDOR_CUSTOM && (
|
||||
<label htmlFor="use_for_tts" className="chk">
|
||||
@@ -560,6 +569,24 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
)}
|
||||
</fieldset>
|
||||
)}
|
||||
{vendor === VENDOR_COBALT && (
|
||||
<fieldset>
|
||||
<label htmlFor="cobalt_server_url">
|
||||
Server URI<span>*</span>
|
||||
</label>
|
||||
<input
|
||||
id="cobalt_server_url"
|
||||
type="text"
|
||||
name="cobalt_server_url"
|
||||
placeholder="Required"
|
||||
required
|
||||
value={cobaltServerUri}
|
||||
onChange={(e) => {
|
||||
setCobaltServerUri(e.target.value);
|
||||
}}
|
||||
/>
|
||||
</fieldset>
|
||||
)}
|
||||
{vendor === VENDOR_CUSTOM && (
|
||||
<fieldset>
|
||||
<label htmlFor="custom_vendor_auth_token">
|
||||
|
||||
10
src/vendor/index.tsx
vendored
10
src/vendor/index.tsx
vendored
@@ -19,6 +19,7 @@ export const VENDOR_IBM = "ibm";
|
||||
export const VENDOR_NVIDIA = "nvidia";
|
||||
export const VENDOR_SONIOX = "soniox";
|
||||
export const VENDOR_CUSTOM = "custom";
|
||||
export const VENDOR_COBALT = "cobalt";
|
||||
|
||||
export const vendors: VendorOptions[] = [
|
||||
{
|
||||
@@ -61,7 +62,11 @@ export const vendors: VendorOptions[] = [
|
||||
name: "Custom",
|
||||
value: VENDOR_CUSTOM,
|
||||
},
|
||||
];
|
||||
{
|
||||
name: "Cobalt",
|
||||
value: VENDOR_COBALT,
|
||||
},
|
||||
].sort((a, b) => a.name.localeCompare(b.name)) as VendorOptions[];
|
||||
|
||||
export const useRegionVendors = () => {
|
||||
const [regions, setRegions] = useState<RegionVendors>();
|
||||
@@ -115,6 +120,7 @@ export const useSpeechVendors = () => {
|
||||
import("./speech-recognizer/ibm-speech-recognizer-lang"),
|
||||
import("./speech-recognizer/nvidia-speech-recognizer-lang"),
|
||||
import("./speech-recognizer/soniox-speech-recognizer-lang"),
|
||||
import("./speech-recognizer/cobalt-speech-recognizer-lang"),
|
||||
import("./speech-synthesis/aws-speech-synthesis-lang"),
|
||||
import("./speech-synthesis/google-speech-synthesis-lang"),
|
||||
import("./speech-synthesis/ms-speech-synthesis-lang"),
|
||||
@@ -132,6 +138,7 @@ export const useSpeechVendors = () => {
|
||||
{ default: ibmRecognizer },
|
||||
{ default: nvidiaRecognizer },
|
||||
{ default: sonioxRecognizer },
|
||||
{ default: cobaltRecognizer },
|
||||
{ default: awsSynthesis },
|
||||
{ default: googleSynthesis },
|
||||
{ default: msSynthesis },
|
||||
@@ -160,6 +167,7 @@ export const useSpeechVendors = () => {
|
||||
ibm: ibmRecognizer,
|
||||
nvidia: nvidiaRecognizer,
|
||||
soniox: sonioxRecognizer,
|
||||
cobalt: cobaltRecognizer,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
30
src/vendor/speech-recognizer/cobalt-speech-recognizer-lang.ts
vendored
Normal file
30
src/vendor/speech-recognizer/cobalt-speech-recognizer-lang.ts
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
import type { Language } from "../types";
|
||||
|
||||
export const languages: Language[] = [
|
||||
{
|
||||
name: "English US",
|
||||
code: "en_US-8khz",
|
||||
},
|
||||
{
|
||||
name: "English UK",
|
||||
code: "en_UK-8khz",
|
||||
},
|
||||
{
|
||||
name: "Spanish",
|
||||
code: "es_xx-8khz",
|
||||
},
|
||||
{
|
||||
name: "French",
|
||||
code: "fr_fr-8khz",
|
||||
},
|
||||
{
|
||||
name: "Russian",
|
||||
code: "ru_ru-8khz",
|
||||
},
|
||||
{
|
||||
name: "Portuguese",
|
||||
code: "pt_br-8khz",
|
||||
},
|
||||
];
|
||||
|
||||
export default languages;
|
||||
2
src/vendor/types.ts
vendored
2
src/vendor/types.ts
vendored
@@ -8,6 +8,7 @@ export type Vendor =
|
||||
| "IBM"
|
||||
| "Nvidia"
|
||||
| "Soniox"
|
||||
| "Cobalt"
|
||||
| "Custom";
|
||||
|
||||
export interface VendorOptions {
|
||||
@@ -70,6 +71,7 @@ export interface RecognizerVendors {
|
||||
ibm: Language[];
|
||||
nvidia: Language[];
|
||||
soniox: Language[];
|
||||
cobalt: Language[];
|
||||
}
|
||||
|
||||
export interface SynthesisVendors {
|
||||
|
||||
Reference in New Issue
Block a user