mirror of
https://github.com/jambonz/jambonz-webapp.git
synced 2025-12-19 05:37:43 +00:00
@@ -420,6 +420,8 @@ export interface SpeechCredential {
|
||||
model: null | string;
|
||||
options: null | string;
|
||||
use_streaming: number;
|
||||
deepgram_stt_uri: null | string;
|
||||
deepgram_stt_use_tls: number;
|
||||
}
|
||||
|
||||
export interface Alert {
|
||||
|
||||
@@ -11,6 +11,7 @@ type CheckzoneProps = {
|
||||
hidden?: boolean;
|
||||
children: React.ReactNode;
|
||||
initialCheck: boolean;
|
||||
disabled?: boolean;
|
||||
handleChecked?: (e: React.ChangeEvent<HTMLInputElement>) => void;
|
||||
};
|
||||
|
||||
@@ -28,6 +29,7 @@ export const Checkzone = forwardRef<CheckzoneRef, CheckzoneProps>(
|
||||
children,
|
||||
initialCheck,
|
||||
handleChecked,
|
||||
disabled = false,
|
||||
}: CheckzoneProps,
|
||||
ref
|
||||
) => {
|
||||
@@ -51,6 +53,7 @@ export const Checkzone = forwardRef<CheckzoneRef, CheckzoneProps>(
|
||||
<label>
|
||||
<div className="label-container">
|
||||
<input
|
||||
disabled={disabled}
|
||||
ref={ref}
|
||||
type="checkbox"
|
||||
name={name}
|
||||
|
||||
@@ -48,6 +48,7 @@ import {
|
||||
isUserAccountScope,
|
||||
isNotBlank,
|
||||
hasLength,
|
||||
hasValue,
|
||||
} from "src/utils";
|
||||
import { getObscuredGoogleServiceKey } from "./utils";
|
||||
import { CredentialStatus } from "./status";
|
||||
@@ -145,6 +146,13 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
const [options, setOptions] = useState("");
|
||||
const [tmpOptions, setTmpOptions] = useState("");
|
||||
const [useStreaming, setUseStreaming] = useState(false);
|
||||
const [deepgramSttUri, setDeepgramSttUri] = useState("");
|
||||
const [tmpDeepgramSttUri, setTmpDeepgramSttUri] = useState("");
|
||||
const [deepgramSttUseTls, setDeepgramSttUseTls] = useState(false);
|
||||
const [tmpDeepgramSttUseTls, setTmpDeepgramSttUseTls] = useState(false);
|
||||
const [initialDeepgramOnpremCheck, setInitialDeepgramOnpremCheck] =
|
||||
useState(false);
|
||||
const [isDeepgramOnpremEnabled, setIsDeepgramOnpremEnabled] = useState(false);
|
||||
|
||||
const handleFile = (file: File) => {
|
||||
const handleError = () => {
|
||||
@@ -293,8 +301,12 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
...(vendor === VENDOR_ELEVENLABS && {
|
||||
options: options || null,
|
||||
}),
|
||||
...((vendor === VENDOR_ELEVENLABS || vendor === VENDOR_WHISPER) && {
|
||||
use_streaming: useStreaming ? 1 : 0,
|
||||
...((vendor === VENDOR_ELEVENLABS /* || vendor === VENDOR_WHISPER */) && {
|
||||
use_streaming: useStreaming ? 1 : 0
|
||||
}),
|
||||
...(vendor === VENDOR_DEEPGRAM && {
|
||||
deepgram_stt_uri: deepgramSttUri || null,
|
||||
deepgram_stt_use_tls: deepgramSttUseTls ? 1 : 0,
|
||||
}),
|
||||
};
|
||||
|
||||
@@ -551,6 +563,16 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
setUseCustomVoicesCheck(json.length > 0);
|
||||
});
|
||||
}
|
||||
if (credential?.data?.deepgram_stt_uri) {
|
||||
setDeepgramSttUri(credential.data.deepgram_stt_uri);
|
||||
}
|
||||
if (credential?.data?.deepgram_stt_use_tls) {
|
||||
setDeepgramSttUseTls(
|
||||
credential?.data?.deepgram_stt_use_tls > 0 ? true : false
|
||||
);
|
||||
}
|
||||
setInitialDeepgramOnpremCheck(hasValue(credential?.data?.deepgram_stt_uri));
|
||||
setIsDeepgramOnpremEnabled(hasValue(credential?.data?.deepgram_stt_uri));
|
||||
}, [credential]);
|
||||
|
||||
const updateCustomVoices = (
|
||||
@@ -1133,7 +1155,6 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
</fieldset>
|
||||
)}
|
||||
{(vendor === VENDOR_WELLSAID ||
|
||||
vendor === VENDOR_DEEPGRAM ||
|
||||
vendor === VENDOR_ASSEMBLYAI ||
|
||||
vendor == VENDOR_ELEVENLABS ||
|
||||
vendor === VENDOR_WHISPER ||
|
||||
@@ -1153,6 +1174,22 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
/>
|
||||
</fieldset>
|
||||
)}
|
||||
{vendor === VENDOR_DEEPGRAM && (
|
||||
<fieldset>
|
||||
<label htmlFor={`${vendor}_apikey`}>
|
||||
API key{!isDeepgramOnpremEnabled && <span>*</span>}
|
||||
</label>
|
||||
<Passwd
|
||||
id={`${vendor}_apikey`}
|
||||
required={!isDeepgramOnpremEnabled}
|
||||
name={`${vendor}_apikey`}
|
||||
placeholder="API key"
|
||||
value={apiKey ? getObscuredSecret(apiKey) : apiKey}
|
||||
onChange={(e) => setApiKey(e.target.value)}
|
||||
disabled={credential ? true : false}
|
||||
/>
|
||||
</fieldset>
|
||||
)}
|
||||
{(vendor == VENDOR_ELEVENLABS || vendor == VENDOR_WHISPER) &&
|
||||
ttsModels.length > 0 && (
|
||||
<fieldset>
|
||||
@@ -1345,6 +1382,57 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
|
||||
/>
|
||||
</fieldset>
|
||||
)}
|
||||
{vendor === VENDOR_DEEPGRAM && (
|
||||
<fieldset>
|
||||
<Checkzone
|
||||
disabled={hasValue(credential)}
|
||||
hidden
|
||||
name="use_hosted_deepgram_service"
|
||||
label="Use on-prem Deepgram container"
|
||||
initialCheck={initialDeepgramOnpremCheck}
|
||||
handleChecked={(e) => {
|
||||
// setInitialDeepgramOnpremCheck(!e.target.checked);
|
||||
setIsDeepgramOnpremEnabled(e.target.checked);
|
||||
if (e.target.checked) {
|
||||
if (tmpDeepgramSttUri) {
|
||||
setDeepgramSttUri(tmpDeepgramSttUri);
|
||||
}
|
||||
if (tmpDeepgramSttUseTls) {
|
||||
setDeepgramSttUseTls(tmpDeepgramSttUseTls);
|
||||
}
|
||||
} else {
|
||||
setTmpDeepgramSttUri(deepgramSttUri);
|
||||
setDeepgramSttUri("");
|
||||
setTmpDeepgramSttUseTls(deepgramSttUseTls);
|
||||
setDeepgramSttUseTls(false);
|
||||
}
|
||||
}}
|
||||
>
|
||||
<label htmlFor="deepgram_uri_for_tts">
|
||||
Container URI<span>*</span>
|
||||
</label>
|
||||
<input
|
||||
id="deepgram_uri_for_tts"
|
||||
required
|
||||
type="text"
|
||||
name="deepgram_uri_for_tts"
|
||||
placeholder="Container URI for TTS"
|
||||
value={deepgramSttUri}
|
||||
onChange={(e) => setDeepgramSttUri(e.target.value)}
|
||||
/>
|
||||
<label htmlFor="deepgram_tts_use_tls" className="chk">
|
||||
<input
|
||||
id="deepgram_tts_use_tls"
|
||||
name="deepgram_tts_use_tls"
|
||||
type="checkbox"
|
||||
onChange={(e) => setDeepgramSttUseTls(e.target.checked)}
|
||||
defaultChecked={deepgramSttUseTls}
|
||||
/>
|
||||
<div>Use TLS</div>
|
||||
</label>
|
||||
</Checkzone>
|
||||
</fieldset>
|
||||
)}
|
||||
{vendor === VENDOR_MICROSOFT && (
|
||||
<React.Fragment>
|
||||
<fieldset>
|
||||
|
||||
Reference in New Issue
Block a user