Skip to main content

Module cues

Module cues 

Source
Expand description

Interaction cues: the moments an application may want to mark with a sound, haptic, or notification.

gpui-ai does not play audio. Components emit a Cue at the moments that matter (a reply arriving, a response settling, text copied, a prompt submitted, …) and an application can observe them in one place:

use gpui_ai::cues::{self, Cue};

let _cues = cues::observe(cx, move |cue, _cx| match cue {
    Cue::ResponseSettled { .. } => play("chime"),
    Cue::Copied => play("tick"),
    _ => {}
});
// Keep `_cues` alive for as long as the sounds should play.

Cues are hints, never state: every cue corresponds to a typed component event or snapshot transition that the application already receives.

Structs§

CueSubscription
Keeps a cue observer registered; dropping it unregisters the observer.

Enums§

Cue
A moment worth a cue.

Functions§

emit
Emits a cue to every live observer. Components call this at the moments described on Cue; applications may also emit their own.
observe
Registers an observer for every cue emitted by gpui-ai components.