mirror of
https://github.com/ParisNeo/lollms.git
synced 2025-04-08 03:14:13 +00:00
enhanced paths
This commit is contained in:
parent
4cd0d86a43
commit
3db5d06591
@ -2,6 +2,7 @@ from pathlib import Path
|
||||
import shutil
|
||||
from lollms.helpers import ASCIIColors
|
||||
from lollms.config import BaseConfig
|
||||
import subprocess
|
||||
|
||||
lollms_path = Path(__file__).parent
|
||||
lollms_default_cfg_path = lollms_path / "configs/config.yaml"
|
||||
@ -9,6 +10,9 @@ lollms_bindings_zoo_path = lollms_path / "bindings_zoo"
|
||||
lollms_personalities_zoo_path = lollms_path / "personalities_zoo"
|
||||
|
||||
|
||||
personalities_zoo_repo = "https://github.com/ParisNeo/lollms_personalities_zoo.git"
|
||||
bindings_zoo_repo = "https://github.com/ParisNeo/lollms_bindings_zoo.git"
|
||||
|
||||
# Now we speify the personal folders
|
||||
class LollmsPaths:
|
||||
def __init__(self, lollms_path=None, personal_path=None, custom_default_cfg_path=None):
|
||||
@ -25,18 +29,19 @@ class LollmsPaths:
|
||||
self.default_cfg_path = Path(custom_default_cfg_path)
|
||||
else:
|
||||
self.default_cfg_path = lollms_path / "configs/config.yaml"
|
||||
self.bindings_zoo_path = lollms_path / "bindings_zoo"
|
||||
self.personalities_zoo_path = lollms_path / "personalities_zoo"
|
||||
|
||||
self.personal_path = personal_path
|
||||
self.personal_configuration_path = personal_path / "configs"
|
||||
self.personal_data_path = personal_path / "data"
|
||||
self.personal_databases_path = personal_path / "databases"
|
||||
self.personal_models_path = personal_path / "models"
|
||||
self.personal_personalities_path = lollms_path / "personalities"
|
||||
self.personal_log_path = lollms_path / "logs"
|
||||
|
||||
|
||||
self.bindings_zoo_path = personal_path / "bindings_zoo"
|
||||
self.personalities_zoo_path = personal_path / "personalities_zoo"
|
||||
|
||||
|
||||
self.create_directories()
|
||||
self.copy_default_config()
|
||||
|
||||
@ -49,9 +54,27 @@ class LollmsPaths:
|
||||
self.personal_models_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_personalities_path.mkdir(parents=True, exist_ok=True)
|
||||
self.personal_log_path.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
if not self.personalities_zoo_path.exists():
|
||||
# Clone the repository to the target path
|
||||
ASCIIColors.info("No personalities found in your personal space.\nCloning the personalities zoo")
|
||||
subprocess.run(["git", "clone", personalities_zoo_repo, self.personalities_zoo_path])
|
||||
else:
|
||||
# Pull the repository if it already exists
|
||||
ASCIIColors.info("Personalities zoo found in your personal space.\nPulling last personalities zoo")
|
||||
subprocess.run(["git", "-C", self.personalities_zoo_path, "pull"])
|
||||
|
||||
if not self.bindings_zoo_path.exists():
|
||||
# Clone the repository to the target path
|
||||
ASCIIColors.info("No personalities found in your personal space.\nCloning the personalities zoo")
|
||||
subprocess.run(["git", "clone", personalities_zoo_repo, self.bindings_zoo_path])
|
||||
else:
|
||||
# Pull the repository if it already exists
|
||||
ASCIIColors.info("Personalities zoo found in your personal space.\nPulling last personalities zoo")
|
||||
subprocess.run(["git", "-C", self.bindings_zoo_path, "pull"])
|
||||
|
||||
|
||||
def copy_default_config(self):
|
||||
local_config_path = self.personal_configuration_path / "local_config.yaml"
|
||||
if not local_config_path.exists():
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 92f7abf584946d5bdf1615b04a007ad5100e92ff
|
||||
Subproject commit 90b4d2dc287219be7079f699f0e0064b5af7945d
|
Loading…
x
Reference in New Issue
Block a user