This commit is contained in:
saloui 2023-12-11 09:27:04 +01:00
parent 150e7f3251
commit 84f676be95
2 changed files with 3 additions and 76 deletions

View File

@ -225,80 +225,6 @@ class LollmsApplication(LoLLMsCom):
generated_text = self.personality.model.generate(full_discussion, n_predict=n_predict, callback=callback)
return generated_text
def InfoMessage(self, content, duration:int=4, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_SUCCESS,
duration=duration,
client_id=client_id,
display_type=NotificationDisplayType.MESSAGE_BOX,
verbose=verbose
)
def info(self, content, duration:int=4, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_SUCCESS,
duration=duration,
client_id=client_id,
display_type=NotificationDisplayType.TOAST,
verbose=verbose
)
def warning(self, content, duration:int=4, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_WARNING,
duration=duration,
client_id=client_id,
display_type=NotificationDisplayType.TOAST,
verbose=verbose
)
def success(self, content, duration:int=4, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_SUCCESS,
duration=duration,
client_id=client_id,
display_type=NotificationDisplayType.TOAST,
verbose=verbose
)
def error(self, content, duration:int=4, client_id=None):
self.notify(
content,
notification_type=NotificationType.NOTIF_ERROR,
duration=duration,
client_id=client_id,
display_type=NotificationDisplayType.TOAST
)
def notify(
self,
content,
notification_type:NotificationType=NotificationType.NOTIF_SUCCESS,
duration:int=4,
client_id=None,
display_type:NotificationDisplayType=NotificationDisplayType.TOAST,
verbose=True
):
if verbose:
if notification_type==NotificationType.NOTIF_SUCCESS:
ASCIIColors.success(content)
elif notification_type==NotificationType.NOTIF_INFO:
ASCIIColors.info(content)
elif notification_type==NotificationType.NOTIF_WARNING:
ASCIIColors.warning(content)
else:
ASCIIColors.red(content)
def load_binding(self):
try:
binding = BindingBuilder().build_binding(self.config, self.lollms_paths, lollmsCom=self)

View File

@ -68,13 +68,14 @@ class LoLLMsCom:
verbose=verbose
)
def error(self, content, duration:int=4, client_id=None):
def error(self, content, duration:int=4, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_ERROR,
duration=duration,
client_id=client_id,
display_type=NotificationDisplayType.TOAST
display_type=NotificationDisplayType.TOAST,
verbose = verbose
)