From 9a7f3278efb3287db1001a230a05d4e16583cd2a Mon Sep 17 00:00:00 2001 From: Flameguy677 <89509641+Flameguy677@users.noreply.github.com> Date: Mon, 7 Aug 2023 21:09:30 +0530 Subject: [PATCH] Update __init__.py Added a "Response Time" feature which tells the user the amount of time elapsed during text generation in milliseconds --- lollms/apps/console/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lollms/apps/console/__init__.py b/lollms/apps/console/__init__.py index a5804cc..935e133 100644 --- a/lollms/apps/console/__init__.py +++ b/lollms/apps/console/__init__.py @@ -11,6 +11,7 @@ from typing import Callable from pathlib import Path import argparse import yaml +import time import sys class Conversation(LollmsApplication): @@ -178,6 +179,7 @@ Participating personalities: ump = self.config.discussion_prompt_separator +self.config.user_name+": " if self.config.use_user_name_in_discussions else self.personality.user_message_prefix if self.config.use_user_name_in_discussions: prompt = input(f"{ASCIIColors.color_green}{self.config.user_name}: {ASCIIColors.color_reset}") + t0 = time.time() #Time at start of request else: prompt = input(f"{ASCIIColors.color_green}You: {ASCIIColors.color_reset}") if prompt == "exit": @@ -271,6 +273,8 @@ Participating personalities: self.log(full_discussion) + t1 = time.time() # Time at end of defense + print(f"{ASCIIColors.color_cyan}Response Time: {ASCIIColors.color_reset}",str(int((t1-t0)*1000)),"ms\n") # Total time elapsed since t0 in ms except KeyboardInterrupt: print("Keyboard interrupt detected.\nBye") break @@ -320,4 +324,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main()