This commit is contained in:
saloui 2023-06-14 14:58:02 +02:00
parent 04248e848c
commit 633837a2a1
5 changed files with 67 additions and 14 deletions

View File

@ -53,6 +53,12 @@ class MainMenu:
print(f" {ASCIIColors.color_red}{ASCIIColors.color_reset} send_file: uploads a file to the AI") print(f" {ASCIIColors.color_red}{ASCIIColors.color_reset} send_file: uploads a file to the AI")
print(f" {ASCIIColors.color_red}{ASCIIColors.color_reset} exit: exists the console") print(f" {ASCIIColors.color_red}{ASCIIColors.color_reset} exit: exists the console")
if self.conversation.personality.help !="":
print(f"Personality help:")
print(f"{self.conversation.personality.help}")
def show_menu(self, options): def show_menu(self, options):
print("Menu:") print("Menu:")
for index, option in enumerate(options): for index, option in enumerate(options):
@ -301,7 +307,7 @@ class Conversation:
print(f"{ASCIIColors.color_reset}") print(f"{ASCIIColors.color_reset}")
if show_welcome_message and self.personality.welcome_message: if show_welcome_message and self.personality.welcome_message:
print(self.personality.name+": ", end="") ASCIIColors.red(self.personality.name+": ", end="")
print(self.personality.welcome_message) print(self.personality.welcome_message)
def ask_override_file(self): def ask_override_file(self):

View File

@ -30,24 +30,49 @@ class ASCIIColors:
color_bright_orange = '\u001b[38;5;208m' color_bright_orange = '\u001b[38;5;208m'
@staticmethod @staticmethod
def print(text, color=color_bright_red): def print(text, color=color_bright_red, end="\n", flush=False):
print(f"{color}{text}{ASCIIColors.color_reset}") print(f"{color}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod @staticmethod
def warning(text): def warning(text, end="\n", flush=False):
print(f"{ASCIIColors.color_bright_orange}{text}{ASCIIColors.color_reset}") print(f"{ASCIIColors.color_bright_orange}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod @staticmethod
def error(text): def error(text, end="\n", flush=False):
print(f"{ASCIIColors.color_bright_red}{text}{ASCIIColors.color_reset}") print(f"{ASCIIColors.color_bright_red}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod @staticmethod
def success(text): def success(text, end="\n", flush=False):
print(f"{ASCIIColors.color_green}{text}{ASCIIColors.color_reset}") print(f"{ASCIIColors.color_green}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod @staticmethod
def info(text): def info(text, end="\n", flush=False):
print(f"{ASCIIColors.color_blue}{text}{ASCIIColors.color_reset}") print(f"{ASCIIColors.color_blue}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod
def red(text, end="\n", flush=False):
print(f"{ASCIIColors.color_red}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod
def green(text, end="\n", flush=False):
print(f"{ASCIIColors.color_green}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod
def blue(text, end="\n", flush=False):
print(f"{ASCIIColors.color_blue}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod
def yellow(text, end="\n", flush=False):
print(f"{ASCIIColors.color_yellow}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod
def magenta(text, end="\n", flush=False):
print(f"{ASCIIColors.color_magenta}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
@staticmethod
def cyan(text, end="\n", flush=False):
print(f"{ASCIIColors.color_cyan}{text}{ASCIIColors.color_reset}", end=end, flush=flush)
class BaseConfig(): class BaseConfig():
def __init__(self, exceptional_keys=[], config = None): def __init__(self, exceptional_keys=[], config = None):

@ -1 +1 @@
Subproject commit 59441921d285c978d7d14a90ae2ff2c8b5abcde6 Subproject commit 7b97bc6b466c4dce75450b34c33a1c774cd9b966

View File

@ -329,7 +329,7 @@ Date: {{date}}
# Disclaimer # Disclaimer
self._disclaimer: str = "" self._disclaimer: str = ""
self._help: str = ""
# Default model parameters # Default model parameters
self._model_temperature: float = 0.8 # higher: more creative, lower more deterministic self._model_temperature: float = 0.8 # higher: more creative, lower more deterministic
@ -421,6 +421,7 @@ Date: {{date}}
self._anti_prompts = config.get("anti_prompts", self._anti_prompts) self._anti_prompts = config.get("anti_prompts", self._anti_prompts)
self._dependencies = config.get("dependencies", self._dependencies) self._dependencies = config.get("dependencies", self._dependencies)
self._disclaimer = config.get("disclaimer", self._disclaimer) self._disclaimer = config.get("disclaimer", self._disclaimer)
self._help = config.get("help", self._help)
self._model_temperature = config.get("model_temperature", self._model_temperature) self._model_temperature = config.get("model_temperature", self._model_temperature)
self._model_n_predicts = config.get("model_n_predicts", self._model_n_predicts) self._model_n_predicts = config.get("model_n_predicts", self._model_n_predicts)
self._model_top_k = config.get("model_top_k", self._model_top_k) self._model_top_k = config.get("model_top_k", self._model_top_k)
@ -529,6 +530,7 @@ Date: {{date}}
"anti_prompts": self._anti_prompts, "anti_prompts": self._anti_prompts,
"dependencies": self._dependencies, "dependencies": self._dependencies,
"disclaimer": self._disclaimer, "disclaimer": self._disclaimer,
"help": self._help,
"model_temperature": self._model_temperature, "model_temperature": self._model_temperature,
"model_n_predicts": self._model_n_predicts, "model_n_predicts": self._model_n_predicts,
"model_top_k": self._model_top_k, "model_top_k": self._model_top_k,
@ -567,6 +569,7 @@ Date: {{date}}
"anti_prompts": self._anti_prompts, "anti_prompts": self._anti_prompts,
"dependencies": self._dependencies, "dependencies": self._dependencies,
"disclaimer": self._disclaimer, "disclaimer": self._disclaimer,
"help": self._help,
"model_temperature": self._model_temperature, "model_temperature": self._model_temperature,
"model_n_predicts": self._model_n_predicts, "model_n_predicts": self._model_n_predicts,
"model_top_k": self._model_top_k, "model_top_k": self._model_top_k,
@ -846,6 +849,25 @@ Date: {{date}}
""" """
self._disclaimer = disclaimer self._disclaimer = disclaimer
@property
def help(self) -> str:
"""Getter method for the help attribute.
Returns:
str: The help text.
"""
return self._help
@help.setter
def help(self, help: str):
"""Setter method for the help attribute.
Args:
help (str): The help text.
"""
self._help = help
@property @property
def model_temperature(self) -> float: def model_temperature(self) -> float:
"""Get the model's temperature.""" """Get the model's temperature."""

View File

@ -26,7 +26,7 @@ def get_all_files(path):
setuptools.setup( setuptools.setup(
name="lollms", name="lollms",
version="1.1.75", version="1.1.77",
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",