Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
sigoden committed Oct 28, 2023
1 parent 08a0ca7 commit 2331d25
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@ temp).clear session
aichat --list-sessions # List sessions
aichat -s # Start with a new session
aichat -s rust # If session rust exists, use it. If it does not exist, create a new session.
aichat -s rust --info # Show session details
```

## License
Expand Down
5 changes: 2 additions & 3 deletions src/config/session.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub const TEMP_SESSION_NAME: &str = "temp";

#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Session {
pub path: Option<String>,
pub model: String,
pub tokens: usize,
pub messages: Vec<Message>,
Expand All @@ -19,20 +20,18 @@ pub struct Session {
pub role: Option<Role>,
#[serde(skip)]
pub name: String,
#[serde(skip)]
pub path: Option<String>,
}

impl Session {
pub fn new(name: &str, model: &str, role: Option<Role>) -> Self {
let mut value = Self {
path: None,
model: model.to_string(),
tokens: 0,
messages: vec![],
dirty: false,
role,
name: name.to_string(),
path: None,
};
value.update_tokens();
value
Expand Down

0 comments on commit 2331d25

Please sign in to comment.