assistant2: Allow removing individual context (#21868)
This PR adds the ability to remove individual pieces of context from the message editor: <img width="1159" alt="Screenshot 2024-12-11 at 12 38 45 PM" src="https://github.com/user-attachments/assets/77d04272-f667-4ebb-a567-84b382afef3d" /> Release Notes: - N/A
This commit is contained in:
parent
124e63d07c
commit
b3ffbea376
3 changed files with 65 additions and 18 deletions
|
@ -1,8 +1,20 @@
|
|||
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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue