diff --git a/lollms/personality.py b/lollms/personality.py index 6e22be2..a03c986 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -155,6 +155,12 @@ Date: {{date}} # Open and store the personality self.load_personality(personality_package_path) + def setCallback(self, callback: Callable[[str, int, dict], bool]): + self.callback = callback + if self._processor: + self._processor.callback = callback + + def __str__(self): return f"{self.language}/{self.category}/{self.name}" @@ -947,12 +953,7 @@ class APScript(StateMachine): self.models_folder = self.personality.lollms_paths.personal_models_path / self.personality.personality_folder_name self.models_folder.mkdir(parents=True, exist_ok=True) - def setCallback(self, callback: Callable[[str, int, dict], bool]): - self.callback = callback - if self.process: - self.process.callback = callback - - + def load_personality_config(self): """ Load the content of local_config.yaml file. diff --git a/lollms/utilities.py b/lollms/utilities.py index 0385bd2..14fc2cf 100644 --- a/lollms/utilities.py +++ b/lollms/utilities.py @@ -58,7 +58,8 @@ class Image64BitsManager: from PIL import Image import io import base64 - Image.open(io.BytesIO(base64.b64decode(b64img))) + image_data = re.sub('^data:image/.+;base64,', '', b64img) + return Image.open(io.BytesIO(base64.b64decode(image_data))) class TFIDFLoader: diff --git a/setup.py b/setup.py index 6854990..5e138c9 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="2.2.5", + version="2.2.7", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition",