Add command interface and status indicator.

This commit is contained in:
Drew 2026-02-24 14:23:33 -08:00
parent 5cb6647513
commit 7b9525ef95
7 changed files with 358 additions and 22 deletions

View file

@ -34,6 +34,11 @@ impl ConversationHistory {
pub fn messages(&self) -> &[ConversationMessage] {
&self.messages
}
/// Remove all messages from the history.
pub fn clear(&mut self) {
self.messages.clear();
}
}
impl Default for ConversationHistory {
@ -73,6 +78,17 @@ mod tests {
assert_eq!(msgs[1].content, "hi there");
}
#[test]
fn clear_empties_history() {
let mut history = ConversationHistory::new();
history.push(ConversationMessage {
role: Role::User,
content: "hello".to_string(),
});
history.clear();
assert!(history.messages().is_empty());
}
#[test]
fn messages_preserves_insertion_order() {
let mut history = ConversationHistory::new();