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
526fcb02
Commit
526fcb02
authored
Nov 11, 2023
by
Timothy J. Baek
Browse files
feat: speech recognition auto send toggle
parent
2a4beae5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
3 deletions
+34
-3
src/lib/components/chat/SettingsModal.svelte
src/lib/components/chat/SettingsModal.svelte
+31
-3
src/routes/+page.svelte
src/routes/+page.svelte
+3
-0
No files found.
src/lib/components/chat/SettingsModal.svelte
View file @
526fcb02
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
let pullProgress = null;
let pullProgress = null;
// Addons
// Addons
let speechAutoSend = false;
let gravatarEmail = '';
let gravatarEmail = '';
let OPENAI_API_KEY = '';
let OPENAI_API_KEY = '';
...
@@ -89,7 +90,7 @@
...
@@ -89,7 +90,7 @@
document.documentElement.classList.add(theme);
document.documentElement.classList.add(theme);
};
};
const toggle
r
equestFormat = async () => {
const toggle
R
equestFormat = async () => {
if (requestFormat === '') {
if (requestFormat === '') {
requestFormat = 'json';
requestFormat = 'json';
} else {
} else {
...
@@ -99,6 +100,11 @@
...
@@ -99,6 +100,11 @@
saveSettings({ requestFormat: requestFormat !== '' ? requestFormat : undefined });
saveSettings({ requestFormat: requestFormat !== '' ? requestFormat : undefined });
};
};
const toggleSpeechAutoSend = async () => {
speechAutoSend = !speechAutoSend;
saveSettings({ speechAutoSend: speechAutoSend });
};
const pullModelHandler = async () => {
const pullModelHandler = async () => {
const res = await fetch(`${API_BASE_URL}/pull`, {
const res = await fetch(`${API_BASE_URL}/pull`, {
method: 'POST',
method: 'POST',
...
@@ -218,8 +224,9 @@
...
@@ -218,8 +224,9 @@
top_k = settings.top_k ?? 40;
top_k = settings.top_k ?? 40;
top_p = settings.top_p ?? 0.9;
top_p = settings.top_p ?? 0.9;
OPENAI_API_KEY = settings.OPENAI_API_KEY ?? ''
;
speechAutoSend = settings.speechAutoSend ?? false
;
gravatarEmail = settings.gravatarEmail ?? '';
gravatarEmail = settings.gravatarEmail ?? '';
OPENAI_API_KEY = settings.OPENAI_API_KEY ?? '';
}
}
</script>
</script>
...
@@ -501,7 +508,7 @@
...
@@ -501,7 +508,7 @@
<button
<button
class="p-1 px-3 text-xs flex rounded transition"
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
on:click={() => {
toggle
r
equestFormat();
toggle
R
equestFormat();
}}
}}
>
>
{#if requestFormat === ''}
{#if requestFormat === ''}
...
@@ -740,6 +747,27 @@
...
@@ -740,6 +747,27 @@
}}
}}
>
>
<div class=" space-y-3">
<div class=" space-y-3">
<div>
<div class=" py-1 flex w-full justify-between">
<div class=" self-center text-sm font-medium">Speech Auto-Send</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
toggleSpeechAutoSend();
}}
type="button"
>
{#if speechAutoSend === true}
<span class="ml-2 self-center">On</span>
{:else}
<span class="ml-2 self-center">Off</span>
{/if}
</button>
</div>
</div>
<hr class=" dark:border-gray-700" />
<div>
<div>
<div class=" mb-2.5 text-sm font-medium">
<div class=" mb-2.5 text-sm font-medium">
Gravatar Email <span class=" text-gray-400 text-sm">(optional)</span>
Gravatar Email <span class=" text-gray-400 text-sm">(optional)</span>
...
...
src/routes/+page.svelte
View file @
526fcb02
...
@@ -235,6 +235,9 @@
...
@@ -235,6 +235,9 @@
// Restart recognition after it ends
// Restart recognition after it ends
console
.
log
(
'
recognition ended
'
);
console
.
log
(
'
recognition ended
'
);
speechRecognitionListening
=
false
;
speechRecognitionListening
=
false
;
if
(
prompt
!==
''
&&
settings
?.
speechAutoSend
===
true
)
{
submitPrompt
(
prompt
);
}
};
};
// Event triggered when an error occurs
// Event triggered when an error occurs
...
...
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