This commit is contained in:
Timothy Jaeryang Baek 2025-01-04 02:05:42 -08:00
parent f3a4d61f81
commit c0b93791dc
2 changed files with 13 additions and 3 deletions

View File

@ -1,5 +1,5 @@
<script lang="ts">
import { settings } from '$lib/stores';
import { settings, playingNotificationSound } from '$lib/stores';
import DOMPurify from 'dompurify';
import { marked } from 'marked';
@ -17,8 +17,15 @@
}
if ($settings?.notificationSound ?? true) {
const audio = new Audio(`/audio/notification.mp3`);
audio.play();
if (!$playingNotificationSound) {
playingNotificationSound.set(true);
const audio = new Audio(`/audio/notification.mp3`);
audio.play().finally(() => {
// Ensure the global state is reset after the sound finishes
playingNotificationSound.set(false);
});
}
}
});
</script>

View File

@ -69,6 +69,9 @@ export const temporaryChatEnabled = writable(false);
export const scrollPaginationEnabled = writable(false);
export const currentChatPage = writable(1);
export const playingNotificationSound = writable(false);
export type Model = OpenAIModel | OllamaModel;
type BaseModel = {