Don't include prompt titles / "Default Prompt:" in slash command output (#13139)
This only includes a newline to ensure there's always something to fold. Release Notes: - N/A
This commit is contained in:
parent
d5735dab9a
commit
78091fa91e
2 changed files with 9 additions and 2 deletions
|
@ -53,7 +53,7 @@ impl SlashCommand for DefaultSlashCommand {
|
||||||
let prompts = store.default_prompt_metadata();
|
let prompts = store.default_prompt_metadata();
|
||||||
|
|
||||||
let mut text = String::new();
|
let mut text = String::new();
|
||||||
writeln!(text, "Default Prompt:").unwrap();
|
text.push('\n');
|
||||||
for prompt in prompts {
|
for prompt in prompts {
|
||||||
if let Some(title) = prompt.title {
|
if let Some(title) = prompt.title {
|
||||||
writeln!(text, "/prompt {}", title).unwrap();
|
writeln!(text, "/prompt {}", title).unwrap();
|
||||||
|
@ -61,6 +61,10 @@ impl SlashCommand for DefaultSlashCommand {
|
||||||
}
|
}
|
||||||
text.pop();
|
text.pop();
|
||||||
|
|
||||||
|
if text.is_empty() {
|
||||||
|
text.push('\n');
|
||||||
|
}
|
||||||
|
|
||||||
Ok(SlashCommandOutput {
|
Ok(SlashCommandOutput {
|
||||||
sections: vec![SlashCommandOutputSection {
|
sections: vec![SlashCommandOutputSection {
|
||||||
range: 0..text.len(),
|
range: 0..text.len(),
|
||||||
|
|
|
@ -69,7 +69,10 @@ impl SlashCommand for PromptSlashCommand {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
cx.foreground_executor().spawn(async move {
|
cx.foreground_executor().spawn(async move {
|
||||||
let prompt = prompt.await?;
|
let mut prompt = prompt.await?;
|
||||||
|
if prompt.is_empty() {
|
||||||
|
prompt.push('\n');
|
||||||
|
}
|
||||||
let range = 0..prompt.len();
|
let range = 0..prompt.len();
|
||||||
Ok(SlashCommandOutput {
|
Ok(SlashCommandOutput {
|
||||||
text: prompt,
|
text: prompt,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue