upgraded binding

This commit is contained in:
Saifeddine ALOUI 2023-12-29 01:43:15 +01:00
parent f1fd6521e3
commit ea95b5afff
3 changed files with 52 additions and 5 deletions

View File

@ -109,11 +109,20 @@ class LLMBinding:
{"name":"vqa_model_name","type":"str","value":'Salesforce/blip-vqa-capfilt-large','options':['Salesforce/blip-vqa-capfilt-large', 'Salesforce/blip-vqa-base', 'Salesforce/blip-image-captioning-large','Salesforce/blip2-opt-2.7b', 'Salesforce/blip2-flan-t5-xxl'], "help":"Salesforce question/answer model"},
])
def InfoMessage(self, content, duration:int=4, client_id=None, verbose:bool=True):
def InfoMessage(self, content, client_id=None, verbose:bool=True):
if self.lollmsCom:
return self.lollmsCom.InfoMessage(content=content, duration=duration, client_id=client_id, verbose=verbose)
return self.lollmsCom.InfoMessage(content=content, client_id=client_id, verbose=verbose)
ASCIIColors.white(content)
def ShowBlockingMessage(self, content, client_id=None, verbose:bool=True):
if self.lollmsCom:
return self.lollmsCom.ShowBlockingMessage(content=content, client_id=client_id, verbose=verbose)
ASCIIColors.white(content)
def HideBlockingMessage(self, client_id=None, verbose:bool=True):
if self.lollmsCom:
return self.lollmsCom.HideBlockingMessage(client_id=client_id, verbose=verbose)
def info(self, content, duration:int=4, client_id=None, verbose:bool=True):
if self.lollmsCom:
return self.lollmsCom.info(content=content, duration=duration, client_id=client_id, verbose=verbose)

View File

@ -28,19 +28,47 @@ class NotificationDisplayType(Enum):
YESNO_MESSAGE = 2
"""This is a yes not messagebox."""
SHOW_BLOCKING_MESSAGE = 3
"""This shows a blocking messagebox."""
HIDE_BLOCKING_MESSAGE = 4
"""This hides a blocking messagebox."""
class LoLLMsCom:
def __init__(self, socketio:SocketIO=None) -> None:
self.socketio= socketio
def InfoMessage(self, content, duration:int=4, client_id=None, verbose:bool=True):
def InfoMessage(self, content, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_SUCCESS,
duration=duration,
duration=0,
client_id=client_id,
display_type=NotificationDisplayType.MESSAGE_BOX,
verbose=verbose
)
def ShowBlockingMessage(self, content, client_id=None, verbose:bool=True):
self.notify(
content,
notification_type=NotificationType.NOTIF_SUCCESS,
duration=0,
client_id=client_id,
display_type=NotificationDisplayType.SHOW_BLOCKING_MESSAGE,
verbose=verbose
)
def HideBlockingMessage(self, client_id=None, verbose:bool=True):
self.notify(
"",
notification_type=NotificationType.NOTIF_SUCCESS,
duration=0,
client_id=client_id,
display_type=NotificationDisplayType.HIDE_BLOCKING_MESSAGE,
verbose=verbose
)
def YesNoMessage(self, content, duration:int=4, client_id=None, verbose:bool=True):
infos={

View File

@ -200,9 +200,19 @@ Date: {{date}}
def InfoMessage(self, content, duration:int=4, client_id=None, verbose:bool=True):
if self.app:
return self.app.InfoMessage(content=content, duration=duration, client_id=client_id, verbose=verbose)
return self.app.InfoMessage(content=content, client_id=client_id, verbose=verbose)
ASCIIColors.white(content)
def ShowBlockingMessage(self, content, client_id=None, verbose:bool=True):
if self.lollmsCom:
return self.app.ShowBlockingMessage(content=content, client_id=client_id, verbose=verbose)
ASCIIColors.white(content)
def HideBlockingMessage(self, client_id=None, verbose:bool=True):
if self.lollmsCom:
return self.app.HideBlockingMessage(client_id=client_id, verbose=verbose)
def info(self, content, duration:int=4, client_id=None, verbose:bool=True):
if self.app:
return self.app.info(content=content, duration=duration, client_id=client_id, verbose=verbose)