enhanced tti integration

This commit is contained in:
Saifeddine ALOUI 2024-06-01 14:10:12 +02:00
parent 163f90138d
commit 8319b7bcda
7 changed files with 17 additions and 25 deletions

View File

@ -2568,23 +2568,6 @@ class APScript(StateMachine):
if callback: if callback:
callback(warning, MSG_TYPE.MSG_TYPE_EXCEPTION) callback(warning, MSG_TYPE.MSG_TYPE_EXCEPTION)
def info(self, info:str, callback: Callable[[str, MSG_TYPE, dict, list], bool]=None):
"""This sends exception to the client
Args:
inf (str): The information to be sent
callback (callable, optional): A callable with this signature (str, MSG_TYPE, dict, list) to send the step to. Defaults to None.
The callback has these fields:
- chunk
- Message Type : the type of message
- Parameters (optional) : a dictionary of parameters
- Metadata (optional) : a list of metadata
"""
if not callback and self.callback:
callback = self.callback
if callback:
callback(info, MSG_TYPE.MSG_TYPE_INFO)
def json(self, title:str, json_infos:dict, callback: Callable[[str, int, dict, list], bool]=None, indent=4): def json(self, title:str, json_infos:dict, callback: Callable[[str, int, dict, list], bool]=None, indent=4):
"""This sends json data to front end """This sends json data to front end
@ -3198,6 +3181,15 @@ The AI should respond in this format using data from actions_list:
) )
def InfoMessage(self, content, client_id=None, verbose:bool=None):
self.personality.app.notify(
content,
notification_type=NotificationType.NOTIF_SUCCESS,
duration=0,
client_id=client_id,
display_type=NotificationDisplayType.MESSAGE_BOX,
verbose=verbose
)
def info(self, info_text:str, callback: Callable[[str, MSG_TYPE, dict, list], bool]=None): def info(self, info_text:str, callback: Callable[[str, MSG_TYPE, dict, list], bool]=None):
"""This sends info text to front end """This sends info text to front end

View File

@ -43,7 +43,7 @@ class LollmsDalle(LollmsTTI):
generation_engine="dall-e-3",# other possibility "dall-e-2" generation_engine="dall-e-3",# other possibility "dall-e-2"
output_path=None output_path=None
): ):
super().__init__(app) super().__init__(generation_engine,app)
self.key = key self.key = key
self.generation_engine = generation_engine self.generation_engine = generation_engine
self.output_path = output_path self.output_path = output_path

View File

@ -93,7 +93,7 @@ class LollmsDiffusers(LollmsTTI):
app:LollmsApplication, app:LollmsApplication,
wm = "Artbot", wm = "Artbot",
): ):
super().__init__(app) super().__init__("diffusers",app)
self.ready = False self.ready = False
# Get the current directory # Get the current directory
lollms_paths = app.lollms_paths lollms_paths = app.lollms_paths

View File

@ -92,7 +92,7 @@ class LollmsFooocus(LollmsTTI):
wm = "Artbot", wm = "Artbot",
base_url="localhost:1024" base_url="localhost:1024"
): ):
super().__init__(app) super().__init__("fooocus",app)
self.ready = False self.ready = False
self.base_url = base_url self.base_url = base_url
# Get the current directory # Get the current directory

View File

@ -40,12 +40,10 @@ class LollmsMidjourney(LollmsTTI):
self, self,
app:LollmsApplication, app:LollmsApplication,
key="", key="",
generation_engine="dall-e-3",# other possibility "dall-e-2"
output_path=None output_path=None
): ):
super().__init__(app) super().__init__("midjourney",app)
self.key = key self.key = key
self.generation_engine = generation_engine
self.output_path = output_path self.output_path = output_path
def paint( def paint(

View File

@ -256,7 +256,7 @@ class LollmsSD(LollmsTTI):
share=False, share=False,
wait_for_service=True wait_for_service=True
): ):
super().__init__(app) super().__init__("stable_diffusion",app)
if auto_sd_base_url=="" or auto_sd_base_url=="http://127.0.0.1:7860": if auto_sd_base_url=="" or auto_sd_base_url=="http://127.0.0.1:7860":
auto_sd_base_url = None auto_sd_base_url = None
self.ready = False self.ready = False

View File

@ -26,6 +26,7 @@ class LollmsTTI:
def __init__( def __init__(
self, self,
name:str,
app: LollmsApplication, app: LollmsApplication,
model="", model="",
api_key="", api_key="",
@ -41,6 +42,7 @@ class LollmsTTI:
output_path (Path or str, optional): Path where the output image files will be saved. Defaults to None. output_path (Path or str, optional): Path where the output image files will be saved. Defaults to None.
""" """
self.ready = False self.ready = False
self.name = name
self.app = app self.app = app
self.model = model self.model = model
self.api_key = api_key self.api_key = api_key