Cycle message roles on click

Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
Antonio Scandurra 2023-06-06 18:45:08 +02:00
parent ac7178068f
commit ef7ec265c8
4 changed files with 106 additions and 51 deletions

View file

@ -34,6 +34,16 @@ enum Role {
System,
}
impl Role {
pub fn cycle(&mut self) {
*self = match self {
Role::User => Role::Assistant,
Role::Assistant => Role::System,
Role::System => Role::User,
}
}
}
impl Display for Role {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> std::fmt::Result {
match self {