mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-09 03:44:14 +00:00
Added "Show Time Elapsed" option
Enables the User to choose whether or not they see the time elapsed after each generation by configuring it in lollms-settings under "Main settings"
This commit is contained in:
parent
26a76f4bf6
commit
9af486520c
@ -179,9 +179,10 @@ 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 self.config.show_time_elapsed:
|
||||
t0 = time.time() #Time at start of request
|
||||
if prompt == "exit":
|
||||
return
|
||||
if prompt == "menu":
|
||||
@ -273,8 +274,9 @@ 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
|
||||
if self.config.show_time_elapsed:
|
||||
t1 = time.time() # Time at end of response
|
||||
print(f"{ASCIIColors.color_cyan}Time Elapsed: {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
|
||||
|
@ -144,6 +144,7 @@ class MainMenu(Menu):
|
||||
self.show([
|
||||
{'name': 'Set user name', 'fn': self.set_user_name, 'help': "Sets the user name."},
|
||||
{'name': 'Set use user name in discussion', 'fn': self.set_use_user_name_in_discussions, 'help': "Sets the user name."},
|
||||
{'name': 'Set show time elapsed', 'fn':self.set_time_elapsed, 'help': "Sets showing time taken for each complete response."}
|
||||
])
|
||||
|
||||
def set_user_name(self):
|
||||
@ -156,6 +157,11 @@ class MainMenu(Menu):
|
||||
self.lollms_app.config.use_user_name_in_discussions = self.yes_no_question('Use user name in dicsussion')
|
||||
self.lollms_app.config.save_config()
|
||||
|
||||
def set_time_elapsed(self):
|
||||
|
||||
self.lollms_app.config.show_time_elapsed = self.yes_no_question('Show time elapsed for each complete response')
|
||||
self.lollms_app.config.save_config()
|
||||
|
||||
def show_logo(self):
|
||||
print(f"{ASCIIColors.color_bright_yellow}")
|
||||
print(" ___ ___ ___ ___ ___ ___ ")
|
||||
|
Loading…
x
Reference in New Issue
Block a user