Skip to content

Commit

Permalink
assistant: Show an error when /fetch returns no content (#16001)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
maxdeviant authored Aug 8, 2024
1 parent 5b8ce91 commit 2bc5037
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions crates/assistant/src/slash_command/fetch_command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 2bc5037

Please sign in to comment.