summaryrefslogtreecommitdiffstats
path: root/src/config/conversation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/config/conversation.rs')
-rw-r--r--src/config/conversation.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/config/conversation.rs b/src/config/conversation.rs
index 7fe843d..93382a3 100644
--- a/src/config/conversation.rs
+++ b/src/config/conversation.rs
@@ -33,6 +33,13 @@ impl Conversation {
Ok(())
}
+ pub fn can_clear_role(&self) -> Result<()> {
+ if self.messages.is_empty() {
+ return Ok(());
+ }
+ bail!("Error: Cannot perform this action in the middle of conversation")
+ }
+
pub fn update_tokens(&mut self) {
self.tokens = num_tokens_from_messages(&self.build_emssages(""));
}