Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

Add sound notifications when research is complete

hashedviking17dc7498b95b
diff --git a/src/local_deep_research/web/static/js/components/progress.js b/src/local_deep_research/web/static/js/components/progress.js
index 68ca3e1427..b2107be1ed 100644
--- a/src/local_deep_research/web/static/js/components/progress.js
+++ b/src/local_deep_research/web/static/js/components/progress.js
@@ -784,6 +784,11 @@
// Show notification if enabled
showNotification('Research Complete', 'Your research has been completed successfully.');
+ // Play success sound if enabled
+ if (window.audio && notificationsEnabled) {
+ window.audio.playSuccess();
+ }
+
// Update favicon
updateFavicon(100);
@@ -825,6 +830,11 @@
// Show notification if enabled
showNotification('Research Error', `There was an error with your research: ${data.error}`);
+ // Play error sound if enabled
+ if (window.audio && notificationsEnabled) {
+ window.audio.playError();
+ }
+
// Update favicon
updateFavicon(100, true);
}
diff --git a/src/local_deep_research/web/static/js/main.js b/src/local_deep_research/web/static/js/main.js
index b339236c6c..03af8d91f6 100644
--- a/src/local_deep_research/web/static/js/main.js
+++ b/src/local_deep_research/web/static/js/main.js
@@ -18,7 +18,8 @@
'formatting.js',
'ui.js',
'api.js',
- 'socket.js'
+ 'socket.js',
+ 'audio.js'
];
// Optional services to load when needed
diff --git a/src/local_deep_research/web/static/js/services/audio.js b/src/local_deep_research/web/static/js/services/audio.js
new file mode 100644
index 0000000000..5f308fd906
--- /dev/null
+++ b/src/local_deep_research/web/static/js/services/audio.js
@@ -0,0 +1,102 @@
+/**
+ * Audio Service for sound notifications
+ * Handles playing sound alerts when research is complete
+ */
+
+// Audio objects for caching
+const audioCache = {
+ success: null,
+ error: null
+};
+
+/**
+ * Initialize the audio service
+ */
+function initializeAudio() {
+ // Preload the audio files
+ loadAudioFiles();
+
+ console.log('Audio service initialized');
+}
+
+/**
+ * Load the audio files
+ */
+function loadAudioFiles() {
+ try {
+ // Create audio objects if they don't exist
+ if (!audioCache.success) {
+ audioCache.success = new Audio('/research/static/sounds/success.mp3');
+ audioCache.success.preload = 'auto';
+ }
+
+ if (!audioCache.error) {
+ audioCache.error = new Audio('/research/static/sounds/error.mp3');
+ audioCache.error.preload = 'auto';
+ }
+ } catch (error) {
+ console.warn('Could not load audio files:', error);
+ }
+}
+
+/**
+ * Play a sound notification
+ * @param {string} type - The type of notification: 'success' or 'error'
+ * @param {boolean} force - Force playing even if notifications are disabled
+ */
+function playSound(type = 'success', force = false) {
+ try {
+ // Check if notifications are enabled in localStorage
+ const notificationsEnabled = localStorage.getItem('notificationsEnabled') === 'true' || force;
+
+ // Only play if notifications are enabled
+ if (notificationsEnabled) {
+ // Get the audio object
+ const audio = audioCache[type] || audioCache.success;
+
+ // Play the sound if the audio is loaded
+ if (audio) {
+ // Reset the playback position
+ audio.currentTime = 0;
+
+ // Play the sound
+ audio.play().catch(error => {
+ console.warn(`Could not play ${type} sound:`, error);
+ });
+ } else {
+ console.warn(`Audio for ${type} not loaded`);
+ // Try to load it now
+ loadAudioFiles();
+ }
+ }
+ } catch (error) {
+ console.warn('Error playing sound:', error);
+ }
+}
+
+/**
+ * Play success sound notification
+ * @param {boolean} force - Force playing even if notifications are disabled
+ */
+function playSuccessSound(force = false) {
+ playSound('success', force);
+}
+
+/**
+ * Play error sound notification
+ * @param {boolean} force - Force playing even if notifications are disabled
+ */
+function playErrorSound(force = false) {
+ playSound('error', force);
+}
+
+// Export to window object for global access
+window.audio = {
+ initialize: initializeAudio,
+ playSuccess: playSuccessSound,
+ playError: playErrorSound,
+ play: playSound
+};
+
+// Initialize when loaded
+initializeAudio();
\ No newline at end of file