diff options
| author | sigoden <sigoden@gmail.com> | 2023-03-09 22:47:10 +0800 |
|---|---|---|
| committer | sigoden <sigoden@gmail.com> | 2023-03-09 22:53:25 +0800 |
| commit | ad282ae74c29bb96a213f2d02412f080bc2ce938 (patch) | |
| tree | c8f903cdb177b5580c18365c42ca3727ba0fdf12 /src | |
| parent | 89eaf1b65322e6b24f3dd70525216bfdc03f3915 (diff) | |
| download | aichat-ad282ae74c29bb96a213f2d02412f080bc2ce938.tar.gz | |
refactor: no need to confirm conversation when token used out
Diffstat (limited to 'src')
| -rw-r--r-- | src/config/mod.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/config/mod.rs b/src/config/mod.rs index 46ae84f..2c96161 100644 --- a/src/config/mod.rs +++ b/src/config/mod.rs @@ -308,12 +308,14 @@ impl Config { } pub fn start_conversation(&mut self) -> Result<()> { - if self.conversation.is_some() { - let ans = Confirm::new("Already in a conversation, start a new one?") - .with_default(true) - .prompt()?; - if !ans { - return Ok(()); + if let Some(conversation) = self.conversation.as_ref() { + if conversation.reamind_tokens() > 0 { + let ans = Confirm::new("Already in a conversation, start a new one?") + .with_default(true) + .prompt()?; + if !ans { + return Ok(()); + } } } self.conversation = Some(Conversation::new(self.role.clone())); |
