From 05d20f207fedf03c2a564438a0d44a2d85d4ed2d Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 9 Mar 2023 15:30:39 +0800 Subject: feat: add remain tokens indicator and max tokens guard (#50) --- src/repl/init.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/repl/init.rs') diff --git a/src/repl/init.rs b/src/repl/init.rs index a14265c..faafd9d 100644 --- a/src/repl/init.rs +++ b/src/repl/init.rs @@ -135,7 +135,12 @@ impl Prompt for ReplPrompt { } fn render_prompt_right(&self) -> Cow { - Cow::Borrowed("") + let config = self.0.lock(); + if let Some(conversation) = config.conversation.as_ref() { + conversation.reamind_tokens().to_string().into() + } else { + Cow::Borrowed("") + } } fn render_prompt_indicator(&self, _prompt_mode: reedline::PromptEditMode) -> Cow { -- cgit v1.2.3