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.personality = None
|
||||
|
||||
self.binding=None
|
||||
self.model=None
|
||||
|
||||
try:
|
||||
if config.auto_update:
|
||||
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:
|
||||
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:
|
||||
ASCIIColors.info("Please select a valid model or install a new one from a url")
|
||||
self.menu.select_binding()
|
||||
else:
|
||||
self.binding=None
|
||||
|
||||
|
||||
if load_binding:
|
||||
try:
|
||||
@ -57,23 +59,17 @@ class LollmsApplication:
|
||||
if load_model:
|
||||
if self.config.model_name is None:
|
||||
ASCIIColors.warning(f"No model selected")
|
||||
print("Please select a valid model")
|
||||
self.menu.select_model()
|
||||
try:
|
||||
self.model = self.load_model()
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Failed to load model.\nReturned exception: {ex}")
|
||||
trace_exception(ex)
|
||||
self.model = None
|
||||
else:
|
||||
self.model = None
|
||||
if try_select_model:
|
||||
print("Please select a valid model")
|
||||
self.menu.select_model()
|
||||
if self.config.model_name is not None:
|
||||
try:
|
||||
self.model = self.load_model()
|
||||
except Exception as ex:
|
||||
ASCIIColors.error(f"Failed to load model.\nReturned exception: {ex}")
|
||||
trace_exception(ex)
|
||||
else:
|
||||
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()
|
||||
|
||||
def load_binding(self):
|
||||
|
@ -44,11 +44,7 @@ def install_package(package_name):
|
||||
class AIPersonality:
|
||||
|
||||
# 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__(
|
||||
self,
|
||||
@ -353,6 +349,14 @@ Date: {{date}}
|
||||
}
|
||||
|
||||
# ========================================== 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
|
||||
def logo(self):
|
||||
"""
|
||||
@ -453,7 +457,7 @@ Date: {{date}}
|
||||
Returns:
|
||||
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
|
||||
def personality_conditioning(self, conditioning: str):
|
||||
@ -473,7 +477,7 @@ Date: {{date}}
|
||||
Returns:
|
||||
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
|
||||
def welcome_message(self, message: str):
|
||||
@ -1063,7 +1067,7 @@ class APScript(StateMachine):
|
||||
antiprompt = self.personality.detect_antiprompt(bot_says)
|
||||
if 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
|
||||
else:
|
||||
self.bot_says = bot_says
|
||||
|
Loading…
Reference in New Issue
Block a user