assistant: Show an error when /fetch
returns no content (#16001)
This PR makes it so the `/fetch` slash command will display an error when the URL does not have any textual content: <img width="308" alt="Screenshot 2024-08-08 at 4 51 55 PM" src="https://github.com/user-attachments/assets/bf4cbc18-c65b-48a2-aedd-26b50f47f018"> Release Notes: - N/A
This commit is contained in:
parent
5b8ce91048
commit
2bc503771b
1 changed files with 4 additions and 0 deletions
|
@ -150,6 +150,10 @@ impl SlashCommand for FetchSlashCommand {
|
|||
let url = SharedString::from(url);
|
||||
cx.foreground_executor().spawn(async move {
|
||||
let text = text.await?;
|
||||
if text.trim().is_empty() {
|
||||
bail!("no textual content found");
|
||||
}
|
||||
|
||||
let range = 0..text.len();
|
||||
Ok(SlashCommandOutput {
|
||||
text,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue