Skip to content

Commit

Permalink
Info text adjustments
Browse files Browse the repository at this point in the history
  • Loading branch information
yorevs committed Nov 19, 2024
1 parent 0288c07 commit b81b36c
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/main/askai/core/askai_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 13 additions & 11 deletions src/main/askai/core/support/shared_instances.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/main/askai/language/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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]:
Expand Down

0 comments on commit b81b36c

Please sign in to comment.