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:
Marshall Bowers 2024-08-08 17:07:42 -04:00 committed by GitHub
parent 5b8ce91048
commit 2bc503771b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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,