Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
chenpangpang
open-webui
Commits
27417dd7
Commit
27417dd7
authored
Jun 07, 2024
by
Timothy J. Baek
Browse files
refac: audio
parent
16615010
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
16 deletions
+23
-16
src/lib/components/admin/Settings/Audio.svelte
src/lib/components/admin/Settings/Audio.svelte
+1
-10
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+8
-1
src/lib/components/chat/MessageInput/CallOverlay.svelte
src/lib/components/chat/MessageInput/CallOverlay.svelte
+5
-4
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+9
-1
No files found.
src/lib/components/admin/Settings/Audio.svelte
View file @
27417dd7
...
@@ -234,7 +234,7 @@
...
@@ -234,7 +234,7 @@
bind:value={TTS_VOICE}
bind:value={TTS_VOICE}
>
>
<option value="" selected={TTS_VOICE !== ''}>{$i18n.t('Default')}</option>
<option value="" selected={TTS_VOICE !== ''}>{$i18n.t('Default')}</option>
{#each voices
.filter((v) => nonLocalVoices || v.localService === true)
as voice}
{#each voices as voice}
<option
<option
value={voice.voiceURI}
value={voice.voiceURI}
class="bg-gray-100 dark:bg-gray-700"
class="bg-gray-100 dark:bg-gray-700"
...
@@ -244,15 +244,6 @@
...
@@ -244,15 +244,6 @@
</select>
</select>
</div>
</div>
</div>
</div>
<div class="flex items-center justify-between my-1.5">
<div class="text-xs">
{$i18n.t('Allow non-local voices')}
</div>
<div class="mt-1">
<Switch bind:state={nonLocalVoices} />
</div>
</div>
</div>
</div>
{:else if TTS_ENGINE === 'openai'}
{:else if TTS_ENGINE === 'openai'}
<div class=" flex gap-2">
<div class=" flex gap-2">
...
...
src/lib/components/chat/MessageInput.svelte
View file @
27417dd7
...
@@ -913,7 +913,14 @@
...
@@ -913,7 +913,14 @@
try {
try {
await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
await navigator.mediaDevices.getUserMedia({ audio: true, video: true });
// If the user grants the permission, proceed to show the call overlay
// If the user grants the permission, proceed to show the call overlay
showCallOverlay.set(true);
if ($config.audio.stt.engine !== 'web') {
showCallOverlay.set(true);
} else {
toast.error(
$i18n.t('Call feature is not supported when using Web STT engine')
);
}
} catch (err) {
} catch (err) {
// If the user denies the permission or an error occurs, show an error message
// If the user denies the permission or an error occurs, show an error message
toast.error($i18n.t('Permission denied when accessing media devices'));
toast.error($i18n.t('Permission denied when accessing media devices'));
...
...
src/lib/components/chat/MessageInput/CallOverlay.svelte
View file @
27417dd7
...
@@ -221,11 +221,12 @@
...
@@ -221,11 +221,12 @@
)
)
?.at(0) ?? undefined;
?.at(0) ?? undefined;
console.log($settings?.audio?.tts?.voice ?? $config?.audio?.tts?.voice);
console.log(voices);
currentUtterance = new SpeechSynthesisUtterance(content);
currentUtterance = new SpeechSynthesisUtterance(content);
currentUtterance.voice = voice;
if (voice) {
currentUtterance.voice = voice;
}
speechSynthesis.speak(currentUtterance);
speechSynthesis.speak(currentUtterance);
}
}
}, 100);
}, 100);
...
...
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
27417dd7
...
@@ -279,15 +279,23 @@
...
@@ -279,15 +279,23 @@
)
)
?.at(0) ?? undefined;
?.at(0) ?? undefined;
console.log(voice);
const speak = new SpeechSynthesisUtterance(message.content);
const speak = new SpeechSynthesisUtterance(message.content);
console.log(speak);
speak.onend = () => {
speak.onend = () => {
speaking = null;
speaking = null;
if ($settings.conversationMode) {
if ($settings.conversationMode) {
document.getElementById('voice-input-button')?.click();
document.getElementById('voice-input-button')?.click();
}
}
};
};
speak.voice = voice;
if (voice) {
speak.voice = voice;
}
speechSynthesis.speak(speak);
speechSynthesis.speak(speak);
}
}
}, 100);
}, 100);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment