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
55097410
Commit
55097410
authored
Aug 14, 2024
by
Timothy J. Baek
Browse files
feat: haptic feedback on support devices (android)
Co-Authored-By:
Danny Liu
<
dannyjialiliu@gmail.com
>
parent
04e2b6e2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
0 deletions
+36
-0
src/lib/components/chat/Chat.svelte
src/lib/components/chat/Chat.svelte
+8
-0
src/lib/components/chat/Settings/Interface.svelte
src/lib/components/chat/Settings/Interface.svelte
+28
-0
No files found.
src/lib/components/chat/Chat.svelte
View file @
55097410
...
@@ -877,6 +877,10 @@
...
@@ -877,6 +877,10 @@
} else {
} else {
responseMessage.content += data.message.content;
responseMessage.content += data.message.content;
if (navigator.vibrate && ($settings?.hapticFeedback ?? false)) {
navigator.vibrate(5);
}
const sentences = extractSentencesForAudio(responseMessage.content);
const sentences = extractSentencesForAudio(responseMessage.content);
sentences.pop();
sentences.pop();
...
@@ -1177,6 +1181,10 @@
...
@@ -1177,6 +1181,10 @@
} else {
} else {
responseMessage.content += value;
responseMessage.content += value;
if (navigator.vibrate && ($settings?.hapticFeedback ?? false)) {
navigator.vibrate(5);
}
const sentences = extractSentencesForAudio(responseMessage.content);
const sentences = extractSentencesForAudio(responseMessage.content);
sentences.pop();
sentences.pop();
...
...
src/lib/components/chat/Settings/Interface.svelte
View file @
55097410
...
@@ -34,6 +34,7 @@
...
@@ -34,6 +34,7 @@
let showEmojiInCall = false;
let showEmojiInCall = false;
let voiceInterruption = false;
let voiceInterruption = false;
let hapticFeedback = false;
const toggleSplitLargeChunks = async () => {
const toggleSplitLargeChunks = async () => {
splitLargeChunks = !splitLargeChunks;
splitLargeChunks = !splitLargeChunks;
...
@@ -70,6 +71,11 @@
...
@@ -70,6 +71,11 @@
saveSettings({ voiceInterruption: voiceInterruption });
saveSettings({ voiceInterruption: voiceInterruption });
};
};
const toggleHapticFeedback = async () => {
hapticFeedback = !hapticFeedback;
saveSettings({ hapticFeedback: hapticFeedback });
};
const toggleUserLocation = async () => {
const toggleUserLocation = async () => {
userLocation = !userLocation;
userLocation = !userLocation;
...
@@ -151,6 +157,8 @@
...
@@ -151,6 +157,8 @@
chatDirection = $settings.chatDirection ?? 'LTR';
chatDirection = $settings.chatDirection ?? 'LTR';
userLocation = $settings.userLocation ?? false;
userLocation = $settings.userLocation ?? false;
hapticFeedback = $settings.hapticFeedback ?? false;
defaultModelId = $settings?.models?.at(0) ?? '';
defaultModelId = $settings?.models?.at(0) ?? '';
if ($config?.default_models) {
if ($config?.default_models) {
defaultModelId = $config.default_models.split(',')[0];
defaultModelId = $config.default_models.split(',')[0];
...
@@ -438,6 +446,26 @@
...
@@ -438,6 +446,26 @@
</div>
</div>
</div>
</div>
<div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">{$i18n.t('Haptic Feedback')}</div>
<button
class="p-1 px-3 text-xs flex rounded transition"
on:click={() => {
toggleHapticFeedback();
}}
type="button"
>
{#if hapticFeedback === true}
<span class="ml-2 self-center">{$i18n.t('On')}</span>
{:else}
<span class="ml-2 self-center">{$i18n.t('Off')}</span>
{/if}
</button>
</div>
</div>
<div class=" my-1.5 text-sm font-medium">{$i18n.t('Voice')}</div>
<div class=" my-1.5 text-sm font-medium">{$i18n.t('Voice')}</div>
<div>
<div>
...
...
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