Skip to content

Add configurable audio cues for background AI response completion #1062

Description

@paullizer

Summary

Add an admin-controlled audio cue capability for completed AI responses. When enabled, users can choose a completion sound and volume in their profile, while SimpleChat only plays the cue when the completed response is not being actively viewed.

User Value

Users can start responses in multiple conversations, move to another conversation, or place the browser in the background without having to watch every request. An audio cue lets them know when a response is ready while avoiding unnecessary sound when they are already looking at that completed conversation.

Proposed Behavior

  • Add an Admin Settings control that globally enables or disables AI response completion audio cues.
  • When the capability is enabled, add profile controls that let each user:
    • Enable or disable completion cues.
    • Choose from 10 bundled completion sounds.
    • Preview each sound before selecting it.
    • Set volume on a 1-10 scale.
    • Mute cues without losing the selected sound or volume.
  • Play the selected cue when a newly completed AI response belongs to a conversation other than the conversation currently being viewed.
  • Play the selected cue when the SimpleChat browser document or window is hidden or unfocused, including when the completed response belongs to the currently selected conversation.
  • Do not play a cue when the completed response belongs to the currently selected conversation and the SimpleChat page is visible and focused.
  • Treat simultaneous background conversations independently so each newly completed response can notify the user once.

Acceptance Criteria

  • Admins can globally enable or disable completion audio cues; when disabled, no user receives completion audio and the profile controls are unavailable or clearly disabled.
  • When enabled by an admin, the user profile provides enable/disable, mute, sound selection, sound preview, and volume controls.
  • Exactly 10 clearly distinguishable, appropriately licensed sound assets are bundled and served locally by SimpleChat.
  • The user's selected sound, volume from 1-10, mute state, and enabled state persist in user settings across sessions.
  • A newly completed response in a non-active conversation plays the configured cue once.
  • A newly completed response plays the configured cue when the SimpleChat page is hidden or unfocused, even if that conversation is selected.
  • No cue plays when the completed conversation is selected and the page is visible and focused.
  • Multiple concurrently running conversations can each produce one cue as their responses finish.
  • Historical unread notifications, page reloads, repeated polling, or duplicate completion events do not replay a cue that was already handled.
  • Failed, cancelled, or interrupted responses do not play a completion cue.
  • Muted or disabled user preferences always suppress playback.
  • Browser autoplay restrictions and audio playback failures are handled without breaking notification polling or chat behavior.
  • Functional and UI tests cover admin gating, preference persistence, volume mapping, foreground suppression, background playback, concurrent completion, and duplicate prevention.
  • User-facing and admin documentation explains the controls and relevant browser audio limitations.

Notes

  • The backend already emits chat_response_complete notifications through create_chat_response_notification, including conversation and message IDs. This is a likely integration point for detecting background completions and deduplicating playback.
  • Frontend notification polling currently lives in application/single_app/static/js/notifications.js; implementation should keep cue timing responsive without replaying previously observed notifications.
  • Audio files and browser JavaScript must remain local static assets and comply with the application's CSP.
  • Any admin setting sent to non-admin frontend routes must use the existing sanitized settings path.
  • Before implementation, confirm the default per-user state when an admin first enables the capability (enabled with a default cue versus user opt-in).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    Status
    Pending Assignment

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions