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
3015bb76
Commit
3015bb76
authored
Feb 09, 2024
by
Timothy J. Baek
Browse files
feat: convo mode
parent
cb5520c5
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
2 deletions
+34
-2
src/lib/components/chat/MessageInput.svelte
src/lib/components/chat/MessageInput.svelte
+1
-0
src/lib/components/chat/Messages/ResponseMessage.svelte
src/lib/components/chat/Messages/ResponseMessage.svelte
+6
-0
src/lib/components/chat/Settings/Voice.svelte
src/lib/components/chat/Settings/Voice.svelte
+27
-2
No files found.
src/lib/components/chat/MessageInput.svelte
View file @
3015bb76
...
@@ -674,6 +674,7 @@
...
@@ -674,6 +674,7 @@
{#if messages.length == 0 || messages.at(-1).done == true}
{#if messages.length == 0 || messages.at(-1).done == true}
{#if speechRecognitionEnabled}
{#if speechRecognitionEnabled}
<button
<button
id="voice-input-button"
class=" text-gray-600 dark:text-gray-300 transition rounded-lg p-1.5 mr-0.5 self-center"
class=" text-gray-600 dark:text-gray-300 transition rounded-lg p-1.5 mr-0.5 self-center"
type="button"
type="button"
on:click={() => {
on:click={() => {
...
...
src/lib/components/chat/Messages/ResponseMessage.svelte
View file @
3015bb76
...
@@ -149,6 +149,9 @@
...
@@ -149,6 +149,9 @@
audio.onended = () => {
audio.onended = () => {
speaking = null;
speaking = null;
if ($settings.conversationMode) {
document.getElementById('voice-input-button')?.click();
}
};
};
audio.play().catch((e) => console.error('Error playing audio:', e));
audio.play().catch((e) => console.error('Error playing audio:', e));
}
}
...
@@ -166,6 +169,9 @@
...
@@ -166,6 +169,9 @@
speak.onend = () => {
speak.onend = () => {
speaking = null;
speaking = null;
if ($settings.conversationMode) {
document.getElementById('voice-input-button')?.click();
}
};
};
speak.voice = voice;
speak.voice = voice;
speechSynthesis.speak(speak);
speechSynthesis.speak(speak);
...
...
src/lib/components/chat/Settings/Voice.svelte
View file @
3015bb76
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
// Voice
// Voice
let conversationMode = false;
let speechAutoSend = false;
let speechAutoSend = false;
let responseAutoPlayback = false;
let responseAutoPlayback = false;
...
@@ -37,6 +38,11 @@
...
@@ -37,6 +38,11 @@
}, 100);
}, 100);
};
};
const toggleConversationMode = async () => {
conversationMode = !conversationMode;
saveSettings({ conversationMode: conversationMode });
};
const toggleResponseAutoPlayback = async () => {
const toggleResponseAutoPlayback = async () => {
responseAutoPlayback = !responseAutoPlayback;
responseAutoPlayback = !responseAutoPlayback;
saveSettings({ responseAutoPlayback: responseAutoPlayback });
saveSettings({ responseAutoPlayback: responseAutoPlayback });
...
@@ -50,6 +56,7 @@
...
@@ -50,6 +56,7 @@
onMount(async () => {
onMount(async () => {
let settings = JSON.parse(localStorage.getItem('settings') ?? '{}');
let settings = JSON.parse(localStorage.getItem('settings') ?? '{}');
conversationMode = settings.conversationMode ?? false;
speechAutoSend = settings.speechAutoSend ?? false;
speechAutoSend = settings.speechAutoSend ?? false;
responseAutoPlayback = settings.responseAutoPlayback ?? false;
responseAutoPlayback = settings.responseAutoPlayback ?? false;
...
@@ -104,7 +111,25 @@
...
@@ -104,7 +111,25 @@
</div>
</div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs font-medium">Voice Input Auto-Send</div>
<div class=" self-center text-xs font-medium">Conversation Mode</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
toggleConversationMode();
}}
type="button"
>
{#if conversationMode === true}
<span class="ml-2 self-center">On</span>
{:else}
<span class="ml-2 self-center">Off</span>
{/if}
</button>
</div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs font-medium">Auto-send input after 3 sec.</div>
<button
<button
class="p-1 px-3 text-xs flex rounded transition"
class="p-1 px-3 text-xs flex rounded transition"
...
@@ -122,7 +147,7 @@
...
@@ -122,7 +147,7 @@
</div>
</div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs font-medium">
TTS Automatic Playback
</div>
<div class=" self-center text-xs font-medium">
Auto-playback response
</div>
<button
<button
class="p-1 px-3 text-xs flex rounded transition"
class="p-1 px-3 text-xs flex rounded transition"
...
...
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