mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-19 04:37:54 +00:00
Merge branch 'main' of https://github.com/ParisNeo/lollms
This commit is contained in:
commit
5f13534799
@ -37,8 +37,9 @@ class LollmsPaths:
|
|||||||
self.personal_data_path = personal_path / "data"
|
self.personal_data_path = personal_path / "data"
|
||||||
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_uploads_path = lollms_path / "uploads"
|
self.personal_uploads_path = personal_path / "uploads"
|
||||||
self.personal_log_path = lollms_path / "logs"
|
self.personal_log_path = personal_path / "logs"
|
||||||
|
self.personal_outputs_path = personal_path / "outputs"
|
||||||
|
|
||||||
|
|
||||||
self.bindings_zoo_path = personal_path / "bindings_zoo"
|
self.bindings_zoo_path = personal_path / "bindings_zoo"
|
||||||
@ -57,6 +58,7 @@ class LollmsPaths:
|
|||||||
"Personal Models Path": self.personal_models_path,
|
"Personal Models Path": self.personal_models_path,
|
||||||
"Personal Uploads Path": self.personal_uploads_path,
|
"Personal Uploads Path": self.personal_uploads_path,
|
||||||
"Personal Log Path": self.personal_log_path,
|
"Personal Log Path": self.personal_log_path,
|
||||||
|
"Personal outputs Path": self.personal_outputs_path,
|
||||||
"Bindings Zoo Path": self.bindings_zoo_path,
|
"Bindings Zoo Path": self.bindings_zoo_path,
|
||||||
"Personalities Zoo Path": self.personalities_zoo_path
|
"Personalities Zoo Path": self.personalities_zoo_path
|
||||||
}
|
}
|
||||||
@ -72,6 +74,8 @@ 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_log_path.mkdir(parents=True, exist_ok=True)
|
self.personal_log_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
self.personal_outputs_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
self.personal_uploads_path.mkdir(parents=True, exist_ok=True)
|
self.personal_uploads_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
if not self.bindings_zoo_path.exists():
|
if not self.bindings_zoo_path.exists():
|
||||||
|
@ -17,7 +17,7 @@ import subprocess
|
|||||||
import yaml
|
import yaml
|
||||||
from lollms.helpers import ASCIIColors
|
from lollms.helpers import ASCIIColors
|
||||||
from lollms.types import MSG_TYPE
|
from lollms.types import MSG_TYPE
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
def is_package_installed(package_name):
|
def is_package_installed(package_name):
|
||||||
@ -1018,40 +1018,105 @@ class APScript:
|
|||||||
"""
|
"""
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def process_model_input(self, text:str):
|
def step_start(self, step_text, callback=None):
|
||||||
"""
|
"""This triggers a step start
|
||||||
Process the model input.
|
|
||||||
|
|
||||||
This method should be overridden in the personality-specific processor class to define
|
|
||||||
the desired behavior for processing the model input.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text (str): The model input text.
|
step_text (str): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step start to. Defaults to None.
|
||||||
Returns:
|
|
||||||
Any: The processed model input.
|
|
||||||
"""
|
"""
|
||||||
return None
|
if callback:
|
||||||
|
callback(step_text, MSG_TYPE.MSG_TYPE_STEP_START)
|
||||||
|
|
||||||
def process_model_output(self, text:str):
|
def step_end(self, step_text, callback=None):
|
||||||
"""
|
"""This triggers a step end
|
||||||
Process the model output.
|
|
||||||
|
|
||||||
This method should be overridden in the personality-specific processor class to define
|
|
||||||
the desired behavior for processing the model output.
|
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
text (str): The model output text.
|
step_text (str): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step end to. Defaults to None.
|
||||||
Returns:
|
|
||||||
Any: The processed model output.
|
|
||||||
"""
|
"""
|
||||||
return None
|
if callback:
|
||||||
|
callback(step_text, MSG_TYPE.MSG_TYPE_STEP_END)
|
||||||
|
|
||||||
|
def step(self, step_text, callback=None):
|
||||||
|
"""This triggers a step information
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (str): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(step_text, MSG_TYPE.MSG_TYPE_STEP)
|
||||||
|
|
||||||
|
def exception(self, ex, callback=None):
|
||||||
|
"""This sends exception to the client
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (str): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(str(ex), MSG_TYPE.MSG_TYPE_EXCEPTION)
|
||||||
|
|
||||||
|
def json(self, json_infos:dict, callback=None):
|
||||||
|
"""This sends json data to front end
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (dict): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(json.dumps(json_infos), MSG_TYPE.MSG_TYPE_JSON_INFOS)
|
||||||
|
|
||||||
|
def ui(self, html_ui:str, callback=None):
|
||||||
|
"""This sends ui elements to front end
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (dict): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(html_ui, MSG_TYPE.MSG_TYPE_UI)
|
||||||
|
|
||||||
|
def code(self, code:str, callback=None):
|
||||||
|
"""This sends code to front end
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (dict): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the step to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(code, MSG_TYPE.MSG_TYPE_CODE)
|
||||||
|
|
||||||
|
def full(self, full_text:str, callback=None):
|
||||||
|
"""This sends full text to front end
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (dict): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the text to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(full_text, MSG_TYPE.MSG_TYPE_FULL)
|
||||||
|
|
||||||
|
def info(self, info_text:str, callback=None):
|
||||||
|
"""This sends info text to front end
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (dict): The step text
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the info to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(info_text, MSG_TYPE.MSG_TYPE_FULL)
|
||||||
|
|
||||||
|
def step_progress(self, progress:float, callback=None):
|
||||||
|
"""This sends step rogress to front end
|
||||||
|
|
||||||
|
Args:
|
||||||
|
step_text (dict): The step progress in %
|
||||||
|
callback (callable, optional): A callable with this signature (str, MSG_TYPE) to send the progress to. Defaults to None.
|
||||||
|
"""
|
||||||
|
if callback:
|
||||||
|
callback(str(progress), MSG_TYPE.MSG_TYPE_STEP_PROGRESS)
|
||||||
# ===========================================================
|
# ===========================================================
|
||||||
class AIPersonalityInstaller:
|
class AIPersonalityInstaller:
|
||||||
def __init__(self, personality:AIPersonality) -> None:
|
def __init__(self, personality:AIPersonality) -> None:
|
||||||
|
2
setup.py
2
setup.py
@ -26,7 +26,7 @@ def get_all_files(path):
|
|||||||
|
|
||||||
setuptools.setup(
|
setuptools.setup(
|
||||||
name="lollms",
|
name="lollms",
|
||||||
version="2.1.18",
|
version="2.1.21",
|
||||||
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",
|
||||||
|
Loading…
Reference in New Issue
Block a user