mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-13 22:02:56 +00:00
added sync notify
This commit is contained in:
parent
bbdd04e512
commit
ee8d670d0a
@ -804,6 +804,39 @@ class LollmsApplication(LoLLMsCom):
|
||||
else:
|
||||
ASCIIColors.red(content)
|
||||
|
||||
def sync_notify(
|
||||
self,
|
||||
content,
|
||||
notification_type: NotificationType = NotificationType.NOTIF_SUCCESS,
|
||||
duration: int = 4,
|
||||
client_id=None,
|
||||
display_type: NotificationDisplayType = NotificationDisplayType.TOAST,
|
||||
verbose: bool | None = None,
|
||||
):
|
||||
if verbose is None:
|
||||
verbose = self.verbose
|
||||
self.schedule_task(
|
||||
self.sio.emit(
|
||||
"notification",
|
||||
{
|
||||
"content": content,
|
||||
"notification_type": notification_type.value,
|
||||
"duration": duration,
|
||||
"display_type": display_type.value,
|
||||
},
|
||||
to=client_id,
|
||||
)
|
||||
)
|
||||
|
||||
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)
|
||||
async def refresh_files(self, client_id=None):
|
||||
await self.sio.emit("refresh_files", to=client_id)
|
||||
|
||||
|
@ -458,7 +458,7 @@ class LLMBinding:
|
||||
verbose=True
|
||||
):
|
||||
if self.lollmsCom:
|
||||
return self.lollmsCom.notify(content=content, notification_type=notification_type, duration=duration, client_id=client_id, display_type=display_type, verbose=verbose)
|
||||
return self.lollmsCom.sync_notify(content=content, notification_type=notification_type, duration=duration, client_id=client_id, display_type=display_type, verbose=verbose)
|
||||
ASCIIColors.white(content)
|
||||
|
||||
|
||||
|
@ -232,7 +232,28 @@ class LoLLMsCom:
|
||||
else:
|
||||
ASCIIColors.red(content)
|
||||
|
||||
def sync_notify(
|
||||
self,
|
||||
content,
|
||||
notification_type: NotificationType = NotificationType.NOTIF_SUCCESS,
|
||||
duration: int = 4,
|
||||
client_id=None,
|
||||
display_type: NotificationDisplayType = NotificationDisplayType.TOAST,
|
||||
verbose: bool | None = None,
|
||||
):
|
||||
if verbose is None:
|
||||
verbose = self.verbose
|
||||
|
||||
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)
|
||||
|
||||
async def notify_model_install(self,
|
||||
installation_path,
|
||||
model_name,
|
||||
|
Loading…
x
Reference in New Issue
Block a user