Display character limit warnings based on current conversation size
(&mut self, os: &Os)
| 3652 | |
| 3653 | /// Display character limit warnings based on current conversation size |
| 3654 | async fn display_char_warnings(&mut self, os: &Os) -> Result<(), ChatError> { |
| 3655 | let warning_level = self.conversation.get_token_warning_level(os).await?; |
| 3656 | |
| 3657 | match warning_level { |
| 3658 | TokenWarningLevel::Critical => { |
| 3659 | // Memory constraint warning with gentler wording |
| 3660 | execute!( |
| 3661 | self.stderr, |
| 3662 | StyledText::warning_fg(), |
| 3663 | style::SetAttribute(Attribute::Bold), |
| 3664 | style::Print("\n⚠️ This conversation is getting lengthy.\n"), |
| 3665 | StyledText::reset_attributes(), |
| 3666 | style::Print( |
| 3667 | "To ensure continued smooth operation, please use /compact to summarize the conversation.\n\n" |
| 3668 | ), |
| 3669 | StyledText::reset(), |
| 3670 | )?; |
| 3671 | }, |
| 3672 | TokenWarningLevel::None => { |
| 3673 | // No warning needed |
| 3674 | }, |
| 3675 | } |
| 3676 | |
| 3677 | Ok(()) |
| 3678 | } |
| 3679 | |
| 3680 | /// Resets state associated with the active user turn. |
| 3681 | /// |
no test coverage detected