slash_command.rs

 1use std::ops::Range;
 2
 3/// A slash command for use in the Assistant.
 4#[derive(Debug, Clone)]
 5pub struct SlashCommand {
 6    /// The name of the slash command.
 7    pub name: String,
 8    /// The description of the slash command.
 9    pub description: String,
10    /// The tooltip text to display for the run button.
11    pub tooltip_text: String,
12    /// Whether this slash command requires an argument.
13    pub requires_argument: bool,
14}
15
16/// The output of a slash command.
17#[derive(Debug, Clone)]
18pub struct SlashCommandOutput {
19    /// The text produced by the slash command.
20    pub text: String,
21    /// The list of sections to show in the slash command placeholder.
22    pub sections: Vec<SlashCommandOutputSection>,
23}
24
25/// A section in the slash command output.
26#[derive(Debug, Clone)]
27pub struct SlashCommandOutputSection {
28    /// The range this section occupies.
29    pub range: Range<usize>,
30    /// The label to display in the placeholder for this section.
31    pub label: String,
32}
33
34/// A completion for a slash command argument.
35#[derive(Debug, Clone)]
36pub struct SlashCommandArgumentCompletion {
37    /// The label to display for this completion.
38    pub label: String,
39    /// The new text that should be inserted into the command when this completion is accepted.
40    pub new_text: String,
41    /// Whether the command should be run when accepting this completion.
42    pub run_command: bool,
43}