This commit is contained in:
Saifeddine ALOUI 2023-06-15 20:22:22 +02:00
commit a68eb96c53
5 changed files with 35 additions and 26 deletions

View File

@ -79,6 +79,7 @@ class LOLLMSConfig(BaseConfig):
self.lollms_paths = LollmsPaths() self.lollms_paths = LollmsPaths()
else: else:
self.lollms_paths = lollms_paths self.lollms_paths = lollms_paths
@staticmethod @staticmethod
def autoload(lollms_paths, config_path:str=None): def autoload(lollms_paths, config_path:str=None):
@ -103,6 +104,7 @@ class LOLLMSConfig(BaseConfig):
config.save_config(cfg_path) config.save_config(cfg_path)
else: else:
config = LOLLMSConfig() config = LOLLMSConfig()
return config return config
def sync_cfg(self, default_config): def sync_cfg(self, default_config):

View File

@ -1,6 +1,6 @@
# =================== Lord Of Large Language Models Configuration file =========================== # =================== Lord Of Large Language Models Configuration file ===========================
version: 6 version: 6
binding_name: llama_cpp_official binding_name: c_transformers
model_name: null model_name: null
# Host information # Host information

View File

@ -265,6 +265,9 @@ class Conversation:
# Configuration loading part # Configuration loading part
self.config = LOLLMSConfig.autoload(self.lollms_paths, configuration_path) self.config = LOLLMSConfig.autoload(self.lollms_paths, configuration_path)
if self.config.model_name is None:
self.menu.select_model(self)
# load binding # load binding
@ -332,7 +335,7 @@ class Conversation:
if Path(file_name).is_absolute(): if Path(file_name).is_absolute():
self.log_file_path = Path(file_name) self.log_file_path = Path(file_name)
else: else:
home_dir = Path.home()/"Documents/lollms/logs" home_dir = self.lollms_paths.personal_log_path
home_dir.mkdir(parents=True, exist_ok=True) home_dir.mkdir(parents=True, exist_ok=True)
self.log_file_path = home_dir/file_name self.log_file_path = home_dir/file_name
if self.log_file_path.exists(): if self.log_file_path.exists():

View File

@ -34,6 +34,7 @@ class LollmsPaths:
self.personal_databases_path = personal_path / "databases" self.personal_databases_path = personal_path / "databases"
self.personal_models_path = personal_path / "models" self.personal_models_path = personal_path / "models"
self.personal_personalities_path = lollms_path / "personalities" self.personal_personalities_path = lollms_path / "personalities"
self.personal_log_path = lollms_path / "logs"
self.create_directories() self.create_directories()
@ -49,7 +50,7 @@ class LollmsPaths:
self.personal_data_path.mkdir(parents=True, exist_ok=True) self.personal_data_path.mkdir(parents=True, exist_ok=True)
self.personal_databases_path.mkdir(parents=True, exist_ok=True) self.personal_databases_path.mkdir(parents=True, exist_ok=True)
self.personal_personalities_path.mkdir(parents=True, exist_ok=True) self.personal_personalities_path.mkdir(parents=True, exist_ok=True)
self.personal_log_path.mkdir(parents=True, exist_ok=True)
def copy_default_config(self): def copy_default_config(self):
local_config_path = self.personal_configuration_path / "local_config.yaml" local_config_path = self.personal_configuration_path / "local_config.yaml"
@ -100,30 +101,33 @@ class LollmsPaths:
print(f"To make it clear where your data are stored, we now give the user the choice where to put its data.") print(f"To make it clear where your data are stored, we now give the user the choice where to put its data.")
print(f"This allows you to mutualize models which are heavy, between multiple lollms compatible apps.") print(f"This allows you to mutualize models which are heavy, between multiple lollms compatible apps.")
print(f"You can change this at any tome using the lollms-update_path script or by simply change the content of the global_paths_cfg.yaml file.") print(f"You can change this at any tome using the lollms-update_path script or by simply change the content of the global_paths_cfg.yaml file.")
print(f"Please provide a folder to store your configurations files, your models and your personal data (database, custom personalities etc).") found = False
cfg = BaseConfig(config={ while not found:
"lollms_path":str(Path(__file__).parent), print(f"Please provide a folder to store your configurations files, your models and your personal data (database, custom personalities etc).")
"lollms_personal_path":str(Path.home()/"Documents/lollms") cfg = BaseConfig(config={
}) "lollms_path":str(Path(__file__).parent),
"lollms_personal_path":str(Path.home()/"Documents/lollms")
})
cfg.lollms_personal_path = input(f"Folder path: ({cfg.lollms_personal_path}):") cfg.lollms_personal_path = input(f"Folder path: ({cfg.lollms_personal_path}):")
if cfg.lollms_personal_path=="": if cfg.lollms_personal_path=="":
cfg.lollms_personal_path = str(Path.home()/"Documents/lollms") cfg.lollms_personal_path = str(Path.home()/"Documents/lollms")
print(f"Selected: {cfg.lollms_personal_path}") print(f"Selected: {cfg.lollms_personal_path}")
pp= Path(cfg.lollms_personal_path) pp= Path(cfg.lollms_personal_path)
if not pp.exists(): if not pp.exists():
try: try:
pp.mkdir(parents=True) pp.mkdir(parents=True)
except: except:
print(f"{ASCIIColors.color_red}It seams there is an error in the path you rovided{ASCIIColors.color_reset}") print(f"{ASCIIColors.color_red}It seams there is an error in the path you rovided{ASCIIColors.color_reset}")
return None continue
if force_local: if force_local:
global_paths_cfg = Path("./global_paths_cfg.yaml") global_paths_cfg = Path("./global_paths_cfg.yaml")
else: else:
global_paths_cfg = lollms_path/"global_paths_cfg.yaml" global_paths_cfg = lollms_path/"global_paths_cfg.yaml"
cfg.save_config(global_paths_cfg) cfg.save_config(global_paths_cfg)
found = True
return LollmsPaths(cfg.lollms_path, cfg.lollms_personal_path, custom_default_cfg_path=custom_default_cfg_path) return LollmsPaths(cfg.lollms_path, cfg.lollms_personal_path, custom_default_cfg_path=custom_default_cfg_path)

View File

@ -26,7 +26,7 @@ def get_all_files(path):
setuptools.setup( setuptools.setup(
name="lollms", name="lollms",
version="1.1.80", version="1.1.83",
author="Saifeddine ALOUI", author="Saifeddine ALOUI",
author_email="aloui.saifeddine@gmail.com", author_email="aloui.saifeddine@gmail.com",
description="A python library for AI personality definition", description="A python library for AI personality definition",