Whisper
The Whisper Aptitude provides the ability to display pieces of information (Whispers) in the Olive Helps sidebar.
API
Example
Permissions

create

Displays a new Whisper in Olive Helps based on the configuration provided in the method signature.
1
import { whisper } from '@oliveai/ldk';
2
3
const whisperConfig = {
4
label: 'The Label of the Whisper',
5
onClose: () => {
6
// Called when the 'X' button is clicked to close this whisper
7
},
8
components: [
9
// Components supplied here are rendered in the whisper in the
10
// order that they are provided
11
],
12
};
13
14
whisper.create(whisperConfig);
Copied!
Whispers are the main way that your Loop conveys and receives information from your user. They also serve as the primary UI for your Loop. As such, the Whisper Aptitude will more than likely one of your most commonly used resources.
As an initial example, let's say that we want to display to the user a simple message with a link. To achieve this, we would use both the Markdown and Link component like this:
1
import { whisper } from '@oliveai/ldk';
2
3
const whisperConfig = {
4
label: 'Link To Documentation',
5
onClose: () => {
6
// Does nothing
7
},
8
components: [
9
{
10
body: 'Check out this documentation!',
11
type: WhisperComponentType.Markdown,
12
},
13
{
14
href: 'https://www.oliveai.dev',
15
style: Urgency.None,
16
text: 'https://www.oliveai.dev',
17
textAlign: TextAlign.Left,
18
type: WhisperComponentType.Link,
19
},
20
],
21
};
22
23
whisper.create(whisperConfig);
Copied!
This will generate a Whisper that looks like this:
But this is just a brief explanation of a very simple use case. More examples can be found in the Whisper Updates or JSX Whispers articles.
To use the Whisper Aptitude, simply set the following permissions in your package.json under the ldk object.
Please see our Permissions page for more information.
1
...
2
"ldk": {
3
"permissions": {
4
"whisper": {},
5
...
6
}
7
},
8
...
Copied!
Copy link