From 72db7d8104165e0b455bb08cddc4af5797a192e7 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Sun, 18 Jun 2023 22:06:28 +0200 Subject: [PATCH] updated personalities --- lollms/__init__.py | 3 +++ lollms/personalities_zoo | 2 +- lollms/server.py | 8 ++++++++ lollms/settings.py | 2 -- setup.py | 2 +- .../{test_connection.py => test_generation.py} | 0 6 files changed, 13 insertions(+), 4 deletions(-) rename tests/endoints_unit_tests/{test_connection.py => test_generation.py} (100%) diff --git a/lollms/__init__.py b/lollms/__init__.py index b65fdd5..72ab4be 100644 --- a/lollms/__init__.py +++ b/lollms/__init__.py @@ -79,6 +79,9 @@ class PersonalityBuilder: def build_personality(self, force_reinstall=False): + if self.config["active_personality_id"]>=len(self.config["personalities"]): + ASCIIColors.warning("Personality ID was out of range. Resetting to 0.") + self.config["active_personality_id"]=0 if len(self.config["personalities"][self.config["active_personality_id"]].split("/"))==3: self.personality = AIPersonality(self.lollms_paths, self.lollms_paths.personalities_zoo_path / self.config["personalities"][self.config["active_personality_id"]], self.model, force_reinstall= force_reinstall) else: diff --git a/lollms/personalities_zoo b/lollms/personalities_zoo index b8c304b..443582f 160000 --- a/lollms/personalities_zoo +++ b/lollms/personalities_zoo @@ -1 +1 @@ -Subproject commit b8c304b6336d80221ad9ccd9336130ff374601c0 +Subproject commit 443582f8bcba4d409cef4c80546fa5ece56e7ef9 diff --git a/lollms/server.py b/lollms/server.py index 5812e04..521c7e0 100644 --- a/lollms/server.py +++ b/lollms/server.py @@ -320,6 +320,12 @@ class LoLLMsServer: txt = self.current_model.detokenize(prompt) emit("detokenized", {"text":txt}) + @self.socketio.on('cancel_generation') + def cancel_generation(data): + client_id = request.sid + self.clients[client_id]["requested_stop"]=False + + @self.socketio.on('generate_text') def handle_generate_text(data): if not self.is_ready: @@ -516,6 +522,8 @@ class LoLLMsServer: personality = AIPersonality(self.lollms_paths, self.config.lollms_paths.personalities_zoo_path/p, self.current_model) self.personalities.append(personality) + if self.config.active_personality_id>len(self.personalities): + self.config.active_personality_id = 0 self.active_personality = self.personalities[self.config.active_personality_id] self.menu.show_logo() diff --git a/lollms/settings.py b/lollms/settings.py index 19a9965..7429b74 100644 --- a/lollms/settings.py +++ b/lollms/settings.py @@ -65,8 +65,6 @@ class Settings: if show_logo: self.menu.show_logo() - if show_commands_list: - self.menu.show_commands_list() if show_personality_infos: try: diff --git a/setup.py b/setup.py index 4526ee4..d3bcf43 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="1.2.0", + version="1.2.2", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition", diff --git a/tests/endoints_unit_tests/test_connection.py b/tests/endoints_unit_tests/test_generation.py similarity index 100% rename from tests/endoints_unit_tests/test_connection.py rename to tests/endoints_unit_tests/test_generation.py