multiple upgrades

This commit is contained in:
Saifeddine ALOUI 2023-06-23 00:35:39 +02:00
parent ac93bc0344
commit cdcc2801b5
5 changed files with 25 additions and 4 deletions

View File

@ -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

View File

@ -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:

View File

@ -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

View File

@ -895,6 +895,16 @@ class APScript:
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

View File

@ -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",