From cdcc2801b5c46e963ee8108d8d1712dcf263fd78 Mon Sep 17 00:00:00 2001 From: Saifeddine ALOUI Date: Fri, 23 Jun 2023 00:35:39 +0200 Subject: [PATCH] multiple upgrades --- lollms/binding.py | 2 +- lollms/console.py | 11 ++++++++++- lollms/paths.py | 2 ++ lollms/personality.py | 12 +++++++++++- setup.py | 2 +- 5 files changed, 25 insertions(+), 4 deletions(-) diff --git a/lollms/binding.py b/lollms/binding.py index 670726a..096d3f7 100644 --- a/lollms/binding.py +++ b/lollms/binding.py @@ -182,7 +182,7 @@ class LLMBinding: def list_models(self, config:dict): """Lists the models for this binding """ - models_dir = self.lollms_paths.bindings_zoo_path/config["binding_name"] # replace with the actual path to the models folder + models_dir = self.lollms_paths.personal_models_path/config["binding_name"] # replace with the actual path to the models folder return [f.name for f in models_dir.glob(self.file_extension)] @staticmethod diff --git a/lollms/console.py b/lollms/console.py index 5e1c8de..de40990 100644 --- a/lollms/console.py +++ b/lollms/console.py @@ -16,6 +16,12 @@ class LollmsApplication: def __init__(self, config:LOLLMSConfig, lollms_paths:LollmsPaths) -> None: self.config = config self.lollms_paths = lollms_paths + def load_binding(self): + pass + def load_model(self): + pass + def load_personality(self): + pass def reset_all_installs(lollms_paths:LollmsPaths): @@ -84,7 +90,7 @@ class MainMenu: print() print(f"{ASCIIColors.color_green}Current binding: {ASCIIColors.color_reset}{self.lollms_app.config['binding_name']}") for p in self.lollms_app.lollms_paths.bindings_zoo_path.iterdir(): - if p.is_dir(): + if p.is_dir() and not p.stem.startswith("."): with open(p/"binding_card.yaml", "r") as f: card = yaml.safe_load(f) with open(p/"models.yaml", "r") as f: @@ -116,8 +122,10 @@ class MainMenu: print() print(f"{ASCIIColors.color_green}Current binding: {ASCIIColors.color_reset}{self.lollms_app.config['binding_name']}") print(f"{ASCIIColors.color_green}Current model: {ASCIIColors.color_reset}{self.lollms_app.config['model_name']}") + models_dir:Path = (self.lollms_app.lollms_paths.personal_models_path/self.lollms_app.config['binding_name']) models_dir.mkdir(parents=True, exist_ok=True) + if hasattr(self.lollms_app,"binding") and hasattr(self.lollms_app.binding,"list_models"): models_list = [f'{v["filename"]} (by {v["owner"]})' for v in self.lollms_app.binding.list_models(self.lollms_app.config)] + ["Install model", "Change binding", "Back"] else: @@ -139,6 +147,7 @@ class MainMenu: print("Invalid choice!") def install_model(self): + models_list = ["Install model from internet","Install model from local file","Back"] choice = self.show_menu(models_list) if 1 <= choice <= len(models_list)-2: diff --git a/lollms/paths.py b/lollms/paths.py index 3c80395..9a03d6b 100644 --- a/lollms/paths.py +++ b/lollms/paths.py @@ -35,6 +35,7 @@ class LollmsPaths: self.personal_data_path = personal_path / "data" self.personal_databases_path = personal_path / "databases" self.personal_models_path = personal_path / "models" + self.personal_uploads_path = lollms_path / "uploads" self.personal_log_path = lollms_path / "logs" @@ -55,6 +56,7 @@ class LollmsPaths: self.personal_data_path.mkdir(parents=True, exist_ok=True) self.personal_databases_path.mkdir(parents=True, exist_ok=True) self.personal_log_path.mkdir(parents=True, exist_ok=True) + self.personal_uploads_path.mkdir(parents=True, exist_ok=True) if not self.personalities_zoo_path.exists(): # Clone the repository to the target path diff --git a/lollms/personality.py b/lollms/personality.py index 39a4bd7..563e550 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -894,7 +894,17 @@ class APScript: ASCIIColors.blue("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*") ASCIIColors.red(f"Installing {self.personality.personality_folder_name}") ASCIIColors.blue("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*") - + + + def uninstall(self): + """ + Installation procedure (to be implemented) + """ + ASCIIColors.blue("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*") + ASCIIColors.red(f"Uninstalling {self.personality.personality_folder_name}") + ASCIIColors.blue("*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*") + + def add_file(self, path): self.files.append(path) return True diff --git a/setup.py b/setup.py index 6df2185..6082721 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="2.0.19", + version="2.0.21", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition",