From 633837a2a18c3d57f52cf70dc43aa84aac2b4673 Mon Sep 17 00:00:00 2001 From: saloui Date: Wed, 14 Jun 2023 14:58:02 +0200 Subject: [PATCH 1/4] bugfix --- lollms/console.py | 8 ++++++- lollms/helpers.py | 45 +++++++++++++++++++++++++++++++--------- lollms/personalities_zoo | 2 +- lollms/personality.py | 24 ++++++++++++++++++++- setup.py | 2 +- 5 files changed, 67 insertions(+), 14 deletions(-) diff --git a/lollms/console.py b/lollms/console.py index 9a823ac..8312690 100644 --- a/lollms/console.py +++ b/lollms/console.py @@ -52,6 +52,12 @@ class MainMenu: print(f" {ASCIIColors.color_red}├{ASCIIColors.color_reset} stop_log: stops logging the discussion to a text file") 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") + + if self.conversation.personality.help !="": + print(f"Personality help:") + print(f"{self.conversation.personality.help}") + + def show_menu(self, options): print("Menu:") @@ -301,7 +307,7 @@ class Conversation: print(f"{ASCIIColors.color_reset}") 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) def ask_override_file(self): diff --git a/lollms/helpers.py b/lollms/helpers.py index b5819b0..93fd47d 100644 --- a/lollms/helpers.py +++ b/lollms/helpers.py @@ -30,24 +30,49 @@ class ASCIIColors: color_bright_orange = '\u001b[38;5;208m' @staticmethod - def print(text, color=color_bright_red): - print(f"{color}{text}{ASCIIColors.color_reset}") + def print(text, color=color_bright_red, end="\n", flush=False): + print(f"{color}{text}{ASCIIColors.color_reset}", end=end, flush=flush) @staticmethod - def warning(text): - print(f"{ASCIIColors.color_bright_orange}{text}{ASCIIColors.color_reset}") + def warning(text, end="\n", flush=False): + print(f"{ASCIIColors.color_bright_orange}{text}{ASCIIColors.color_reset}", end=end, flush=flush) @staticmethod - def error(text): - print(f"{ASCIIColors.color_bright_red}{text}{ASCIIColors.color_reset}") + def error(text, end="\n", flush=False): + print(f"{ASCIIColors.color_bright_red}{text}{ASCIIColors.color_reset}", end=end, flush=flush) @staticmethod - def success(text): - print(f"{ASCIIColors.color_green}{text}{ASCIIColors.color_reset}") + def success(text, end="\n", flush=False): + print(f"{ASCIIColors.color_green}{text}{ASCIIColors.color_reset}", end=end, flush=flush) @staticmethod - def info(text): - print(f"{ASCIIColors.color_blue}{text}{ASCIIColors.color_reset}") + def info(text, end="\n", flush=False): + 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(): def __init__(self, exceptional_keys=[], config = None): diff --git a/lollms/personalities_zoo b/lollms/personalities_zoo index 5944192..7b97bc6 160000 --- a/lollms/personalities_zoo +++ b/lollms/personalities_zoo @@ -1 +1 @@ -Subproject commit 59441921d285c978d7d14a90ae2ff2c8b5abcde6 +Subproject commit 7b97bc6b466c4dce75450b34c33a1c774cd9b966 diff --git a/lollms/personality.py b/lollms/personality.py index 2dcfd13..a26f315 100644 --- a/lollms/personality.py +++ b/lollms/personality.py @@ -329,7 +329,7 @@ Date: {{date}} # Disclaimer self._disclaimer: str = "" - + self._help: str = "" # Default model parameters 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._dependencies = config.get("dependencies", self._dependencies) 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_n_predicts = config.get("model_n_predicts", self._model_n_predicts) self._model_top_k = config.get("model_top_k", self._model_top_k) @@ -529,6 +530,7 @@ Date: {{date}} "anti_prompts": self._anti_prompts, "dependencies": self._dependencies, "disclaimer": self._disclaimer, + "help": self._help, "model_temperature": self._model_temperature, "model_n_predicts": self._model_n_predicts, "model_top_k": self._model_top_k, @@ -567,6 +569,7 @@ Date: {{date}} "anti_prompts": self._anti_prompts, "dependencies": self._dependencies, "disclaimer": self._disclaimer, + "help": self._help, "model_temperature": self._model_temperature, "model_n_predicts": self._model_n_predicts, "model_top_k": self._model_top_k, @@ -846,6 +849,25 @@ Date: {{date}} """ 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 def model_temperature(self) -> float: """Get the model's temperature.""" diff --git a/setup.py b/setup.py index 7f45d78..6ad4e47 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="1.1.75", + version="1.1.77", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition", From e7e1b7cf4bd714e1100b554fa296c9375604acd4 Mon Sep 17 00:00:00 2001 From: saloui Date: Wed, 14 Jun 2023 17:12:47 +0200 Subject: [PATCH 2/4] upgraded code --- lollms/console.py | 8 +++++--- lollms/personalities_zoo | 2 +- setup.py | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/lollms/console.py b/lollms/console.py index 8312690..69e66c6 100644 --- a/lollms/console.py +++ b/lollms/console.py @@ -210,7 +210,8 @@ class MainMenu: print(f"{ASCIIColors.color_green}5 -{ASCIIColors.color_reset} Reinstall current Personality") print(f"{ASCIIColors.color_green}6 -{ASCIIColors.color_reset} Reset all installs") print(f"{ASCIIColors.color_green}0 -{ASCIIColors.color_reset} Back to app") - print(f"{ASCIIColors.color_green}-1 -{ASCIIColors.color_reset} Exit app") + print(f"{ASCIIColors.color_green}-1 -{ASCIIColors.color_reset} Help") + print(f"{ASCIIColors.color_green}-2 -{ASCIIColors.color_reset} Exit app") choice = input("Enter your choice: ").strip() if choice == "1": self.select_binding() @@ -229,9 +230,10 @@ class MainMenu: print("Back to main app...") break elif choice == "-1": - sys.exit(0) + self.show_commands_list() + elif choice == "-2": print("Bye") - break + sys.exit(0) else: print("Invalid choice! Try again.") diff --git a/lollms/personalities_zoo b/lollms/personalities_zoo index 7b97bc6..9ff3d53 160000 --- a/lollms/personalities_zoo +++ b/lollms/personalities_zoo @@ -1 +1 @@ -Subproject commit 7b97bc6b466c4dce75450b34c33a1c774cd9b966 +Subproject commit 9ff3d53ae7a5ffdef2c1305fd425ada7a88a0179 diff --git a/setup.py b/setup.py index 6ad4e47..29d18a5 100644 --- a/setup.py +++ b/setup.py @@ -26,7 +26,7 @@ def get_all_files(path): setuptools.setup( name="lollms", - version="1.1.77", + version="1.1.78", author="Saifeddine ALOUI", author_email="aloui.saifeddine@gmail.com", description="A python library for AI personality definition", From 3f99bd556d2435656eabd5a4e626831bfc96be21 Mon Sep 17 00:00:00 2001 From: saloui Date: Wed, 14 Jun 2023 17:15:01 +0200 Subject: [PATCH 3/4] updated --- lollms/personalities_zoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lollms/personalities_zoo b/lollms/personalities_zoo index 9ff3d53..f795a10 160000 --- a/lollms/personalities_zoo +++ b/lollms/personalities_zoo @@ -1 +1 @@ -Subproject commit 9ff3d53ae7a5ffdef2c1305fd425ada7a88a0179 +Subproject commit f795a10d61e8c509127f3ddcb435c0f5a8c328a5 From 56aec86e84a9e1226ff72c45f05edd02af9bfcd2 Mon Sep 17 00:00:00 2001 From: saloui Date: Wed, 14 Jun 2023 17:25:48 +0200 Subject: [PATCH 4/4] updated --- lollms/personalities_zoo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lollms/personalities_zoo b/lollms/personalities_zoo index f795a10..9a4705f 160000 --- a/lollms/personalities_zoo +++ b/lollms/personalities_zoo @@ -1 +1 @@ -Subproject commit f795a10d61e8c509127f3ddcb435c0f5a8c328a5 +Subproject commit 9a4705fc44a81685807d70b375f410b7742e1ec8