Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support use_streaming elevenlabs and whisper #396

Merged
merged 1 commit into from
Feb 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -419,6 +419,7 @@ export interface SpeechCredential {
model_id: null | string;
model: null | string;
options: null | string;
use_streaming: number;
}

export interface Alert {
Expand Down
21 changes: 21 additions & 0 deletions src/containers/internal/views/speech-services/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
const [optionsInitialChecked, setOptionsInitialChecked] = useState(false);
const [options, setOptions] = useState("");
const [tmpOptions, setTmpOptions] = useState("");
const [useStreaming, setUseStreaming] = useState(false);

const handleFile = (file: File) => {
const handleError = () => {
Expand Down Expand Up @@ -292,6 +293,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
...(vendor === VENDOR_ELEVENLABS && {
options: options || null,
}),
...((vendor === VENDOR_ELEVENLABS || vendor === VENDOR_WHISPER) && {
use_streaming: useStreaming ? 1 : 0,
}),
};

if (credential && credential.data) {
Expand Down Expand Up @@ -535,6 +539,9 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
setOptions(credential.data.options);
setOptionsInitialChecked(true);
}
if (credential?.data?.use_streaming) {
setUseStreaming(credential.data.use_streaming > 0 ? true : false);
}
if (credential?.data?.vendor === VENDOR_GOOGLE) {
// let try to check if there is custom voices
getGoogleCustomVoices({
Expand Down Expand Up @@ -749,6 +756,20 @@ export const SpeechServiceForm = ({ credential }: SpeechServiceFormProps) => {
)}
</fieldset>
)}
{(vendor === VENDOR_ELEVENLABS || vendor === VENDOR_WHISPER) && (
<fieldset>
<label htmlFor="streaming_mode" className="chk">
<input
id="streaming_mode"
name="streaming_mode"
type="checkbox"
onChange={(e) => setUseStreaming(e.target.checked)}
defaultChecked={useStreaming}
/>
<div>Use Streaming</div>
</label>
</fieldset>
)}
{vendor === VENDOR_COBALT && (
<fieldset>
<label htmlFor="cobalt_server_url">
Expand Down
Loading