assistant: Add /fetch slash command (#12645)

This PR adds a new `/fetch` slash command to the Assistant for fetching
the content of an arbitrary URL as Markdown.

Currently it's just using the same HTML to Markdown conversion that
`/rustdoc` uses, but I'll be working to refine the output to be more
widely useful.

Release Notes:

- N/A
This commit is contained in:
Marshall Bowers 2024-06-04 11:56:23 -04:00 committed by GitHub
parent 910f668f4d
commit e4bb666eab
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 163 additions and 10 deletions

View file

@ -25,8 +25,8 @@ use semantic_index::{CloudEmbeddingProvider, SemanticIndex};
use serde::{Deserialize, Serialize};
use settings::{Settings, SettingsStore};
use slash_command::{
active_command, file_command, project_command, prompt_command, rustdoc_command, search_command,
tabs_command,
active_command, fetch_command, file_command, project_command, prompt_command, rustdoc_command,
search_command, tabs_command,
};
use std::{
fmt::{self, Display},
@ -304,6 +304,7 @@ fn register_slash_commands(cx: &mut AppContext) {
slash_command_registry.register_command(project_command::ProjectSlashCommand, true);
slash_command_registry.register_command(search_command::SearchSlashCommand, true);
slash_command_registry.register_command(rustdoc_command::RustdocSlashCommand, false);
slash_command_registry.register_command(fetch_command::FetchSlashCommand, false);
let store = PromptStore::global(cx);
cx.background_executor()