This PR adds the ability to fetch URLs as context in Assistant2. In the picker we use the search area as an input for the user to enter the URL they wish to fetch: <img width="1159" alt="Screenshot 2024-12-13 at 2 45 41 PM" src="https://github.com/user-attachments/assets/b3b20648-2c22-4509-b592-d0291d25b202" /> <img width="1159" alt="Screenshot 2024-12-13 at 2 45 47 PM" src="https://github.com/user-attachments/assets/7e6bab2d-2731-467f-9781-130c6e4ea5cf" /> Release Notes: - N/A
28 lines
620 B
Rust
28 lines
620 B
Rust
use gpui::SharedString;
|
|
use serde::{Deserialize, Serialize};
|
|
use util::post_inc;
|
|
|
|
#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone, Copy, Serialize, Deserialize)]
|
|
pub struct ContextId(pub(crate) usize);
|
|
|
|
impl ContextId {
|
|
pub fn post_inc(&mut self) -> Self {
|
|
Self(post_inc(&mut self.0))
|
|
}
|
|
}
|
|
|
|
/// Some context attached to a message in a thread.
|
|
#[derive(Debug, Clone)]
|
|
pub struct Context {
|
|
pub id: ContextId,
|
|
pub name: SharedString,
|
|
pub kind: ContextKind,
|
|
pub text: SharedString,
|
|
}
|
|
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub enum ContextKind {
|
|
File,
|
|
FetchedUrl,
|
|
}
|