From b81b36cd83b02bf32516483f65fc315bb7904775 Mon Sep 17 00:00:00 2001 From: Hugo Saporetti Junior Date: Tue, 19 Nov 2024 18:22:12 -0300 Subject: [PATCH] Info text adjustments --- src/main/askai/core/askai_cli.py | 1 - .../askai/core/support/shared_instances.py | 24 ++++++++++--------- src/main/askai/language/language.py | 4 ++-- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/src/main/askai/core/askai_cli.py b/src/main/askai/core/askai_cli.py index b8072642..cdd7b700 100644 --- a/src/main/askai/core/askai_cli.py +++ b/src/main/askai/core/askai_cli.py @@ -24,7 +24,6 @@ from clitt.core.term.cursor import cursor from clitt.core.term.screen import screen from clitt.core.tui.line_input.keyboard_input import KeyboardInput -from hspylib.core.decorator.decorators import profiled from hspylib.core.enums.charset import Charset from hspylib.core.tools.commons import console_out from hspylib.core.zoned_datetime import now, TIME_FORMAT diff --git a/src/main/askai/core/support/shared_instances.py b/src/main/askai/core/support/shared_instances.py index debd8310..5f3176e2 100644 --- a/src/main/askai/core/support/shared_instances.py +++ b/src/main/askai/core/support/shared_instances.py @@ -122,28 +122,30 @@ def app_info(self) -> str: eng: AIEngine = shared.engine model_info: str = f"'{eng.ai_model_name()}'%YELLOW% {eng.ai_token_limit()}%GREEN% tokens" engine_info: str = f"{eng.ai_name()} - %CYAN%{eng.nickname()} / {model_info}" - rag_info: str = "%GREEN%" if configs.is_rag else "%RED%" - return dedent( - f"""\ + rag_info: str = "%GREEN% " if configs.is_rag else "%RED% " + assist_info: str = "%GREEN% " if configs.is_assistive else "%RED% " + + # fmt: off + return dedent(f"""\ %GREEN%AskAI %YELLOW%v{Version.load(load_dir=classpath.source_path)}%GREEN% {dtm.center(80, '=')} Language: {configs.language} {translator} + Location: {' , ' + geo_location.location if configs.ip_api_enabled else '%RED% '} %GREEN% Engine: {engine_info} - Mode: %CYAN%{self.mode}%GREEN%, %YELLOW%RAG {rag_info}%GREEN% + Mode: %CYAN%{self.mode}%GREEN%, %YELLOW%RAG: {rag_info}, %YELLOW%Assistive: {assist_info}%GREEN% Dir: {cur_dir} OS: {prompt.os_type}/{prompt.shell} {'-' * 80} Microphone: %CYAN%{device_info or '%RED%Undetected'} %GREEN% - Speaking: {', tempo: ' + speak_info if configs.is_speak else '%RED%'} %GREEN% + Speaking: {' , tempo: ' + speak_info if configs.is_speak else '%RED% '} %GREEN% {'.' * 80} - Location: {', ' + geo_location.location if configs.ip_api_enabled else '%RED%'} %GREEN% - History: {'' if configs.is_keep_context else '%RED%'} %GREEN% - Debug: {'' if configs.is_debug else '%RED%'} %GREEN% - Cache: {', TTL: ' + str(configs.ttl) if configs.is_cache else '%RED%'} %GREEN% + History: {' ' if configs.is_keep_context else '%RED% '} %GREEN% + Debug: {' ' if configs.is_debug else '%RED% '} %GREEN% + Cache: {' , TTL: ' + str(configs.ttl) if configs.is_cache else '%RED% '} %GREEN% {'=' * 80}%NC% - """ - ) + """) + # fmt: on def create_engine(self, engine_name: str, model_name: str, mode: Any) -> AIEngine: """Create or retrieve an AI engine instance based on the specified engine and model names. diff --git a/src/main/askai/language/language.py b/src/main/askai/language/language.py index 6fcf6cdb..2bb2158b 100644 --- a/src/main/askai/language/language.py +++ b/src/main/askai/language/language.py @@ -170,7 +170,7 @@ def of_locale(loc: AnyLocale) -> "Language": else re.split(r"[:.]", loc) )) # fmt: off - lang = next(( + lang: Language | None = next(( Language[ln.upper()] for ln in list(map( lambda v: v.__getitem__(0), Language.values())) if ln.casefold() == loc_enc[0].casefold() @@ -191,7 +191,7 @@ def __init__(self, locale_str: str, name: str, country: str): self._language, self._territory = lang[0], lang[1] def __str__(self): - return f"{self.name} '{self.country}' '{str(self.encoding).upper()}'" + return f"{self.name} '{self.country.title()}', '{self.encoding}'" @property def locale(self) -> tuple[str, Charset]: