mirror of
https://github.com/ParisNeo/lollms.git
synced 2024-12-18 20:27:58 +00:00
Merge branch 'main' of https://github.com/ParisNeo/lollms into main
This commit is contained in:
commit
5ff24a4db0
@ -22,6 +22,9 @@ class LollmsApplication:
|
|||||||
self.mounted_personalities = []
|
self.mounted_personalities = []
|
||||||
self.personality = None
|
self.personality = None
|
||||||
|
|
||||||
|
self.binding=None
|
||||||
|
self.model=None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if config.auto_update:
|
if config.auto_update:
|
||||||
ASCIIColors.info("Bindings zoo found in your personal space.\nPulling last personalities zoo")
|
ASCIIColors.info("Bindings zoo found in your personal space.\nPulling last personalities zoo")
|
||||||
@ -38,11 +41,10 @@ class LollmsApplication:
|
|||||||
|
|
||||||
if self.config.binding_name is None:
|
if self.config.binding_name is None:
|
||||||
ASCIIColors.warning(f"No binding selected")
|
ASCIIColors.warning(f"No binding selected")
|
||||||
ASCIIColors.info("Please select a valid model or install a new one from a url")
|
|
||||||
if try_select_binding:
|
if try_select_binding:
|
||||||
|
ASCIIColors.info("Please select a valid model or install a new one from a url")
|
||||||
self.menu.select_binding()
|
self.menu.select_binding()
|
||||||
else:
|
|
||||||
self.binding=None
|
|
||||||
|
|
||||||
if load_binding:
|
if load_binding:
|
||||||
try:
|
try:
|
||||||
@ -57,23 +59,17 @@ class LollmsApplication:
|
|||||||
if load_model:
|
if load_model:
|
||||||
if self.config.model_name is None:
|
if self.config.model_name is None:
|
||||||
ASCIIColors.warning(f"No model selected")
|
ASCIIColors.warning(f"No model selected")
|
||||||
print("Please select a valid model")
|
if try_select_model:
|
||||||
self.menu.select_model()
|
print("Please select a valid model")
|
||||||
try:
|
self.menu.select_model()
|
||||||
self.model = self.load_model()
|
if self.config.model_name is not None:
|
||||||
except Exception as ex:
|
try:
|
||||||
ASCIIColors.error(f"Failed to load model.\nReturned exception: {ex}")
|
self.model = self.load_model()
|
||||||
trace_exception(ex)
|
except Exception as ex:
|
||||||
self.model = None
|
ASCIIColors.error(f"Failed to load model.\nReturned exception: {ex}")
|
||||||
else:
|
trace_exception(ex)
|
||||||
self.model = None
|
|
||||||
else:
|
else:
|
||||||
ASCIIColors.warning(f"Couldn't load binding {self.config.binding_name}.")
|
ASCIIColors.warning(f"Couldn't load binding {self.config.binding_name}.")
|
||||||
self.binding = None
|
|
||||||
self.model = None
|
|
||||||
else:
|
|
||||||
self.binding = None
|
|
||||||
self.model = None
|
|
||||||
self.mount_personalities()
|
self.mount_personalities()
|
||||||
|
|
||||||
def load_binding(self):
|
def load_binding(self):
|
||||||
|
@ -44,11 +44,7 @@ def install_package(package_name):
|
|||||||
class AIPersonality:
|
class AIPersonality:
|
||||||
|
|
||||||
# Extra
|
# Extra
|
||||||
Conditionning_commands={
|
|
||||||
"date_time": datetime.now().strftime("%A, %B %d, %Y %I:%M:%S %p"), # Replaces {{date}} with actual date
|
|
||||||
"date": datetime.now().strftime("%A, %B %d, %Y"), # Replaces {{date}} with actual date
|
|
||||||
"time": datetime.now().strftime("%H:%M:%S"), # Replaces {{time}} with actual time
|
|
||||||
}
|
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
@ -353,6 +349,14 @@ Date: {{date}}
|
|||||||
}
|
}
|
||||||
|
|
||||||
# ========================================== Properties ===========================================
|
# ========================================== Properties ===========================================
|
||||||
|
@property
|
||||||
|
def conditionning_commands(self):
|
||||||
|
return {
|
||||||
|
"date_time": datetime.now().strftime("%A, %B %d, %Y %I:%M:%S %p"), # Replaces {{date}} with actual date
|
||||||
|
"date": datetime.now().strftime("%A, %B %d, %Y"), # Replaces {{date}} with actual date
|
||||||
|
"time": datetime.now().strftime("%H:%M:%S"), # Replaces {{time}} with actual time
|
||||||
|
}
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def logo(self):
|
def logo(self):
|
||||||
"""
|
"""
|
||||||
@ -453,7 +457,7 @@ Date: {{date}}
|
|||||||
Returns:
|
Returns:
|
||||||
str: The personality conditioning of the AI assistant.
|
str: The personality conditioning of the AI assistant.
|
||||||
"""
|
"""
|
||||||
return self.replace_keys(self._personality_conditioning, self.Conditionning_commands)
|
return self.replace_keys(self._personality_conditioning, self.conditionning_commands)
|
||||||
|
|
||||||
@personality_conditioning.setter
|
@personality_conditioning.setter
|
||||||
def personality_conditioning(self, conditioning: str):
|
def personality_conditioning(self, conditioning: str):
|
||||||
@ -473,7 +477,7 @@ Date: {{date}}
|
|||||||
Returns:
|
Returns:
|
||||||
str: The welcome message of the AI assistant.
|
str: The welcome message of the AI assistant.
|
||||||
"""
|
"""
|
||||||
return self.replace_keys(self._welcome_message, self.Conditionning_commands)
|
return self.replace_keys(self._welcome_message, self.conditionning_commands)
|
||||||
|
|
||||||
@welcome_message.setter
|
@welcome_message.setter
|
||||||
def welcome_message(self, message: str):
|
def welcome_message(self, message: str):
|
||||||
@ -1063,7 +1067,7 @@ class APScript(StateMachine):
|
|||||||
antiprompt = self.personality.detect_antiprompt(bot_says)
|
antiprompt = self.personality.detect_antiprompt(bot_says)
|
||||||
if antiprompt:
|
if antiprompt:
|
||||||
self.bot_says = self.remove_text_from_string(bot_says,antiprompt)
|
self.bot_says = self.remove_text_from_string(bot_says,antiprompt)
|
||||||
ASCIIColors.warning(f"Detected hallucination with antiprompt: {antiprompt}")
|
ASCIIColors.warning(f"\nDetected hallucination with antiprompt: {antiprompt}")
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
self.bot_says = bot_says
|
self.bot_says = bot_says
|
||||||
|
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.53",
|
version="2.1.54",
|
||||||
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